/*
- * Copyright (C) 1995, Index Data I/S
+ * Copyright (C) 1995-2003, Index Data
* See the file LICENSE for details.
* Sebastian Hammer, Adam Dickmeiss
*
- * $Log: session.h,v $
- * Revision 1.9 1995-06-16 10:31:38 quinn
- * Added session timeout.
- *
- * Revision 1.8 1995/05/17 08:42:28 quinn
- * Transfer auth info to backend. Allow backend to reject init gracefully.
- *
- * Revision 1.7 1995/05/16 08:51:08 quinn
- * License, documentation, and memory fixes
- *
- * Revision 1.6 1995/05/15 11:56:41 quinn
- * Asynchronous facilities. Restructuring of seshigh code.
- *
- * Revision 1.5 1995/04/20 15:13:01 quinn
- * Cosmetic
- *
- * Revision 1.4 1995/04/10 10:23:39 quinn
- * Some work to add scan and other things.
- *
- * Revision 1.3 1995/03/30 09:09:27 quinn
- * Added state-handle and some support for asynchronous activities.
- *
- * Revision 1.2 1995/03/27 08:34:29 quinn
- * Added dynamic server functionality.
- * Released bindings to session.c (is now redundant)
- *
- * Revision 1.1 1995/03/14 10:28:02 quinn
- * More work on demo server.
- *
- *
+ * $Id: session.h,v 1.29 2003-02-17 21:23:31 adam Exp $
*/
#ifndef SESSION_H
#define SESSION_H
-#include <comstack.h>
-#include <odr.h>
-#include <oid.h>
-#include <proto.h>
#include <sys/types.h>
-#include <eventl.h>
+#include <yaz/comstack.h>
+#include <yaz/odr.h>
+#include <yaz/oid.h>
+#include <yaz/proto.h>
+#include "eventl.h"
+
+typedef enum {
+ REQUEST_IDLE, /* the request is just sitting in the queue */
+ REQUEST_PENDING /* operation pending (b'end processing or network I/O*/
+ /* this list will have more elements when acc/res control is added */
+} request_state;
typedef struct request
{
int len_refid; /* length of referenceid */
char *refid; /* referenceid */
- enum {
- REQUEST_IDLE, /* the request is just sitting in the queue */
- REQUEST_PENDING /* operation pending (b'end processing or network I/O*/
- /* this list will have more elements when acc/res control is added */
- } state;
+ request_state state;
- Z_APDU *request; /* Current request */
- ODR_MEM request_mem; /* ODR memory handle for request */
+ Z_GDU *gdu_request; /* Current request */
+ Z_APDU *apdu_request; /* Current Z39.50 request */
+ NMEM request_mem; /* memory handle for request */
int size_response; /* size of buffer */
int len_response; /* length of encoded data */
char *response; /* encoded data waiting for transmission */
+ void *clientData;
struct request *next;
+ struct request_q *q;
} request;
typedef struct request_q
{
request *head;
request *tail;
+ request *list;
int num;
} request_q;
/*
* association state.
*/
+typedef enum
+{
+ ASSOC_NEW, /* not initialized yet */
+ ASSOC_UP, /* normal operation */
+ ASSOC_DEAD /* dead. Close if input arrives */
+} association_state;
+
typedef struct association
{
IOCHAN client_chan; /* event-loop control */
void *backend; /* backend handle */
request_q incoming; /* Q of incoming PDUs */
request_q outgoing; /* Q of outgoing data buffers (enc. PDUs) */
- int rejected; /* session rejected */
+ association_state state;
/* session parameters */
int preferredMessageSize;
int maximumRecordSize;
+ int version; /* highest version-bit set (2 or 3) */
+
+ unsigned cs_get_mask;
+ unsigned cs_put_mask;
+ unsigned cs_accept_mask;
+
+ struct bend_initrequest *init;
} association;
association *create_association(IOCHAN channel, COMSTACK link);
void request_enq(request_q *q, request *r);
request *request_head(request_q *q);
request *request_deq(request_q *q);
+request *request_deq_x(request_q *q, request *r);
void request_initq(request_q *q);
-request *request_get(void);
+void request_delq(request_q *q);
+request *request_get(request_q *q);
void request_release(request *r);
+int statserv_must_terminate(void);
+
#endif