2 * IR toolkit for tcl/tk
4 * See the file LICENSE for details.
5 * Sebastian Hammer, Adam Dickmeiss
8 * Revision 1.26 1996-02-21 10:16:20 adam
9 * Simplified select handling. Only one function ir_tcl_select_set has
10 * to be externally defined.
12 * Revision 1.25 1996/02/05 17:58:04 adam
13 * Ported ir-tcl to use the beta releases of tcl7.5/tk4.1.
15 * Revision 1.24 1996/01/29 11:35:27 adam
16 * Bug fix: cs_type member renamed to comstackType to avoid conflict with
17 * cs_type macro defined by YAZ.
19 * Revision 1.23 1996/01/19 16:22:40 adam
20 * New method: apduDump - returns information about last incoming APDU.
22 * Revision 1.22 1996/01/10 09:18:44 adam
23 * PDU specific callbacks implemented: initRespnse, searchResponse,
24 * presentResponse and scanResponse.
25 * Bug fix in the command line shell (tclmain.c) - discovered on OSF/1.
27 * Revision 1.21 1996/01/04 16:12:14 adam
28 * Setting PDUType renamed to eventType.
30 * Revision 1.20 1996/01/04 11:05:23 adam
31 * New setting: PDUType - returns type of last PDU returned from the target.
32 * Fixed a bug in configure/Makefile.
34 * Revision 1.19 1995/11/13 09:55:46 adam
35 * Multiple records at a position in a result-set with differnt
38 * Revision 1.18 1995/10/18 16:42:44 adam
39 * New settings: smallSetElementSetNames and mediumSetElementSetNames.
41 * Revision 1.17 1995/10/16 17:00:56 adam
42 * New setting: elementSetNames.
43 * Various client improvements. Medium presentation format looks better.
45 * Revision 1.16 1995/09/20 11:37:01 adam
46 * Configure searches for tk4.1 and tk7.5.
49 * Revision 1.15 1995/08/29 15:30:15 adam
50 * Work on GRS records.
52 * Revision 1.14 1995/08/04 11:32:40 adam
53 * More work on output queue. Memory related routines moved
56 * Revision 1.13 1995/08/03 13:23:00 adam
59 * Revision 1.12 1995/07/28 10:28:38 adam
60 * First work on request queue.
62 * Revision 1.11 1995/06/20 08:07:35 adam
63 * New setting: failInfo.
64 * Working on better cancel mechanism.
66 * Revision 1.10 1995/06/16 12:28:20 adam
67 * Implemented preferredRecordSyntax.
68 * Minor changes in diagnostic handling.
69 * Record list deleted when connection closes.
71 * Revision 1.9 1995/06/14 15:08:01 adam
72 * Bug fix in cascade-target-list. Uses yaz-version.h.
74 * Revision 1.8 1995/06/14 13:37:18 adam
75 * Setting recordType implemented.
76 * Setting implementationVersion implemented.
77 * Settings implementationId / implementationName edited.
79 * Revision 1.7 1995/06/01 07:31:28 adam
80 * Rename of many typedefs -> IrTcl_...
82 * Revision 1.6 1995/05/31 08:36:40 adam
83 * Bug fix in client.tcl: didn't save options on clientrc.tcl.
84 * New method: referenceId. More work on scan.
86 * Revision 1.5 1995/05/29 08:44:25 adam
87 * Work on delete of objects.
89 * Revision 1.4 1995/05/26 11:44:10 adam
90 * Bugs fixed. More work on MARC utilities and queries. Test
91 * client is up-to-date again.
93 * Revision 1.3 1995/05/26 08:54:17 adam
94 * New MARC utilities. Uses prefix query.
96 * Revision 1.2 1995/05/24 14:10:23 adam
97 * Work on idAuthentication, protocolVersion and options.
99 * Revision 1.1 1995/05/23 15:34:49 adam
100 * Many new settings, userInformationField, smallSetUpperBound, etc.
101 * A number of settings are inherited when ir-set is executed.
102 * This version is incompatible with the graphical test client (client.tcl).
117 #include <comstack.h>
124 #include <yaz-version.h>
128 #include <diagbib1.h>
133 char **databaseNames;
134 int num_databaseNames;
136 enum oid_value *preferredRecordSyntax;
137 int replaceIndicator;
140 char *elementSetNames;
141 char *smallSetElementSetNames;
142 char *mediumSetElementSetNames;
144 int smallSetUpperBound;
145 int largeSetLowerBound;
146 int mediumSetPresentNumber;
156 #if IRTCL_GENERIC_FILES
162 int preferredMessageSize;
163 int maximumRecordSize;
165 Odr_bitmask protocolVersion;
167 char *idAuthenticationOpen;
168 char *idAuthenticationGroupId;
169 char *idAuthenticationUserId;
170 char *idAuthenticationPassword;
172 char *implementationName;
173 char *implementationId;
174 char *implementationVersion;
176 char *targetImplementationName;
177 char *targetImplementationId;
178 char *targetImplementationVersion;
179 char *userInformationField;
201 struct IrTcl_Request_ *request_queue;
203 IrTcl_SetCObj set_inher;
206 typedef struct IrTcl_Request_ {
207 struct IrTcl_Request_ *next;
222 struct GRS_Record_entry {
231 struct IrTcl_GRS_Record_ *sub;
242 typedef struct IrTcl_GRS_Record_ {
244 struct GRS_Record_entry *entries;
247 typedef struct IrTcl_RecordList_ {
256 IrTcl_GRS_Record *grs1;
262 IrTcl_Diagnostic *list;
263 } surrogateDiagnostics;
265 struct IrTcl_RecordList_ *next;
268 typedef struct IrTcl_SetObj_ {
273 int nextResultSetPosition;
276 int numberOfRecordsReturned;
278 char *recordElements;
281 int nonSurrogateDiagnosticNum;
282 char *searchResponse;
283 char *presentResponse;
284 IrTcl_Diagnostic *nonSurrogateDiagnosticList;
285 IrTcl_RecordList *record_list;
286 IrTcl_SetCObj set_inher;
289 typedef struct IrTcl_ScanEntry_ {
294 int globalOccurrences;
297 IrTcl_Diagnostic *list;
303 typedef struct IrTcl_ScanObj_ {
306 int numberOfTermsRequested;
307 int preferredPositionInResponse;
310 int numberOfEntriesReturned;
320 IrTcl_ScanEntry *entries;
321 IrTcl_Diagnostic *nonSurrogateDiagnosticList;
322 int nonSurrogateDiagnosticNum;
325 struct ir_named_entry {
330 int ir_tcl_get_marc (Tcl_Interp *interp, const char *buf,
331 int argc, char **argv);
332 int ir_tcl_send_APDU (Tcl_Interp *interp, IrTcl_Obj *p, Z_APDU *apdu,
333 const char *msg, const char *object_name);
334 int ir_tcl_send_q (IrTcl_Obj *p, IrTcl_Request *rq, const char *msg);
335 void ir_tcl_del_q (IrTcl_Obj *p);
336 int ir_tcl_strdup (Tcl_Interp *interp, char** p, const char *s);
337 int ir_tcl_strdel (Tcl_Interp *interp, char **p);
339 char *ir_tcl_fread_marc (FILE *inf, size_t *size);
340 void ir_tcl_read_grs (Z_GenericRecord *r, IrTcl_GRS_Record **grs_record);
341 int ir_tcl_get_grs (Tcl_Interp *interp, IrTcl_GRS_Record *grs_record,
342 int argc, char **argv);
344 void ir_select_add (int fd, void *obj);
345 void ir_select_add_write (int fd, void *obj);
346 void ir_select_remove (int fd, void *obj);
347 void ir_selcet_remove_write (int fd, void *obj);
349 #define IR_TCL_FAIL_CONNECT 1
350 #define IR_TCL_FAIL_READ 2
351 #define IR_TCL_FAIL_WRITE 3
352 #define IR_TCL_FAIL_IN_APDU 4
353 #define IR_TCL_FAIL_UNKNOWN_APDU 5
355 #define IR_TCL_R_Idle 0
356 #define IR_TCL_R_Writing 1
357 #define IR_TCL_R_Waiting 2
358 #define IR_TCL_R_Reading 3
359 #define IR_TCL_R_Connecting 4