2 * Copyright (C) 1995, Index Data I/S
3 * See the file LICENSE for details.
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.10 1995-08-29 11:18:01 quinn
8 * Added code to receive close
10 * Revision 1.9 1995/06/16 10:31:38 quinn
11 * Added session timeout.
13 * Revision 1.8 1995/05/17 08:42:28 quinn
14 * Transfer auth info to backend. Allow backend to reject init gracefully.
16 * Revision 1.7 1995/05/16 08:51:08 quinn
17 * License, documentation, and memory fixes
19 * Revision 1.6 1995/05/15 11:56:41 quinn
20 * Asynchronous facilities. Restructuring of seshigh code.
22 * Revision 1.5 1995/04/20 15:13:01 quinn
25 * Revision 1.4 1995/04/10 10:23:39 quinn
26 * Some work to add scan and other things.
28 * Revision 1.3 1995/03/30 09:09:27 quinn
29 * Added state-handle and some support for asynchronous activities.
31 * Revision 1.2 1995/03/27 08:34:29 quinn
32 * Added dynamic server functionality.
33 * Released bindings to session.c (is now redundant)
35 * Revision 1.1 1995/03/14 10:28:02 quinn
36 * More work on demo server.
48 #include <sys/types.h>
51 typedef struct request
53 int len_refid; /* length of referenceid */
54 char *refid; /* referenceid */
56 REQUEST_IDLE, /* the request is just sitting in the queue */
57 REQUEST_PENDING /* operation pending (b'end processing or network I/O*/
58 /* this list will have more elements when acc/res control is added */
61 Z_APDU *request; /* Current request */
62 ODR_MEM request_mem; /* ODR memory handle for request */
64 int size_response; /* size of buffer */
65 int len_response; /* length of encoded data */
66 char *response; /* encoded data waiting for transmission */
71 typedef struct request_q
81 typedef struct association
83 IOCHAN client_chan; /* event-loop control */
84 COMSTACK client_link; /* communication handle */
85 ODR decode; /* decoding stream */
86 ODR encode; /* encoding stream */
87 ODR print; /* printing stream (for -a) */
88 char *encode_buffer; /* temporary buffer for encoded data */
89 int encoded_len; /* length of encoded data */
90 char *input_buffer; /* input buffer (allocated by comstack) */
91 int input_buffer_len; /* length (size) of buffer */
92 int input_apdu_len; /* length of current incoming APDU */
93 oid_proto proto; /* protocol (PROTO_Z3950/PROTO_SR) */
94 void *backend; /* backend handle */
95 request_q incoming; /* Q of incoming PDUs */
96 request_q outgoing; /* Q of outgoing data buffers (enc. PDUs) */
99 ASSOC_NEW, /* not initialized yet */
100 ASSOC_UP, /* normal operation */
101 ASSOC_DEAD /* dead. Close if input arrives */
104 /* session parameters */
105 int preferredMessageSize;
106 int maximumRecordSize;
107 int version; /* highest version-bit set (2 or 3) */
110 association *create_association(IOCHAN channel, COMSTACK link);
111 void destroy_association(association *h);
112 void ir_session(IOCHAN h, int event);
114 void request_enq(request_q *q, request *r);
115 request *request_head(request_q *q);
116 request *request_deq(request_q *q);
117 void request_initq(request_q *q);
118 request *request_get(void);
119 void request_release(request *r);