From: Sebastian Hammer Date: Thu, 30 Mar 1995 09:39:31 +0000 (+0000) Subject: Moved .h files to include directory X-Git-Tag: YAZ.1.8~1088 X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=commitdiff_plain;h=372a500da226336c7bb4036e980be2587ad5fdeb;hp=c3a132ce4aea3bb358b185ef58781b4bef8745fc Moved .h files to include directory --- diff --git a/asn/Makefile b/asn/Makefile index b37dd08..841aaa2 100644 --- a/asn/Makefile +++ b/asn/Makefile @@ -1,10 +1,10 @@ # Copyright (C) 1994, Index Data I/S # All rights reserved. # Sebastian Hammer, Adam Dickmeiss -# $Id: Makefile,v 1.6 1995-03-27 08:32:09 quinn Exp $ +# $Id: Makefile,v 1.7 1995-03-30 09:39:31 quinn Exp $ SHELL=/bin/sh -INCLUDE=-I../include -I. -I../odr -I../util +INCLUDE=-I../include -I. LIBDIR=../../lib LIBINCLUDE=-L$(LIBDIR) #CFLAGS=-g -Wall -pedantic -ansi diff --git a/include/backend.h b/include/backend.h new file mode 100644 index 0000000..6966eb5 --- /dev/null +++ b/include/backend.h @@ -0,0 +1,74 @@ +#ifndef BACKEND_H +#define BACKEND_H + +#include + +typedef struct bend_initrequest +{ + char *configname; +} bend_initrequest; + +typedef struct bend_initresult +{ + int errcode; /* 0==OK */ + char *errstring; /* system error string or NULL */ + void *handle; /* private handle to the backend module */ +} bend_initresult; + +typedef struct bend_searchrequest +{ + char *setname; /* name to give to this set */ + int replace_set; /* replace set, if it already exists */ + int num_bases; /* number of databases in list */ + char **basenames; /* databases to search */ + Z_Query *query; /* query structure */ +} bend_searchrequest; + +typedef struct bend_searchresult +{ + int hits; /* number of hits */ + int errcode; /* 0==OK */ + char *errstring; /* system error string or NULL */ +} bend_searchresult; + +typedef struct bend_fetchrequest +{ + char *setname; /* set name */ + int number; /* record number */ +} bend_fetchrequest; + +typedef struct bend_fetchresult +{ + char *basename; /* name of database that provided record */ + int len; /* length of record */ + char *record; /* record */ + int last_in_set; /* is it? */ + int errcode; /* 0==success */ + char *errstring; /* system error string or NULL */ +} bend_fetchresult; + +typedef struct bend_deleterequest +{ + char *setname; +} bend_deleterequest; + +typedef struct bend_deleteresult +{ + int errcode; /* 0==success */ + char *errstring; /* system error string or NULL */ +} bend_deleteresult; + +bend_initresult *bend_init(bend_initrequest *r); + +bend_searchresult *bend_search(void *handle, bend_searchrequest *r, int *fd); +bend_searchresult *bend_searchresponse(void *handle); + +bend_fetchresult *bend_fetch(void *handle, bend_fetchrequest *r, int *fd); +bend_fetchresult *bend_fetchresponse(void *handle); + +bend_deleteresult *bend_delete(void *handle, bend_deleterequest *r, int *fd); +bend_deleteresult *bend_deleteresponse(void *handle); + +void bend_close(void *handle); + +#endif diff --git a/include/comstack.h b/include/comstack.h new file mode 100644 index 0000000..c7c12f1 --- /dev/null +++ b/include/comstack.h @@ -0,0 +1,133 @@ +/* + * Copyright (C) 1994, Index Data I/S + * All rights reserved. + * Sebastian Hammer, Adam Dickmeiss + * + * $Log: comstack.h,v $ + * Revision 1.1 1995-03-30 09:39:40 quinn + * Moved .h files to include directory + * + * Revision 1.11 1995/03/27 08:36:05 quinn + * Some work on nonblocking operation in xmosi.c and rfct.c. + * Added protocol parameter to cs_create() + * + * Revision 1.10 1995/03/20 09:47:12 quinn + * Added server-side support to xmosi.c + * Fixed possible problems in rfct + * Other little mods + * + * Revision 1.9 1995/03/15 15:36:27 quinn + * Mods to support nonblocking I/O + * + * Revision 1.8 1995/03/14 17:00:07 quinn + * Bug-fixes - added tracing info to tcpip.c + * + * Revision 1.7 1995/03/14 10:28:35 quinn + * Adding server-side support to tcpip.c and fixing bugs in nonblocking I/O + * + * Revision 1.6 1995/03/07 16:29:45 quinn + * Various fixes. + * + * Revision 1.5 1995/03/07 10:39:31 quinn + * Added cs_fileno + * + * Revision 1.4 1995/03/06 16:49:29 adam + * COMSTACK type inspection possible with cs_type. + * + * Revision 1.3 1995/02/14 11:54:48 quinn + * Beginning to add full CCL. + * + * Revision 1.2 1995/02/10 18:58:10 quinn + * Fixed tcpip_get (formerly tcpip_read). + * Turned tst (cli) into a proper, event-driven thing. + * + * Revision 1.1 1995/02/09 15:51:51 quinn + * Works better now. + * + */ + +#ifndef COMSTACK_H +#define COMSTACK_H + +#include + +#define COMSTACK_DEFAULT_TIMEOUT -1 + +struct comstack; +typedef struct comstack *COMSTACK; + +typedef COMSTACK (*CS_TYPE)(int blocking, int protocol); + +struct comstack +{ + CS_TYPE type; + int errno; /* current error code of this stack */ + char *stackerr;/* current lower-layer error string, or null if none */ + int iofile; /* UNIX file descriptor for iochannel */ + int timeout; /* how long to wait for trailing blocks */ + void *private; /* state info for lower stack */ + int more; /* connection has extra data in buffer */ + int state; /* current state */ +#define CS_UNBND 0 +#define CS_IDLE 1 +#define CS_INCON 2 +#define CS_OUTCON 3 +#define CS_DATAXFER 4 + int newfd; /* storing new descriptor between listen and accept */ + int blocking; /* is this link (supposed to be) blocking? */ + int event; /* current event */ +#define CS_NONE 0 +#define CS_CONNECT 1 +#define CS_DISCON 2 +#define CS_LISTEN 3 +#define CS_DATA 4 + int protocol; /* what application protocol are we talking? */ +#define CS_Z3950 0 +#define CS_SR 1 + int (*f_look)(COMSTACK handle); + int (*f_put)(COMSTACK handle, char *buf, int size); + int (*f_get)(COMSTACK handle, char **buf, int *bufsize); + int (*f_more)(COMSTACK handle); + int (*f_connect)(COMSTACK handle, void *address); + int (*f_rcvconnect)(COMSTACK handle); + int (*f_bind)(COMSTACK handle, void *address, int mode); +#define CS_CLIENT 0 +#define CS_SERVER 1 + int (*f_listen)(COMSTACK handle, char *addrp, int *addrlen); + COMSTACK (*f_accept)(COMSTACK handle); + int (*f_close)(COMSTACK handle); + /* to add: commands for the server side (bind, listen, accept) */ +}; + +#define cs_put(handle, buf, size) ((*(handle)->f_put)(handle, buf, size)) +#define cs_get(handle, buf, size) ((*(handle)->f_get)(handle, buf, size)) +#define cs_more(handle) ((*(handle)->f_more)(handle)) +#define cs_connect(handle, address) ((*(handle)->f_connect)(handle, address)) +#define cs_rcvconnect(handle) ((*(handle)->f_rcvconnect)(handle)) +#define cs_bind(handle, ad, mo) ((*(handle)->f_bind)(handle, ad, mo)) +#define cs_listen(handle, ap, al) ((*(handle)->f_listen)(handle, ap, al)) +#define cs_accept(handle) ((*(handle)->f_accept)(handle)) +#define cs_close(handle) ((*(handle)->f_close)(handle)) +#define cs_create(type, blocking, proto) ((*type)(blocking, proto)) +#define cs_type(handle) ((handle)->type) +#define cs_fileno(handle) ((handle)->iofile) +#define cs_stackerr(handle) ((handle)->stackerr) +#define cs_getstate(handle) ((handle)->getstate) +#define cs_errno(handle) ((handle)->errno) +#define cs_getproto(handle) ((handle)->protocol) + +const char *cs_strerror(COMSTACK h); + +/* + * error management. + */ + +#define CSNONE 0 +#define CSYSERR 1 +#define CSOUTSTATE 2 +#define CSNODATA 3 +#define CSWRONGBUF 4 + +extern char *cs_errlist[]; + +#endif diff --git a/include/diagbib1.h b/include/diagbib1.h new file mode 100644 index 0000000..38a08f3 --- /dev/null +++ b/include/diagbib1.h @@ -0,0 +1,15 @@ +/* + * Copyright (C) 1994, Index Data I/S + * All rights reserved. + * Sebastian Hammer, Adam Dickmeiss + * + * $Log: diagbib1.h,v $ + * Revision 1.1 1995-03-30 09:39:40 quinn + * Moved .h files to include directory + * + * Revision 1.1 1995/03/15 13:46:09 adam + * New function diagbib1_str. + * + */ + +const char *diagbib1_str (int code); diff --git a/include/dmalloc.h b/include/dmalloc.h new file mode 100644 index 0000000..f38af77 --- /dev/null +++ b/include/dmalloc.h @@ -0,0 +1,41 @@ +/* + * Copyright (C) 1994, Index Data I/S + * All rights reserved. + * Sebastian Hammer, Adam Dickmeiss + * + * $Log: dmalloc.h,v $ + * Revision 1.1 1995-03-30 09:39:40 quinn + * Moved .h files to include directory + * + * Revision 1.1 1995/03/27 08:35:18 quinn + * Created util library + * Added memory debugging module. Imported options-manager + * + * + */ + +#ifndef DMALLOC_H +#define DMALLOC_H + +#ifdef DEBUG_MALLOC + +#ifdef malloc +#undef malloc +#endif +#ifdef free +#undef free +#endif +#ifdef realloc +#undef realloc +#endif +#define malloc(n) d_malloc(__FILE__, __LINE__, (n)) +#define free(p) d_free(__FILE__, __LINE__, (p)) +#define realloc(p, n) d_realloc(__FILE__, __LINE__, (p), (n)) + +void *d_malloc(char *file, int line, int nbytes); +void d_free(char *file, int line, char *ptr); +void *d_realloc(char *file, int line, char *ptr, int nbytes); + +#endif + +#endif diff --git a/include/log.h b/include/log.h new file mode 100644 index 0000000..0cfb211 --- /dev/null +++ b/include/log.h @@ -0,0 +1,41 @@ +/* + * Copyright (C) 1994, Index Data I/S + * All rights reserved. + * Sebastian Hammer, Adam Dickmeiss + * + * $Log: log.h,v $ + * Revision 1.1 1995-03-30 09:39:41 quinn + * Moved .h files to include directory + * + * Revision 1.4 1994/09/28 13:07:22 adam + * Added log_mask_str. + * + * Revision 1.3 1994/08/18 08:18:45 quinn + * Added prefix to log_init. + * + * Revision 1.2 1994/08/17 14:27:46 quinn + * added LOG_ERRNO + * + * Revision 1.1 1994/08/17 13:22:52 quinn + * First version + * + */ + +#ifndef LOG_H +#define LOG_H + +#define LOG_FATAL 0x0001 +#define LOG_DEBUG 0x0002 +#define LOG_WARN 0x0004 +#define LOG_LOG 0x0008 +#define LOG_ERRNO 0x0010 /* apend strerror to message */ + +#define LOG_ALL 0xffff + +#define LOG_DEFAULT_LEVEL (LOG_FATAL | LOG_ERRNO | LOG_LOG | LOG_WARN) + +void log_init(int level, const char *prefix, const char *name); +void logf(int level, const char *fmt, ...); +int log_mask_str (const char *str); + +#endif diff --git a/include/odr.h b/include/odr.h new file mode 100644 index 0000000..abdeabd --- /dev/null +++ b/include/odr.h @@ -0,0 +1,227 @@ + +/* + * Copyright (C) 1994, Index Data I/S + * All rights reserved. + * Sebastian Hammer, Adam Dickmeiss + * + * $Log: odr.h,v $ + * Revision 1.1 1995-03-30 09:39:41 quinn + * Moved .h files to include directory + * + * Revision 1.15 1995/03/29 15:39:57 quinn + * Fixed bugs in the bitmask operations + * + * Revision 1.14 1995/03/27 08:33:15 quinn + * Added more OID utilities. + * + * Revision 1.13 1995/03/17 10:17:44 quinn + * Added memory management. + * + * Revision 1.12 1995/03/14 10:27:38 quinn + * Modified makefile to use common lib + * Beginning to add memory management to odr + * + * Revision 1.11 1995/03/10 11:44:41 quinn + * Fixed serious stack-bug in odr_cons_begin + * + * Revision 1.10 1995/03/08 12:12:16 quinn + * Added better error checking. + * + * Revision 1.9 1995/03/07 10:10:00 quinn + * Added some headers for Adam. + * + * Revision 1.8 1995/03/07 09:23:16 quinn + * Installing top-level API and documentation. + * + * Revision 1.7 1995/02/10 15:55:29 quinn + * Bug fixes, mostly. + * + * Revision 1.6 1995/02/09 15:51:47 quinn + * Works better now. + * + * Revision 1.5 1995/02/07 17:52:59 quinn + * A damn mess, but now things work, I think. + * + * Revision 1.4 1995/02/06 16:45:03 quinn + * Small mods. + * + * Revision 1.3 1995/02/03 17:04:36 quinn + * *** empty log message *** + * + * Revision 1.2 1995/02/02 20:38:50 quinn + * Updates. + * + * Revision 1.1 1995/02/02 16:21:53 quinn + * First kick. + * + */ + +#ifndef ODR_H +#define ODR_H + +#include +#include + +#ifndef bool_t +#define bool_t int +#endif + +/* + * Tag modes + */ +#define ODR_NONE -1 +#define ODR_IMPLICIT 0 +#define ODR_EXPLICIT 1 + +/* + * Classes + */ +#define ODR_UNIVERSAL 0 +#define ODR_APPLICATION 1 +#define ODR_CONTEXT 2 +#define ODR_PRIVATE 3 + +/* + * UNIVERSAL tags + */ +#define ODR_BOOLEAN 1 +#define ODR_INTEGER 2 +#define ODR_BITSTRING 3 +#define ODR_OCTETSTRING 4 +#define ODR_NULL 5 +#define ODR_OID 6 +#define ODR_ODESC 7 +#define ODR_EXTERNAL 8 +#define ODR_REAL 9 +#define ODR_ENUM 10 +#define ODR_SEQUENCE 16 +#define ODR_SET 17 +#define ODR_NUMERICSTRING 18 +#define ODR_PRINTABLESTRING 19 +#define ODR_GRAPHICSTRING 25 +#define ODR_VISIBLESTRING 26 + +/* + * odr stream directions + */ +#define ODR_DECODE 0 +#define ODR_ENCODE 1 +#define ODR_PRINT 2 + +typedef struct odr_oct +{ + unsigned char *buf; + int len; + int size; +} Odr_oct; + +typedef Odr_oct Odr_any; + +typedef struct odr_bitmask +{ +#define ODR_BITMASK_SIZE 256 + unsigned char bits[ODR_BITMASK_SIZE]; + int top; +} Odr_bitmask; + +#define ODR_OID_SIZE 100 +typedef int Odr_oid; /* terminate by -1 */ + +typedef struct odr_constack +{ + unsigned char *base; /* starting point of data */ + int len; /* length of data, if known, else -1 + (decoding only) */ + unsigned char *lenb; /* where to encode length */ + int lenlen; /* length of length-field */ +} odr_constack; + +struct odr_memblock; /* defined in odr_mem.c */ + +typedef struct odr +{ + int direction; /* the direction of this stream */ + + int error; /* current error state (0==OK) */ + unsigned char *buf; /* for encoding or decoding */ + int buflen; /* size of buffer for encoding, len for decoding */ + unsigned char *bp; /* position in buffer */ + int left; /* bytes remaining in buffer */ + + int t_class; /* implicit tagging (-1==default tag) */ + int t_tag; + + FILE *print; /* output file for direction print */ + int indent; /* current indent level for printing */ + + struct odr_memblock *mem; + + /* stack for constructed types */ +#define ODR_MAX_STACK 50 + int stackp; /* top of stack (-1 == initial state) */ + odr_constack stack[ODR_MAX_STACK]; +} *ODR; + +typedef int (*Odr_fun)(); + +typedef struct odr_arm +{ + int tagmode; + int class; + int tag; + int which; + Odr_fun fun; +} Odr_arm; + +/* + * Error control. + */ +#define ONONE 0 +#define OMEMORY 1 +#define OSYSERR 2 +#define OSPACE 3 +#define OREQUIRED 4 +#define OUNEXPECTED 5 +#define OOTHER 6 +#define OPROTO 7 +#define ODATA 8 +#define OSTACK 9 + +extern char *odr_errlist[]; + +int odr_geterror(ODR o); +void odr_perror(ODR o, char *message); +void odr_setprint(ODR o, FILE *file); +ODR odr_createmem(int direction); +void odr_reset(ODR o); +void odr_destroy(ODR o); +void odr_setbuf(ODR o, char *buf, int len); +char *odr_getbuf(ODR o, int *len); +void *odr_malloc(ODR o, int size); + +#define odr_implicit(o, t, p, cl, tg, opt)\ + (odr_implicit_settag((o), cl, tg), t ((o), (p), opt) ) + +#define odr_explicit(o, t, p, cl, tg, opt)\ + ((int) (odr_constructed_begin((o), (p), (cl), (tg)) ? \ + t ((o), (p), (opt)) &&\ + odr_constructed_end(o) : opt)) + +#define ODR_MASK_ZERO(mask)\ + ((void) (memset((mask)->bits, 0, ODR_BITMASK_SIZE),\ + (mask)->top = -1)) + +#define ODR_MASK_SET(mask, num)\ + (((mask)->bits[(num) >> 3] |= 0X80 >> ((num) & 0X07)),\ + (mask)->top < (num) >> 3 ? ((mask)->top = (num) >> 3) : 0) + +#define ODR_MASK_CLEAR(mask, num)\ + ((mask)->bits[(num) >> 3] &= ~(0X80 >> ((num) & 0X07))) + +#define ODR_MASK_GET(mask, num) ( ((num) >> 3 <= (mask)->top) ? \ + ((mask)->bits[(num) >> 3] & (0X80 >> ((num) & 0X07)) ? 1 : 0) : 0) + +#include +#include + +#endif diff --git a/include/odr_use.h b/include/odr_use.h new file mode 100644 index 0000000..5ad078b --- /dev/null +++ b/include/odr_use.h @@ -0,0 +1,43 @@ +/* + * Copyright (C) 1994, Index Data I/S + * All rights reserved. + * Sebastian Hammer, Adam Dickmeiss + * + * $Log: odr_use.h,v $ + * Revision 1.1 1995-03-30 09:39:41 quinn + * Moved .h files to include directory + * + * Revision 1.2 1995/02/09 15:51:50 quinn + * Works better now. + * + * Revision 1.1 1995/02/07 17:53:00 quinn + * A damn mess, but now things work, I think. + * + */ + +#ifndef ODR_USE_H +#define ODR_USE_H + +typedef struct Odr_external +{ + Odr_oid *direct_reference; /* OPTIONAL */ + int *indirect_reference; /* OPTIONAL */ + char *descriptor; /* OPTIONAL */ + int which; +#define ODR_EXTERNAL_single 0 +#define ODR_EXTERNAL_octet 1 +#define ODR_EXTERNAL_arbitrary 2 + union + { + Odr_any *single_ASN1_type; + Odr_oct *octet_aligned; /* should be union */ + Odr_bitmask *arbitrary; /* we aren't really equipped for this*/ + } u; +} Odr_external; + +int odr_external(ODR o, Odr_external **p, int opt); + +int odr_visiblestring(ODR o, char **p, int opt); +int odr_graphicstring(ODR o, char **p, int opt); + +#endif diff --git a/include/oid.h b/include/oid.h new file mode 100644 index 0000000..45b8f83 --- /dev/null +++ b/include/oid.h @@ -0,0 +1,105 @@ +/* + * Copyright (C) 1994, Index Data I/S + * All rights reserved. + * Sebastian Hammer, Adam Dickmeiss + * + * $Log: oid.h,v $ + * Revision 1.1 1995-03-30 09:39:41 quinn + * Moved .h files to include directory + * + * Revision 1.1 1995/03/27 08:32:13 quinn + * Added OID database + * + * + */ + +#ifndef OID_H +#define OID_H + +#include + +typedef struct oident +{ + enum oid_proto + { + PROTO_Z3950, + PROTO_SR, + PROTO_GENERAL + } proto; + enum oid_class + { + CLASS_APPCTX, + CLASS_ABSYN, + CLASS_ATTSET, + CLASS_TRANSYN, + CLASS_DIAGSET, + CLASS_RECSYN, + CLASS_RESFORM, + CLASS_ACCFORM, + CLASS_EXTSERV, + CLASS_USERINFO, + CLASS_ELEMSPEC, + CLASS_VARSET, + CLASS_DBSCHEMA, + CLASS_TAGSET + } class; + enum oid_value + { + VAL_APDU, + VAL_BER, + VAL_BASIC_CTX, + VAL_BIB1, + VAL_EXP1, + VAL_EXT1, + VAL_CCL1, + VAL_GILS, + VAL_STAS, + VAL_DIAG1, + VAL_ISO2709, + VAL_UNIMARC, + VAL_INTERMARC, + VAL_CCF, + VAL_USMARC, + VAL_UKMARC, + VAL_NORMARC, + VAL_LIBRISMARC, + VAL_DANMARC, + VAL_FINMARC, + VAL_MAB, + VAL_CANMARC, + VAL_SBN, + VAL_PICAMARC, + VAL_AUSMARC, + VAL_IBERMARC, + VAL_EXPLAIN, + VAL_SUTRS, + VAL_OPAC, + VAL_SUMMARY, + VAL_GRS0, + VAL_GRS1, + VAL_EXTENDED, + VAL_RESOURCE1, + VAL_RESOURCE2, + VAL_PROMPT1, + VAL_DES1, + VAL_KRB1, + VAL_PRESSET, + VAL_PQUERY, + VAL_PCQUERY, + VAL_ITEMORDER, + VAL_DBUPDATE, + VAL_EXPORTSPEC, + VAL_EXPORTINV + } value; + Odr_oid oidsuffix[20]; + char *desc; +} oident; + +typedef enum oid_proto oid_proto; +typedef enum oid_class oid_class; +typedef enum oid_value oid_value; + +Odr_oid *oid_getoidbyent(struct oident *ent); +struct oident *oid_getentbyoid(Odr_oid *o); + +#endif diff --git a/include/options.h b/include/options.h new file mode 100644 index 0000000..8922b3e --- /dev/null +++ b/include/options.h @@ -0,0 +1,26 @@ +/* + * Copyright (C) 1994, Index Data I/S + * All rights reserved. + * Sebastian Hammer, Adam Dickmeiss + * + * $Log: options.h,v $ + * Revision 1.1 1995-03-30 09:39:42 quinn + * Moved .h files to include directory + * + * Revision 1.1 1995/03/27 08:35:19 quinn + * Created util library + * Added memory debugging module. Imported options-manager + * + * Revision 1.2 1994/08/16 16:16:03 adam + * bfile header created. + * + * Revision 1.1 1994/08/16 16:04:35 adam + * Added header file options.h + * + */ + +#ifndef OPTIONS_H +#define OPTIONS_H +int options (const char *desc, char **argv, int argc, char **arg); +#endif + diff --git a/include/proto.h b/include/proto.h new file mode 100644 index 0000000..313c603 --- /dev/null +++ b/include/proto.h @@ -0,0 +1,463 @@ +/* + * Copyright (C) 1994, Index Data I/S + * All rights reserved. + * Sebastian Hammer, Adam Dickmeiss + * + * $Log: proto.h,v $ + * Revision 1.1 1995-03-30 09:39:42 quinn + * Moved .h files to include directory + * + * Revision 1.11 1995/03/30 09:08:44 quinn + * Added Resource control protocol + * + * Revision 1.10 1995/03/29 15:39:39 quinn + * Adding some resource control elements, and a null-check to getentbyoid + * + * Revision 1.9 1995/03/29 08:06:18 quinn + * Added a few v3 elements + * + * Revision 1.8 1995/03/22 10:12:49 quinn + * Added Z_PRES constants. + * + * Revision 1.7 1995/03/20 09:45:12 quinn + * Working towards v3 + * + * Revision 1.5 1995/03/07 16:29:34 quinn + * Added authentication stuff. + * + * Revision 1.4 1995/03/07 10:13:00 quinn + * Added prototype for z_APDU() + * + * Revision 1.3 1995/02/14 11:54:23 quinn + * Fixing include. + * + * Revision 1.2 1995/02/09 15:51:40 quinn + * Works better now. + * + * Revision 1.1 1995/02/06 16:44:48 quinn + * First hack at Z/SR protocol + * + */ + +#ifndef PROTO_H +#define PROTO_H + +#include +#include + +/* ----------------- GLOBAL AUXILIARY DEFS ----------------*/ + +typedef Odr_oct Z_ReferenceId; +typedef char Z_DatabaseName; +typedef char Z_ResultSetId; +typedef Odr_oct Z_ResultsetId; +typedef Odr_external Z_UserInformationField; + +/* ----------------- INIT SERVICE ----------------*/ + +typedef struct +{ + char *groupId; /* OPTIONAL */ + char *userId; /* OPTIONAL */ + char *password; /* OPTIONAL */ +} Z_IdPass; + +typedef struct Z_IdAuthentication +{ + enum + { + Z_IdAuthentication_open, + Z_IdAuthentication_idPass, + Z_IdAuthentication_anonymous, + Z_IdAuthentication_other + } which; + union + { + char *open; + Z_IdPass *idPass; + void *anonymous; /* NULL */ + Odr_external *other; + } u; +} Z_IdAuthentication; + +#define Z_ProtocolVersion_1 0 +#define Z_ProtocolVersion_2 1 +#define Z_ProtocolVersion_3 2 + +#define Z_Options_search 0 +#define Z_Options_present 1 +#define Z_Options_delSet 2 +#define Z_Options_resourceReport 3 +#define Z_Options_triggerResourceCtrl 4 +#define Z_Options_resourceCtrl 5 +#define Z_Options_accessCtrl 6 +#define Z_Options_scan 7 +#define Z_Options_sort 8 +#define Z_Options_reserved 9 +#define Z_Options_extendedServices 10 +#define Z_Options_level_1Segmentation 11 +#define Z_Options_level_2Segmentation 12 +#define Z_Options_concurrentOperations 13 +#define Z_Options_namedResultSets 14 + +typedef struct Z_InitRequest +{ + Z_ReferenceId *referenceId; /* OPTIONAL */ + Odr_bitmask *options; + Odr_bitmask *protocolVersion; + int *preferredMessageSize; + int *maximumRecordSize; + Z_IdAuthentication* idAuthentication; /* OPTIONAL */ + char *implementationId; /* OPTIONAL */ + char *implementationName; /* OPTIONAL */ + char *implementationVersion; /* OPTIONAL */ + Z_UserInformationField *userInformationField; /* OPTIONAL */ +} Z_InitRequest; + +typedef struct Z_InitResponse +{ + Z_ReferenceId *referenceId; /* OPTIONAL */ + Odr_bitmask *options; + Odr_bitmask *protocolVersion; + int *preferredMessageSize; + int *maximumRecordSize; + bool_t *result; + char *implementationId; /* OPTIONAL */ + char *implementationName; /* OPTIONAL */ + char *implementationVersion; /* OPTIONAL */ + Z_UserInformationField *userInformationField; /* OPTIONAL */ +} Z_InitResponse; + +typedef struct Z_NSRAuthentication +{ + char *user; + char *password; + char *account; +} Z_NSRAuthentication; + +int z_NSRAuthentication(ODR o, Z_NSRAuthentication **p, int opt); + +int z_StrAuthentication(ODR o, char **p, int opt); + + +/* ------------------ RESOURCE CONTROL ----------------*/ + +typedef struct Z_TriggerResourceControlRequest +{ + Z_ReferenceId *referenceId; /* OPTIONAL */ + int *requestedAction; +#define Z_TriggerResourceCtrl_resourceReport 1 +#define Z_TriggerResourceCtrl_resourceControl 2 +#define Z_TriggerResourceCtrl_cancel 3 + Odr_oid *prefResourceReportFormat; /* OPTIONAL */ + bool_t *resultSetWanted; /* OPTIONAL */ +} Z_TriggerResourceControlRequest; + +typedef struct Z_ResourceControlRequest +{ + Z_ReferenceId *referenceId; /* OPTIONAL */ + bool_t *suspendedFlag; /* OPTIONAL */ + Odr_external *resourceReport; /* OPTIONAL */ + int *partialResultsAvailable; /* OPTIONAL */ +#define Z_ResourceControlRequest_subset 1 +#define Z_ResourceControlRequest_interim 2 +#define Z_ResourceControlRequest_none 3 + bool_t *responseRequired; + bool_t *triggeredRequestFlag; /* OPTIONAL */ +} Z_ResourceControlRequest; + +typedef struct Z_ResourceControlResponse +{ + Z_ReferenceId *referenceId; /* OPTIONAL */ + bool_t *continueFlag; + bool_t *resultSetWanted; /* OPTIONAL */ +} Z_ResourceControlResponse; + +/* ------------------ SEARCH SERVICE ----------------*/ + +typedef Odr_oid Z_PreferredRecordSyntax; + +typedef struct Z_DatabaseSpecificUnit +{ + char *databaseName; + char *elementSetName; +} Z_DatabaseSpecificUnit; + +typedef struct Z_DatabaseSpecific +{ + int num_elements; + Z_DatabaseSpecificUnit **elements; +} Z_DatabaseSpecific; + +typedef struct Z_ElementSetNames +{ + int which; +#define Z_ElementSetNames_generic 0 +#define Z_ElementSetNames_databaseSpecific 1 + union + { + char *generic; + Z_DatabaseSpecific *databaseSpecific; + } u; +} Z_ElementSetNames; + +/* ---------------------- RPN QUERY --------------------------- */ + +typedef struct Z_AttributeElement +{ + int *attributeType; + int *attributeValue; +} Z_AttributeElement; + +#ifdef Z_V3 + +typedef struct Z_Term +{ + enum + { + Z_Term_general, + Z_Term_numeric, + Z_Term_characterString, + Z_Term_oid, + Z_Term_dateTime, + Z_Term_external, + Z_Term_integerAndUnit, + Z_Term_null + } which; + union + { + Odr_oct *general; + int *numeric; + char *characterString; + Odr_oid *oid; + char *dateTime; + Odr_external *external; + Z_IntUnit *integerAndUnit; + void *null; + } u; +} Z_Term; + +#endif + +typedef struct Z_AttributesPlusTerm +{ + int num_attributes; + Z_AttributeElement **attributeList; +#ifdef Z_V3 + Z_Term *term; +#else + Odr_oct *term; +#endif +} Z_AttributesPlusTerm; + +typedef struct Z_ProximityOperator +{ + bool_t *exclusion; /* OPTIONAL */ + int *distance; + bool_t *ordered; + int *relationType; + enum + { + Z_ProximityOperator_known, + Z_ProximityOperator_private + } which; + union + { + int *known; + int *private; + } u; +} Z_ProximityOperator; + +typedef struct Z_Operator +{ + enum + { + Z_Operator_and, + Z_Operator_or, + Z_Operator_and_not, + Z_Operator_proximity + } which; + union + { + void *and; /* these guys are nulls. */ + void *or; + void *and_not; + Z_ProximityOperator *proximity; + } u; +} Z_Operator; + +typedef struct Z_Operand +{ + int which; +#define Z_Operand_APT 0 +#define Z_Operand_resultSetId 1 + union + { + Z_AttributesPlusTerm *attributesPlusTerm; + Z_ResultSetId *resultSetId; + } u; +} Z_Operand; + +typedef struct Z_Complex +{ + struct Z_RPNStructure *s1; + struct Z_RPNStructure *s2; + Z_Operator *operator; +} Z_Complex; + +typedef struct Z_RPNStructure +{ + int which; +#define Z_RPNStructure_simple 0 +#define Z_RPNStructure_complex 1 + union + { + Z_Operand *simple; + Z_Complex *complex; + } u; +} Z_RPNStructure; + +typedef struct Z_RPNQuery +{ + Odr_oid *attributeSetId; + Z_RPNStructure *RPNStructure; +} Z_RPNQuery; + +/* -------------------------- SEARCHREQUEST -------------------------- */ + +typedef struct Z_Query +{ + int which; +#define Z_Query_type_1 1 +#define Z_Query_type_2 2 + union + { + Z_RPNQuery *type_1; + Odr_oct *type_2; + } u; +} Z_Query; + +typedef struct Z_SearchRequest +{ + Z_ReferenceId *referenceId; /* OPTIONAL */ + int *smallSetUpperBound; + int *largeSetLowerBound; + int *mediumSetPresentNumber; + bool_t *replaceIndicator; + char *resultSetName; + int num_databaseNames; + char **databaseNames; + Z_ElementSetNames *smallSetElementSetNames; /* OPTIONAL */ + Z_ElementSetNames *mediumSetElementSetNames; /* OPTIONAL */ + Z_PreferredRecordSyntax *preferredRecordSyntax; /* OPTIONAL */ + Z_Query *query; +} Z_SearchRequest; + +/* ------------------------ RECORD -------------------------- */ + +typedef Odr_external Z_DatabaseRecord; + +typedef struct Z_DiagRec +{ + Odr_oid *diagnosticSetId; + int *condition; + char *addinfo; +} Z_DiagRec; + +typedef struct Z_NamePlusRecord +{ + char *databaseName; /* OPTIONAL */ + int which; +#define Z_NamePlusRecord_databaseRecord 0 +#define Z_NamePlusRecord_surrogateDiagnostic 1 + union + { + Z_DatabaseRecord *databaseRecord; + Z_DiagRec *surrogateDiagnostic; + } u; +} Z_NamePlusRecord; + +typedef struct Z_NamePlusRecordList +{ + int num_records; + Z_NamePlusRecord **records; +} Z_NamePlusRecordList; + +typedef struct Z_Records +{ + int which; +#define Z_Records_DBOSD 0 +#define Z_Records_NSD 1 + union + { + Z_NamePlusRecordList *databaseOrSurDiagnostics; + Z_DiagRec *nonSurrogateDiagnostic; + } u; +} Z_Records; + +/* ------------------------ SEARCHRESPONSE ------------------ */ + +typedef struct Z_SearchResponse +{ + Z_ReferenceId *referenceId; /* OPTIONAL */ + int *resultCount; + int *numberOfRecordsReturned; + int *nextResultSetPosition; + bool_t *searchStatus; + int *resultSetStatus; /* OPTIONAL */ + int *presentStatus; /* OPTIONAL */ +#define Z_PRES_SUCCESS 0 +#define Z_PRES_PARTIAL_1 1 +#define Z_PRES_PARTIAL_2 2 +#define Z_PRES_PARTIAL_3 3 +#define Z_PRES_PARTIAL_4 4 +#define Z_PRES_FAILURE 5 + Z_Records *records; /* OPTIONAL */ +} Z_SearchResponse; + +/* ------------------------- PRESENT SERVICE -----------------*/ + +typedef struct Z_PresentRequest +{ + Z_ReferenceId *referenceId; /* OPTIONAL */ + Z_ResultSetId *resultSetId; + int *resultSetStartPoint; + int *numberOfRecordsRequested; + Z_ElementSetNames *elementSetNames; /* OPTIONAL */ + Z_PreferredRecordSyntax *preferredRecordSyntax; /* OPTIONAL */ +} Z_PresentRequest; + +typedef struct Z_PresentResponse +{ + Z_ReferenceId *referenceId; /* OPTIONAL */ + int *numberOfRecordsReturned; + int *nextResultSetPosition; + int *presentStatus; + Z_Records *records; +} Z_PresentResponse; + +/* ------------------------ APDU ---------------------------- */ + +typedef struct Z_APDU +{ + int which; +#define Z_APDU_initRequest 0 +#define Z_APDU_initResponse 1 +#define Z_APDU_searchRequest 2 +#define Z_APDU_searchResponse 3 +#define Z_APDU_presentRequest 4 +#define Z_APDU_presentResponse 5 + union + { + Z_InitRequest *initRequest; + Z_InitResponse *initResponse; + Z_SearchRequest *searchRequest; + Z_SearchResponse *searchResponse; + Z_PresentRequest *presentRequest; + Z_PresentResponse *presentResponse; + } u; +} Z_APDU; + +int z_APDU(ODR o, Z_APDU **p, int opt); + +#endif diff --git a/include/prt.h b/include/prt.h new file mode 100644 index 0000000..39ddc65 --- /dev/null +++ b/include/prt.h @@ -0,0 +1,44 @@ +int ber_boolean(ODR o, int *val); +int ber_tag(ODR o, void *p, int class, int tag, int *constructed, int opt); +int ber_enctag(unsigned char *buf, int class, int tag, int constructed, int len); +int ber_dectag(unsigned char *buf, int *class, int *tag, int *constructed); +int odr_bool(ODR o, int **p, int opt); +int odr_integer(ODR o, int **p, int opt); +int odr_implicit_settag(ODR o, int class, int tag); +#if 0 +int odr_implicit(ODR o, int (*type)(ODR o, void *p, int opt), void *p, + int class, int tag, int opt); +#endif +int ber_enclen(unsigned char *buf, int len, int lenlen, int exact); +int ber_declen(unsigned char *buf, int *len); +char *odr_indent(ODR o); +int ber_null(ODR o, int *val); +int odr_null(ODR o, int **p, int opt); +int ber_integer(ODR o, int *val); +int odr_constructed_begin(ODR o, void *p, int class, int tag); +int odr_constructed_end(ODR o); +int odr_sequence_begin(ODR o, void *p, int size); +int odr_sequence_end(ODR o); +int ber_octetstring(ODR o, Odr_oct *p, int cons); +int odr_octetstring(ODR o, Odr_oct **p, int opt); +int odp_more_chunks(ODR o, unsigned char *base, int len); +int odr_constructed_more(ODR o); +int odr_bitstring(ODR o, Odr_bitmask **p, int opt); +int ber_bitstring(ODR o, Odr_bitmask *p, int cons); +int odr_visiblestring(ODR o, char **p, int opt); +int ber_oidc(ODR o, Odr_oid *p); +int odr_oid(ODR o, Odr_oid **p, int opt); +int odr_choice(ODR o, Odr_arm arm[], void *p, void *whichp); +int odr_cstring(ODR o, char **p, int opt); +int odr_sequence_of(ODR o, Odr_fun type, void *p, int *num); +int odr_any(ODR o, Odr_any **p, int opt); +int ber_any(ODR o, Odr_any **p); +int completeBER(unsigned char *buf, int len); +void odr_begin(ODR o); +void odr_end(ODR o); +void odr_release_mem(struct odr_memblock *p); +void odr_oidcpy(Odr_oid *t, Odr_oid *s); +void odr_oidcat(Odr_oid *t, Odr_oid *s); +int odr_oidcmp(Odr_oid *o1, Odr_oid *o2); +int odr_oidlen(Odr_oid *o); +Odr_oid *odr_oiddup(ODR odr, Odr_oid *o); diff --git a/include/statserv.h b/include/statserv.h new file mode 100644 index 0000000..f9f27ff --- /dev/null +++ b/include/statserv.h @@ -0,0 +1,6 @@ +#ifndef STATSERVER_H +#define STATSERVER_H + +int statserv_main(int argc, char **argv); + +#endif diff --git a/include/tcpip.h b/include/tcpip.h new file mode 100644 index 0000000..c4b3efb --- /dev/null +++ b/include/tcpip.h @@ -0,0 +1,35 @@ +/* + * Copyright (C) 1994, Index Data I/S + * All rights reserved. + * Sebastian Hammer, Adam Dickmeiss + * + * $Log: tcpip.h,v $ + * Revision 1.1 1995-03-30 09:39:43 quinn + * Moved .h files to include directory + * + * Revision 1.3 1995/03/27 08:36:11 quinn + * Some work on nonblocking operation in xmosi.c and rfct.c. + * Added protocol parameter to cs_create() + * + * Revision 1.2 1995/03/14 10:28:43 quinn + * Adding server-side support to tcpip.c and fixing bugs in nonblocking I/O + * + * Revision 1.1 1995/02/09 15:51:52 quinn + * Works better now. + * + */ + +#ifndef TCPIP_H +#define TCPIP_H + +#include +#include +#include +#include +#include + +struct sockaddr_in *tcpip_strtoaddr(const char *str); + +COMSTACK tcpip_type(int blocking, int protocol); + +#endif diff --git a/include/xmosi.h b/include/xmosi.h new file mode 100644 index 0000000..7570a00 --- /dev/null +++ b/include/xmosi.h @@ -0,0 +1,35 @@ +/* + * Copyright (C) 1994, Index Data I/S + * All rights reserved. + * Sebastian Hammer, Adam Dickmeiss + * + * $Log: xmosi.h,v $ + * Revision 1.1 1995-03-30 09:39:43 quinn + * Moved .h files to include directory + * + * Revision 1.3 1995/03/27 08:36:16 quinn + * Some work on nonblocking operation in xmosi.c and rfct.c. + * Added protocol parameter to cs_create() + * + * Revision 1.2 1995/03/14 10:28:48 quinn + * Adding server-side support to tcpip.c and fixing bugs in nonblocking I/O + * + * Revision 1.1 1995/03/01 08:40:33 quinn + * First working version of rfct. Addressing needs work. + * + */ + +#ifndef XMOSI_H +#define XMOSI_H + +#include +#include +#include +#include +#include + +struct netbuf *mosi_strtoaddr(const char *str); + +COMSTACK mosi_type(int blocking, int protocol); + +#endif diff --git a/odr/Makefile b/odr/Makefile index 89b1a07..47f60b0 100644 --- a/odr/Makefile +++ b/odr/Makefile @@ -1,10 +1,10 @@ # Copyright (C) 1994, Index Data I/S # All rights reserved. # Sebastian Hammer, Adam Dickmeiss -# $Id: Makefile,v 1.12 1995-03-29 08:06:35 quinn Exp $ +# $Id: Makefile,v 1.13 1995-03-30 09:39:44 quinn Exp $ SHELL=/bin/sh -INCLUDE=-I../include -I. -I../util +INCLUDE=-I../include -I. LIBDIR=../../lib LIBINCLUDE=-L$(LIBDIR) CFLAGS= -g -Wall -pedantic -ansi #-DODR_DEBUG diff --git a/server/Makefile b/server/Makefile index f243ebd..cac48ff 100644 --- a/server/Makefile +++ b/server/Makefile @@ -1,11 +1,11 @@ # Copyright (C) 1994, Index Data I/S # All rights reserved. # Sebastian Hammer, Adam Dickmeiss -# $Id: Makefile,v 1.14 1995-03-27 15:02:00 quinn Exp $ +# $Id: Makefile,v 1.15 1995-03-30 09:39:44 quinn Exp $ SHELL=/bin/sh -INCLUDE=-I../include -I. -I../asn -I../odr -I../yazlib -I../../egate/include\ - -I../../xtimosi/src -I../../alex/include -I../util +INCLUDE=-I../include -I. -I../../egate/include\ + -I../../xtimosi/src -I../../alex/include LIBDIR=../../lib LIBINCLUDE=-L$(LIBDIR) #CFLAGS=-Wall -pedantic -g diff --git a/util/Makefile b/util/Makefile index 7b3dfd2..05289b7 100644 --- a/util/Makefile +++ b/util/Makefile @@ -1,10 +1,10 @@ # Copyright (C) 1994, Index Data I/S # All rights reserved. # Sebastian Hammer, Adam Dickmeiss -# $Id: Makefile,v 1.1 1995-03-27 08:35:16 quinn Exp $ +# $Id: Makefile,v 1.2 1995-03-30 09:39:45 quinn Exp $ SHELL=/bin/sh -INCLUDE=-I../include -I. -I../odr +INCLUDE=-I../include -I. LIBDIR=../../lib LIBINCLUDE=-L$(LIBDIR) #CFLAGS=-g -Wall -pedantic -ansi