2 * Copyright (C) 1995-2005, Index Data ApS
3 * See the file LICENSE for details.
5 * $Id: session.h,v 1.10 2006-03-15 13:32:05 adam Exp $
9 * \brief Internal Header for GFS.
14 #include <yaz/comstack.h>
18 #include <yaz/proto.h>
19 #include <yaz/backend.h>
23 statserv_options_block cb;
26 cql_transform_t cql_transform;
27 void *server_node_ptr;
31 struct gfs_server *next;
37 struct gfs_listen *next;
41 REQUEST_IDLE, /* the request is just sitting in the queue */
42 REQUEST_PENDING /* operation pending (b'end processing or network I/O*/
43 /* this list will have more elements when acc/res control is added */
46 typedef struct request
48 int len_refid; /* length of referenceid */
49 char *refid; /* referenceid */
52 Z_GDU *gdu_request; /* Current request */
53 Z_APDU *apdu_request; /* Current Z39.50 request */
54 NMEM request_mem; /* memory handle for request */
56 int size_response; /* size of buffer */
57 int len_response; /* length of encoded data */
58 char *response; /* encoded data waiting for transmission */
65 typedef struct request_q
78 ASSOC_NEW, /* not initialized yet */
79 ASSOC_UP, /* normal operation */
80 ASSOC_DEAD /* dead. Close if input arrives */
83 typedef struct association
85 IOCHAN client_chan; /* event-loop control */
86 COMSTACK client_link; /* communication handle */
87 ODR decode; /* decoding stream */
88 ODR encode; /* encoding stream */
89 ODR print; /* printing stream (for -a) */
90 char *encode_buffer; /* temporary buffer for encoded data */
91 int encoded_len; /* length of encoded data */
92 char *input_buffer; /* input buffer (allocated by comstack) */
93 int input_buffer_len; /* length (size) of buffer */
94 int input_apdu_len; /* length of current incoming APDU */
95 oid_proto proto; /* protocol (PROTO_Z3950/PROTO_SR) */
96 void *backend; /* backend handle */
97 request_q incoming; /* Q of incoming PDUs */
98 request_q outgoing; /* Q of outgoing data buffers (enc. PDUs) */
99 association_state state;
101 /* session parameters */
102 int preferredMessageSize;
103 int maximumRecordSize;
104 int version; /* highest version-bit set (2 or 3) */
106 unsigned cs_get_mask;
107 unsigned cs_put_mask;
108 unsigned cs_accept_mask;
110 struct bend_initrequest *init;
111 statserv_options_block *last_control;
112 cql_transform_t cql_transform;
113 void *server_node_ptr;
115 const char *stylesheet;
118 association *create_association(IOCHAN channel, COMSTACK link,
119 const char *apdufile);
120 void destroy_association(association *h);
121 void ir_session(IOCHAN h, int event);
123 void request_enq(request_q *q, request *r);
124 request *request_head(request_q *q);
125 request *request_deq(request_q *q);
126 request *request_deq_x(request_q *q, request *r);
127 void request_initq(request_q *q);
128 void request_delq(request_q *q);
129 request *request_get(request_q *q);
130 void request_release(request *r);
132 int statserv_must_terminate(void);
134 int control_association(association *assoc, const char *host, int force);
140 * indent-tabs-mode: nil
142 * vim: shiftwidth=4 tabstop=8 expandtab