2 * IR toolkit for tcl/tk
4 * See the file LICENSE for details.
5 * Sebastian Hammer, Adam Dickmeiss
8 * Revision 1.24 1996-01-29 11:35:27 adam
9 * Bug fix: cs_type member renamed to comstackType to avoid conflict with
10 * cs_type macro defined by YAZ.
12 * Revision 1.23 1996/01/19 16:22:40 adam
13 * New method: apduDump - returns information about last incoming APDU.
15 * Revision 1.22 1996/01/10 09:18:44 adam
16 * PDU specific callbacks implemented: initRespnse, searchResponse,
17 * presentResponse and scanResponse.
18 * Bug fix in the command line shell (tclmain.c) - discovered on OSF/1.
20 * Revision 1.21 1996/01/04 16:12:14 adam
21 * Setting PDUType renamed to eventType.
23 * Revision 1.20 1996/01/04 11:05:23 adam
24 * New setting: PDUType - returns type of last PDU returned from the target.
25 * Fixed a bug in configure/Makefile.
27 * Revision 1.19 1995/11/13 09:55:46 adam
28 * Multiple records at a position in a result-set with differnt
31 * Revision 1.18 1995/10/18 16:42:44 adam
32 * New settings: smallSetElementSetNames and mediumSetElementSetNames.
34 * Revision 1.17 1995/10/16 17:00:56 adam
35 * New setting: elementSetNames.
36 * Various client improvements. Medium presentation format looks better.
38 * Revision 1.16 1995/09/20 11:37:01 adam
39 * Configure searches for tk4.1 and tk7.5.
42 * Revision 1.15 1995/08/29 15:30:15 adam
43 * Work on GRS records.
45 * Revision 1.14 1995/08/04 11:32:40 adam
46 * More work on output queue. Memory related routines moved
49 * Revision 1.13 1995/08/03 13:23:00 adam
52 * Revision 1.12 1995/07/28 10:28:38 adam
53 * First work on request queue.
55 * Revision 1.11 1995/06/20 08:07:35 adam
56 * New setting: failInfo.
57 * Working on better cancel mechanism.
59 * Revision 1.10 1995/06/16 12:28:20 adam
60 * Implemented preferredRecordSyntax.
61 * Minor changes in diagnostic handling.
62 * Record list deleted when connection closes.
64 * Revision 1.9 1995/06/14 15:08:01 adam
65 * Bug fix in cascade-target-list. Uses yaz-version.h.
67 * Revision 1.8 1995/06/14 13:37:18 adam
68 * Setting recordType implemented.
69 * Setting implementationVersion implemented.
70 * Settings implementationId / implementationName edited.
72 * Revision 1.7 1995/06/01 07:31:28 adam
73 * Rename of many typedefs -> IrTcl_...
75 * Revision 1.6 1995/05/31 08:36:40 adam
76 * Bug fix in client.tcl: didn't save options on clientrc.tcl.
77 * New method: referenceId. More work on scan.
79 * Revision 1.5 1995/05/29 08:44:25 adam
80 * Work on delete of objects.
82 * Revision 1.4 1995/05/26 11:44:10 adam
83 * Bugs fixed. More work on MARC utilities and queries. Test
84 * client is up-to-date again.
86 * Revision 1.3 1995/05/26 08:54:17 adam
87 * New MARC utilities. Uses prefix query.
89 * Revision 1.2 1995/05/24 14:10:23 adam
90 * Work on idAuthentication, protocolVersion and options.
92 * Revision 1.1 1995/05/23 15:34:49 adam
93 * Many new settings, userInformationField, smallSetUpperBound, etc.
94 * A number of settings are inherited when ir-set is executed.
95 * This version is incompatible with the graphical test client (client.tcl).
110 #include <comstack.h>
117 #include <yaz-version.h>
121 #include <diagbib1.h>
126 char **databaseNames;
127 int num_databaseNames;
129 enum oid_value *preferredRecordSyntax;
130 int replaceIndicator;
133 char *elementSetNames;
134 char *smallSetElementSetNames;
135 char *mediumSetElementSetNames;
137 int smallSetUpperBound;
138 int largeSetLowerBound;
139 int mediumSetPresentNumber;
152 int preferredMessageSize;
153 int maximumRecordSize;
155 Odr_bitmask protocolVersion;
157 char *idAuthenticationOpen;
158 char *idAuthenticationGroupId;
159 char *idAuthenticationUserId;
160 char *idAuthenticationPassword;
162 char *implementationName;
163 char *implementationId;
164 char *implementationVersion;
166 char *targetImplementationName;
167 char *targetImplementationId;
168 char *targetImplementationVersion;
169 char *userInformationField;
191 struct IrTcl_Request_ *request_queue;
193 IrTcl_SetCObj set_inher;
196 typedef struct IrTcl_Request_ {
197 struct IrTcl_Request_ *next;
212 struct GRS_Record_entry {
221 struct IrTcl_GRS_Record_ *sub;
232 typedef struct IrTcl_GRS_Record_ {
234 struct GRS_Record_entry *entries;
237 typedef struct IrTcl_RecordList_ {
246 IrTcl_GRS_Record *grs1;
252 IrTcl_Diagnostic *list;
253 } surrogateDiagnostics;
255 struct IrTcl_RecordList_ *next;
258 typedef struct IrTcl_SetObj_ {
263 int nextResultSetPosition;
266 int numberOfRecordsReturned;
268 char *recordElements;
271 int nonSurrogateDiagnosticNum;
272 char *searchResponse;
273 char *presentResponse;
274 IrTcl_Diagnostic *nonSurrogateDiagnosticList;
275 IrTcl_RecordList *record_list;
276 IrTcl_SetCObj set_inher;
279 typedef struct IrTcl_ScanEntry_ {
284 int globalOccurrences;
287 IrTcl_Diagnostic *list;
293 typedef struct IrTcl_ScanObj_ {
296 int numberOfTermsRequested;
297 int preferredPositionInResponse;
300 int numberOfEntriesReturned;
310 IrTcl_ScanEntry *entries;
311 IrTcl_Diagnostic *nonSurrogateDiagnosticList;
312 int nonSurrogateDiagnosticNum;
315 struct ir_named_entry {
320 int ir_tcl_get_marc (Tcl_Interp *interp, const char *buf,
321 int argc, char **argv);
322 int ir_tcl_send_APDU (Tcl_Interp *interp, IrTcl_Obj *p, Z_APDU *apdu,
323 const char *msg, const char *object_name);
324 int ir_tcl_send_q (IrTcl_Obj *p, IrTcl_Request *rq, const char *msg);
325 void ir_tcl_del_q (IrTcl_Obj *p);
326 void *ir_tcl_malloc (size_t size);
327 int ir_tcl_strdup (Tcl_Interp *interp, char** p, const char *s);
328 int ir_tcl_strdel (Tcl_Interp *interp, char **p);
330 char *ir_tcl_fread_marc (FILE *inf, size_t *size);
331 void ir_tcl_read_grs (Z_GenericRecord *r, IrTcl_GRS_Record **grs_record);
332 int ir_tcl_get_grs (Tcl_Interp *interp, IrTcl_GRS_Record *grs_record,
333 int argc, char **argv);
335 #define IR_TCL_FAIL_CONNECT 1
336 #define IR_TCL_FAIL_READ 2
337 #define IR_TCL_FAIL_WRITE 3
338 #define IR_TCL_FAIL_IN_APDU 4
339 #define IR_TCL_FAIL_UNKNOWN_APDU 5
341 #define IR_TCL_R_Idle 0
342 #define IR_TCL_R_Writing 1
343 #define IR_TCL_R_Waiting 2
344 #define IR_TCL_R_Reading 3
345 #define IR_TCL_R_Connecting 4