2 * IR toolkit for tcl/tk
4 * See the file LICENSE for details.
5 * Sebastian Hammer, Adam Dickmeiss
8 * Revision 1.23 1996-01-19 16:22:40 adam
9 * New method: apduDump - returns information about last incoming APDU.
11 * Revision 1.22 1996/01/10 09:18:44 adam
12 * PDU specific callbacks implemented: initRespnse, searchResponse,
13 * presentResponse and scanResponse.
14 * Bug fix in the command line shell (tclmain.c) - discovered on OSF/1.
16 * Revision 1.21 1996/01/04 16:12:14 adam
17 * Setting PDUType renamed to eventType.
19 * Revision 1.20 1996/01/04 11:05:23 adam
20 * New setting: PDUType - returns type of last PDU returned from the target.
21 * Fixed a bug in configure/Makefile.
23 * Revision 1.19 1995/11/13 09:55:46 adam
24 * Multiple records at a position in a result-set with differnt
27 * Revision 1.18 1995/10/18 16:42:44 adam
28 * New settings: smallSetElementSetNames and mediumSetElementSetNames.
30 * Revision 1.17 1995/10/16 17:00:56 adam
31 * New setting: elementSetNames.
32 * Various client improvements. Medium presentation format looks better.
34 * Revision 1.16 1995/09/20 11:37:01 adam
35 * Configure searches for tk4.1 and tk7.5.
38 * Revision 1.15 1995/08/29 15:30:15 adam
39 * Work on GRS records.
41 * Revision 1.14 1995/08/04 11:32:40 adam
42 * More work on output queue. Memory related routines moved
45 * Revision 1.13 1995/08/03 13:23:00 adam
48 * Revision 1.12 1995/07/28 10:28:38 adam
49 * First work on request queue.
51 * Revision 1.11 1995/06/20 08:07:35 adam
52 * New setting: failInfo.
53 * Working on better cancel mechanism.
55 * Revision 1.10 1995/06/16 12:28:20 adam
56 * Implemented preferredRecordSyntax.
57 * Minor changes in diagnostic handling.
58 * Record list deleted when connection closes.
60 * Revision 1.9 1995/06/14 15:08:01 adam
61 * Bug fix in cascade-target-list. Uses yaz-version.h.
63 * Revision 1.8 1995/06/14 13:37:18 adam
64 * Setting recordType implemented.
65 * Setting implementationVersion implemented.
66 * Settings implementationId / implementationName edited.
68 * Revision 1.7 1995/06/01 07:31:28 adam
69 * Rename of many typedefs -> IrTcl_...
71 * Revision 1.6 1995/05/31 08:36:40 adam
72 * Bug fix in client.tcl: didn't save options on clientrc.tcl.
73 * New method: referenceId. More work on scan.
75 * Revision 1.5 1995/05/29 08:44:25 adam
76 * Work on delete of objects.
78 * Revision 1.4 1995/05/26 11:44:10 adam
79 * Bugs fixed. More work on MARC utilities and queries. Test
80 * client is up-to-date again.
82 * Revision 1.3 1995/05/26 08:54:17 adam
83 * New MARC utilities. Uses prefix query.
85 * Revision 1.2 1995/05/24 14:10:23 adam
86 * Work on idAuthentication, protocolVersion and options.
88 * Revision 1.1 1995/05/23 15:34:49 adam
89 * Many new settings, userInformationField, smallSetUpperBound, etc.
90 * A number of settings are inherited when ir-set is executed.
91 * This version is incompatible with the graphical test client (client.tcl).
106 #include <comstack.h>
113 #include <yaz-version.h>
117 #include <diagbib1.h>
122 char **databaseNames;
123 int num_databaseNames;
125 enum oid_value *preferredRecordSyntax;
126 int replaceIndicator;
129 char *elementSetNames;
130 char *smallSetElementSetNames;
131 char *mediumSetElementSetNames;
133 int smallSetUpperBound;
134 int largeSetLowerBound;
135 int mediumSetPresentNumber;
148 int preferredMessageSize;
149 int maximumRecordSize;
151 Odr_bitmask protocolVersion;
153 char *idAuthenticationOpen;
154 char *idAuthenticationGroupId;
155 char *idAuthenticationUserId;
156 char *idAuthenticationPassword;
158 char *implementationName;
159 char *implementationId;
160 char *implementationVersion;
162 char *targetImplementationName;
163 char *targetImplementationId;
164 char *targetImplementationVersion;
165 char *userInformationField;
187 struct IrTcl_Request_ *request_queue;
189 IrTcl_SetCObj set_inher;
192 typedef struct IrTcl_Request_ {
193 struct IrTcl_Request_ *next;
208 struct GRS_Record_entry {
217 struct IrTcl_GRS_Record_ *sub;
228 typedef struct IrTcl_GRS_Record_ {
230 struct GRS_Record_entry *entries;
233 typedef struct IrTcl_RecordList_ {
242 IrTcl_GRS_Record *grs1;
248 IrTcl_Diagnostic *list;
249 } surrogateDiagnostics;
251 struct IrTcl_RecordList_ *next;
254 typedef struct IrTcl_SetObj_ {
259 int nextResultSetPosition;
262 int numberOfRecordsReturned;
264 char *recordElements;
267 int nonSurrogateDiagnosticNum;
268 char *searchResponse;
269 char *presentResponse;
270 IrTcl_Diagnostic *nonSurrogateDiagnosticList;
271 IrTcl_RecordList *record_list;
272 IrTcl_SetCObj set_inher;
275 typedef struct IrTcl_ScanEntry_ {
280 int globalOccurrences;
283 IrTcl_Diagnostic *list;
289 typedef struct IrTcl_ScanObj_ {
292 int numberOfTermsRequested;
293 int preferredPositionInResponse;
296 int numberOfEntriesReturned;
306 IrTcl_ScanEntry *entries;
307 IrTcl_Diagnostic *nonSurrogateDiagnosticList;
308 int nonSurrogateDiagnosticNum;
311 struct ir_named_entry {
316 int ir_tcl_get_marc (Tcl_Interp *interp, const char *buf,
317 int argc, char **argv);
318 int ir_tcl_send_APDU (Tcl_Interp *interp, IrTcl_Obj *p, Z_APDU *apdu,
319 const char *msg, const char *object_name);
320 int ir_tcl_send_q (IrTcl_Obj *p, IrTcl_Request *rq, const char *msg);
321 void ir_tcl_del_q (IrTcl_Obj *p);
322 void *ir_tcl_malloc (size_t size);
323 int ir_tcl_strdup (Tcl_Interp *interp, char** p, const char *s);
324 int ir_tcl_strdel (Tcl_Interp *interp, char **p);
326 char *ir_tcl_fread_marc (FILE *inf, size_t *size);
327 void ir_tcl_read_grs (Z_GenericRecord *r, IrTcl_GRS_Record **grs_record);
328 int ir_tcl_get_grs (Tcl_Interp *interp, IrTcl_GRS_Record *grs_record,
329 int argc, char **argv);
331 #define IR_TCL_FAIL_CONNECT 1
332 #define IR_TCL_FAIL_READ 2
333 #define IR_TCL_FAIL_WRITE 3
334 #define IR_TCL_FAIL_IN_APDU 4
335 #define IR_TCL_FAIL_UNKNOWN_APDU 5
337 #define IR_TCL_R_Idle 0
338 #define IR_TCL_R_Writing 1
339 #define IR_TCL_R_Waiting 2
340 #define IR_TCL_R_Reading 3
341 #define IR_TCL_R_Connecting 4