2 * IR toolkit for tcl/tk
4 * See the file LICENSE for details.
5 * Sebastian Hammer, Adam Dickmeiss
8 * Revision 1.25 1996-02-05 17:58:04 adam
9 * Ported ir-tcl to use the beta releases of tcl7.5/tk4.1.
11 * Revision 1.24 1996/01/29 11:35:27 adam
12 * Bug fix: cs_type member renamed to comstackType to avoid conflict with
13 * cs_type macro defined by YAZ.
15 * Revision 1.23 1996/01/19 16:22:40 adam
16 * New method: apduDump - returns information about last incoming APDU.
18 * Revision 1.22 1996/01/10 09:18:44 adam
19 * PDU specific callbacks implemented: initRespnse, searchResponse,
20 * presentResponse and scanResponse.
21 * Bug fix in the command line shell (tclmain.c) - discovered on OSF/1.
23 * Revision 1.21 1996/01/04 16:12:14 adam
24 * Setting PDUType renamed to eventType.
26 * Revision 1.20 1996/01/04 11:05:23 adam
27 * New setting: PDUType - returns type of last PDU returned from the target.
28 * Fixed a bug in configure/Makefile.
30 * Revision 1.19 1995/11/13 09:55:46 adam
31 * Multiple records at a position in a result-set with differnt
34 * Revision 1.18 1995/10/18 16:42:44 adam
35 * New settings: smallSetElementSetNames and mediumSetElementSetNames.
37 * Revision 1.17 1995/10/16 17:00:56 adam
38 * New setting: elementSetNames.
39 * Various client improvements. Medium presentation format looks better.
41 * Revision 1.16 1995/09/20 11:37:01 adam
42 * Configure searches for tk4.1 and tk7.5.
45 * Revision 1.15 1995/08/29 15:30:15 adam
46 * Work on GRS records.
48 * Revision 1.14 1995/08/04 11:32:40 adam
49 * More work on output queue. Memory related routines moved
52 * Revision 1.13 1995/08/03 13:23:00 adam
55 * Revision 1.12 1995/07/28 10:28:38 adam
56 * First work on request queue.
58 * Revision 1.11 1995/06/20 08:07:35 adam
59 * New setting: failInfo.
60 * Working on better cancel mechanism.
62 * Revision 1.10 1995/06/16 12:28:20 adam
63 * Implemented preferredRecordSyntax.
64 * Minor changes in diagnostic handling.
65 * Record list deleted when connection closes.
67 * Revision 1.9 1995/06/14 15:08:01 adam
68 * Bug fix in cascade-target-list. Uses yaz-version.h.
70 * Revision 1.8 1995/06/14 13:37:18 adam
71 * Setting recordType implemented.
72 * Setting implementationVersion implemented.
73 * Settings implementationId / implementationName edited.
75 * Revision 1.7 1995/06/01 07:31:28 adam
76 * Rename of many typedefs -> IrTcl_...
78 * Revision 1.6 1995/05/31 08:36:40 adam
79 * Bug fix in client.tcl: didn't save options on clientrc.tcl.
80 * New method: referenceId. More work on scan.
82 * Revision 1.5 1995/05/29 08:44:25 adam
83 * Work on delete of objects.
85 * Revision 1.4 1995/05/26 11:44:10 adam
86 * Bugs fixed. More work on MARC utilities and queries. Test
87 * client is up-to-date again.
89 * Revision 1.3 1995/05/26 08:54:17 adam
90 * New MARC utilities. Uses prefix query.
92 * Revision 1.2 1995/05/24 14:10:23 adam
93 * Work on idAuthentication, protocolVersion and options.
95 * Revision 1.1 1995/05/23 15:34:49 adam
96 * Many new settings, userInformationField, smallSetUpperBound, etc.
97 * A number of settings are inherited when ir-set is executed.
98 * This version is incompatible with the graphical test client (client.tcl).
113 #include <comstack.h>
120 #include <yaz-version.h>
124 #include <diagbib1.h>
129 char **databaseNames;
130 int num_databaseNames;
132 enum oid_value *preferredRecordSyntax;
133 int replaceIndicator;
136 char *elementSetNames;
137 char *smallSetElementSetNames;
138 char *mediumSetElementSetNames;
140 int smallSetUpperBound;
141 int largeSetLowerBound;
142 int mediumSetPresentNumber;
152 #if IRTCL_GENERIC_FILES
158 int preferredMessageSize;
159 int maximumRecordSize;
161 Odr_bitmask protocolVersion;
163 char *idAuthenticationOpen;
164 char *idAuthenticationGroupId;
165 char *idAuthenticationUserId;
166 char *idAuthenticationPassword;
168 char *implementationName;
169 char *implementationId;
170 char *implementationVersion;
172 char *targetImplementationName;
173 char *targetImplementationId;
174 char *targetImplementationVersion;
175 char *userInformationField;
197 struct IrTcl_Request_ *request_queue;
199 IrTcl_SetCObj set_inher;
202 typedef struct IrTcl_Request_ {
203 struct IrTcl_Request_ *next;
218 struct GRS_Record_entry {
227 struct IrTcl_GRS_Record_ *sub;
238 typedef struct IrTcl_GRS_Record_ {
240 struct GRS_Record_entry *entries;
243 typedef struct IrTcl_RecordList_ {
252 IrTcl_GRS_Record *grs1;
258 IrTcl_Diagnostic *list;
259 } surrogateDiagnostics;
261 struct IrTcl_RecordList_ *next;
264 typedef struct IrTcl_SetObj_ {
269 int nextResultSetPosition;
272 int numberOfRecordsReturned;
274 char *recordElements;
277 int nonSurrogateDiagnosticNum;
278 char *searchResponse;
279 char *presentResponse;
280 IrTcl_Diagnostic *nonSurrogateDiagnosticList;
281 IrTcl_RecordList *record_list;
282 IrTcl_SetCObj set_inher;
285 typedef struct IrTcl_ScanEntry_ {
290 int globalOccurrences;
293 IrTcl_Diagnostic *list;
299 typedef struct IrTcl_ScanObj_ {
302 int numberOfTermsRequested;
303 int preferredPositionInResponse;
306 int numberOfEntriesReturned;
316 IrTcl_ScanEntry *entries;
317 IrTcl_Diagnostic *nonSurrogateDiagnosticList;
318 int nonSurrogateDiagnosticNum;
321 struct ir_named_entry {
326 int ir_tcl_get_marc (Tcl_Interp *interp, const char *buf,
327 int argc, char **argv);
328 int ir_tcl_send_APDU (Tcl_Interp *interp, IrTcl_Obj *p, Z_APDU *apdu,
329 const char *msg, const char *object_name);
330 int ir_tcl_send_q (IrTcl_Obj *p, IrTcl_Request *rq, const char *msg);
331 void ir_tcl_del_q (IrTcl_Obj *p);
332 void *ir_tcl_malloc (size_t size);
333 int ir_tcl_strdup (Tcl_Interp *interp, char** p, const char *s);
334 int ir_tcl_strdel (Tcl_Interp *interp, char **p);
336 char *ir_tcl_fread_marc (FILE *inf, size_t *size);
337 void ir_tcl_read_grs (Z_GenericRecord *r, IrTcl_GRS_Record **grs_record);
338 int ir_tcl_get_grs (Tcl_Interp *interp, IrTcl_GRS_Record *grs_record,
339 int argc, char **argv);
341 #define IR_TCL_FAIL_CONNECT 1
342 #define IR_TCL_FAIL_READ 2
343 #define IR_TCL_FAIL_WRITE 3
344 #define IR_TCL_FAIL_IN_APDU 4
345 #define IR_TCL_FAIL_UNKNOWN_APDU 5
347 #define IR_TCL_R_Idle 0
348 #define IR_TCL_R_Writing 1
349 #define IR_TCL_R_Waiting 2
350 #define IR_TCL_R_Reading 3
351 #define IR_TCL_R_Connecting 4