2 * Copyright (C) 1995-2005, Index Data ApS
3 * See the file LICENSE for details.
5 * $Id: session.h,v 1.9 2005-06-25 15:46: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;
29 struct gfs_server *next;
35 struct gfs_listen *next;
39 REQUEST_IDLE, /* the request is just sitting in the queue */
40 REQUEST_PENDING /* operation pending (b'end processing or network I/O*/
41 /* this list will have more elements when acc/res control is added */
44 typedef struct request
46 int len_refid; /* length of referenceid */
47 char *refid; /* referenceid */
50 Z_GDU *gdu_request; /* Current request */
51 Z_APDU *apdu_request; /* Current Z39.50 request */
52 NMEM request_mem; /* memory handle for request */
54 int size_response; /* size of buffer */
55 int len_response; /* length of encoded data */
56 char *response; /* encoded data waiting for transmission */
63 typedef struct request_q
76 ASSOC_NEW, /* not initialized yet */
77 ASSOC_UP, /* normal operation */
78 ASSOC_DEAD /* dead. Close if input arrives */
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) */
97 association_state state;
99 /* session parameters */
100 int preferredMessageSize;
101 int maximumRecordSize;
102 int version; /* highest version-bit set (2 or 3) */
104 unsigned cs_get_mask;
105 unsigned cs_put_mask;
106 unsigned cs_accept_mask;
108 struct bend_initrequest *init;
109 statserv_options_block *last_control;
110 cql_transform_t cql_transform;
111 void *server_node_ptr;
114 association *create_association(IOCHAN channel, COMSTACK link,
115 const char *apdufile);
116 void destroy_association(association *h);
117 void ir_session(IOCHAN h, int event);
119 void request_enq(request_q *q, request *r);
120 request *request_head(request_q *q);
121 request *request_deq(request_q *q);
122 request *request_deq_x(request_q *q, request *r);
123 void request_initq(request_q *q);
124 void request_delq(request_q *q);
125 request *request_get(request_q *q);
126 void request_release(request *r);
128 int statserv_must_terminate(void);
130 int control_association(association *assoc, const char *host, int force);
136 * indent-tabs-mode: nil
138 * vim: shiftwidth=4 tabstop=8 expandtab