* Sebastian Hammer, Adam Dickmeiss
*
* $Log: seshigh.c,v $
- * Revision 1.19 1995-04-18 08:15:34 quinn
+ * Revision 1.20 1995-04-20 15:13:00 quinn
+ * Cosmetic
+ *
+ * Revision 1.19 1995/04/18 08:15:34 quinn
* Added dynamic memory allocation on encoding (whew). Code is now somewhat
* neater. We'll make the same change for decoding one day.
*
#include <backend.h>
-#define MAXRECORDSIZE 1024*1024
+#define MAXRECORDSIZE 1024*1024*5 /* should be configurable, of course */
static int process_apdu(IOCHAN chan);
static int process_initRequest(IOCHAN client, Z_InitRequest *req);
static FILE *apduf = 0; /* for use in static mode */
+/*
+ * Create a new association-handle.
+ * channel : iochannel for the current line.
+ * link : communications channel.
+ * Returns: 0 or a new association handle.
+ */
association *create_association(IOCHAN channel, COMSTACK link)
{
association *new;
}
else
new->print = 0;
- new->state = ASSOC_UNINIT;
new->input_buffer = 0;
new->input_buffer_len = 0;
new->backend = 0;
return new;
}
+/*
+ * Free association and release resources.
+ */
void destroy_association(association *h)
{
odr_destroy(h->decode);
}
/*
- * process events on the association
+ * process events on the association. Called when the event loop detects an
+ * event.
+ * h : the I/O channel that has an outstanding event.
+ * event : the current outstanding event.
*/
void ir_session(IOCHAN h, int event)
{
}
}
+/*
+ * Process the current outstanding APDU.
+ */
static int process_apdu(IOCHAN chan)
{
Z_APDU *apdu;
ODR_MASK_SET(&protocolVersion, Z_ProtocolVersion_2);
resp.protocolVersion = &protocolVersion;
assoc->maximumRecordSize = *req->maximumRecordSize;
- /*
- * This is not so hot. The big todo for ODR is dynamic memory allocation
- * on encoding.
- */
if (assoc->maximumRecordSize > MAXRECORDSIZE)
assoc->maximumRecordSize = MAXRECORDSIZE;
assoc->preferredMessageSize = *req->preferredMessageSize;
resp.result = &result;
resp.implementationId = "YAZ";
resp.implementationName = "Index Data/YAZ Generic Frontend Server";
- resp.implementationVersion = "$Revision: 1.19 $";
+ resp.implementationVersion = "$Revision: 1.20 $";
resp.userInformationField = 0;
if (!z_APDU(assoc->encode, &apdup, 0))
{
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: session.h,v $
- * Revision 1.4 1995-04-10 10:23:39 quinn
+ * 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
#include <odr.h>
#include <oid.h>
+/*
+ * association state.
+ */
typedef struct association
{
- /* comms-related handles */
- IOCHAN client_chan;
- COMSTACK client_link;
- ODR decode;
- ODR encode;
- ODR print;
- char *encode_buffer;
- int encoded_len;
- char *input_buffer;
- int input_buffer_len;
- int input_apdu_len;
- int state;
- oid_proto proto;
- void *backend;
-#define ASSOC_UNINIT 0
-#define ASSOC_IDLE 1
+ IOCHAN client_chan; /* event-loop control */
+ COMSTACK client_link; /* communication handle */
+ ODR decode; /* decoding stream */
+ ODR encode; /* encoding stream */
+ ODR print; /* printing stream (for -a) */
+ char *encode_buffer; /* temporary holding of encoded data */
+ int encoded_len; /* length of encoded data */
+ char *input_buffer; /* input buffer (allocated by comstack) */
+ int input_buffer_len; /* length (size) of buffer */
+ int input_apdu_len; /* length of current incoming APDU */
+ oid_proto proto; /* protocol (PROTO_Z3950/PROTO_SR) */
+ void *backend; /* backend handle */
- /* session parameters */
- int preferredMessageSize;
+ int preferredMessageSize; /* session parameters */
int maximumRecordSize;
} association;