2 * Copyright (c) 1999-2000, Index Data.
3 * See the file LICENSE for details.
6 * Revision 1.3 2000-01-31 13:15:21 adam
7 * Removed uses of assert(3). Cleanup of ODR. CCL parser update so
8 * that some characters are not surrounded by spaces in resulting term.
11 * Revision 1.2 2000/01/15 09:38:51 adam
12 * Implemented ill_get_ILLRequest. Added some type mappings for ILL protocol.
14 * Revision 1.1 1999/12/16 23:36:19 adam
15 * Implemented ILL protocol. Minor updates ASN.1 compiler.
21 bool_t *ill_get_bool (struct ill_get_ctl *gc, const char *name,
22 const char *sub, int val)
27 bool_t *r = odr_malloc (o, sizeof(*r));
29 strcpy(element, name);
32 strcat (element, ",");
33 strcat (element, sub);
36 v = (gc->f)(gc->clientData, element);
45 int *ill_get_int (struct ill_get_ctl *gc, const char *name,
46 const char *sub, int val)
51 int *r = odr_malloc (o, sizeof(*r));
53 strcpy(element, name);
56 strcat (element, ",");
57 strcat (element, sub);
59 v = (gc->f)(gc->clientData, element);
66 int *ill_get_enumerated (struct ill_get_ctl *gc, const char *name,
67 const char *sub, int val)
69 return ill_get_int(gc, name, sub, val);
72 ILL_String *ill_get_ILL_String (struct ill_get_ctl *gc, const char *name,
75 ILL_String *r = (ILL_String *) odr_malloc (gc->odr, sizeof(*r));
79 strcpy(element, name);
82 strcat (element, ",");
83 strcat (element, sub);
85 v = (gc->f)(gc->clientData, element);
88 r->which = ILL_String_GeneralString;
89 r->u.GeneralString = odr_strdup (gc->odr, v);
93 ILL_Person_Or_Institution_Symbol *ill_get_Person_Or_Insitution_Symbol (
94 struct ill_get_ctl *gc, const char *name, const char *sub)
98 ILL_Person_Or_Institution_Symbol *p = odr_malloc (o, sizeof(*p));
100 strcpy(element, name);
103 strcat (element, ",");
104 strcat (element, sub);
106 p->which = ILL_Person_Or_Institution_Symbol_person_symbol;
107 if ((p->u.person_symbol = ill_get_ILL_String (gc, element, "person")))
110 p->which = ILL_Person_Or_Institution_Symbol_institution_symbol;
111 if ((p->u.institution_symbol =
112 ill_get_ILL_String (gc, element, "institution")))
117 static ILL_Name_Of_Person_Or_Institution *ill_get_Name_Of_Person_Or_Institution(
118 struct ill_get_ctl *gc, const char *name, const char *sub)
122 ILL_Name_Of_Person_Or_Institution *p = odr_malloc (o, sizeof(*p));
124 strcpy(element, name);
127 strcat (element, ",");
128 strcat (element, sub);
130 p->which = ILL_Name_Of_Person_Or_Institution_name_of_person;
131 if ((p->u.name_of_person =
132 ill_get_ILL_String (gc, element, "name-of-person")))
135 p->which = ILL_Name_Of_Person_Or_Institution_name_of_institution;
136 if ((p->u.name_of_institution =
137 ill_get_ILL_String (gc, element, "name-of-institution")))
142 ILL_System_Id *ill_get_System_Id(struct ill_get_ctl *gc,
143 const char *name, const char *sub)
149 strcpy(element, name);
152 strcat (element, ",");
153 strcat (element, sub);
155 p = (ILL_System_Id *) odr_malloc (o, sizeof(*p));
156 p->person_or_institution_symbol =
157 ill_get_Person_Or_Insitution_Symbol (gc, element,
158 "person-or-institution-symbol");
159 p->name_of_person_or_institution =
160 ill_get_Name_Of_Person_Or_Institution (gc, element,
161 "name-of-person-or-institution");
165 ILL_Transaction_Id *ill_get_Transaction_Id (struct ill_get_ctl *gc,
166 const char *name, const char *sub)
169 ILL_Transaction_Id *r = (ILL_Transaction_Id *) odr_malloc (o, sizeof(*r));
172 strcpy(element, name);
175 strcat (element, ",");
176 strcat (element, sub);
178 r->initial_requester_id =
179 ill_get_System_Id (gc, element, "initial-requester-id");
180 r->transaction_group_qualifier =
181 ill_get_ILL_String (gc, element, "transaction-group-qualifier");
182 r->transaction_qualifier =
183 ill_get_ILL_String (gc, element, "transaction-qualifier");
184 r->sub_transaction_qualifier =
185 ill_get_ILL_String (gc, element, "sub-transaction-qualifier");
190 ILL_Service_Date_this *ill_get_Service_Date_this (
191 struct ill_get_ctl *gc, const char *name, const char *sub)
194 ILL_Service_Date_this *r =
195 (ILL_Service_Date_this *) odr_malloc (o, sizeof(*r));
198 strcpy(element, name);
201 strcat (element, ",");
202 strcat (element, sub);
204 r->date = odr_strdup (o, "14012000");
209 ILL_Service_Date_Time *ill_get_Service_Date_Time (
210 struct ill_get_ctl *gc, const char *name, const char *sub)
213 ILL_Service_Date_Time *r =
214 (ILL_Service_Date_Time *) odr_malloc (o, sizeof(*r));
217 strcpy(element, name);
220 strcat (element, ",");
221 strcat (element, sub);
223 r->date_time_of_this_service = ill_get_Service_Date_this (gc, element,
225 r->date_time_of_original_service = 0;
229 ILL_Requester_Optional_Messages_Type *ill_get_Requester_Optional_Messages_Type (
230 struct ill_get_ctl *gc, const char *name, const char *sub)
233 ILL_Requester_Optional_Messages_Type *r =
234 (ILL_Requester_Optional_Messages_Type *) odr_malloc (o, sizeof(*r));
237 strcpy(element, name);
240 strcat (element, ",");
241 strcat (element, sub);
243 r->can_send_RECEIVED = ill_get_bool (gc, element, "can-send-RECEIVED", 0);
244 r->can_send_RETURNED = ill_get_bool (gc, element, "can-send-RETURNED", 0);
245 r->requester_SHIPPED =
246 ill_get_enumerated (gc, element, "requester-SHIPPED", 1);
247 r->requester_CHECKED_IN =
248 ill_get_enumerated (gc, element, "requester-CHECKED-IN", 1);
252 ILL_Item_Id *ill_get_Item_Id (
253 struct ill_get_ctl *gc, const char *name, const char *sub)
256 ILL_Item_Id *r = (ILL_Item_Id *) odr_malloc (o, sizeof(*r));
259 strcpy(element, name);
262 strcat (element, ",");
263 strcat (element, sub);
265 r->item_type = ill_get_enumerated (gc, element, "item-type",
266 ILL_Item_Id_monograph);
267 r->held_medium_type = 0;
268 r->call_number = ill_get_ILL_String(gc, element, "call-number");
269 r->author = ill_get_ILL_String(gc, element, "author");
270 r->title = ill_get_ILL_String(gc, element, "title");
271 r->sub_title = ill_get_ILL_String(gc, element, "sub-title");
272 r->sponsoring_body = ill_get_ILL_String(gc, element, "sponsoring-body");
273 r->place_of_publication =
274 ill_get_ILL_String(gc, element, "place-of-publication");
275 r->publisher = ill_get_ILL_String(gc, element, "publisher");
276 r->series_title_number =
277 ill_get_ILL_String(gc, element, "series-title-number");
278 r->volume_issue = ill_get_ILL_String(gc, element, "volume-issue");
279 r->edition = ill_get_ILL_String(gc, element, "edition");
280 r->publication_date = ill_get_ILL_String(gc, element, "publication-date");
281 r->publication_date_of_component =
282 ill_get_ILL_String(gc, element, "publication-date-of-component");
283 r->author_of_article = ill_get_ILL_String(gc, element,
284 "author-of-article");
285 r->title_of_article = ill_get_ILL_String(gc, element, "title-or-article");
286 r->pagination = ill_get_ILL_String(gc, element, "pagination");
287 r->national_bibliography_no = 0;
288 r->iSBN = ill_get_ILL_String(gc, element, "ISBN");
289 r->iSSN = ill_get_ILL_String(gc, element, "ISSN");
291 r->additional_no_letters =
292 ill_get_ILL_String(gc, element, "additional-no-letters");
293 r->verification_reference_source =
294 ill_get_ILL_String(gc, element, "verification-reference-source");
298 ILL_ItemRequest *ill_get_ItemRequest (
299 struct ill_get_ctl *gc, const char *name, const char *sub)
302 ILL_ItemRequest *r = (ILL_ItemRequest *)odr_malloc(o, sizeof(*r));
306 ILL_Request *ill_get_ILLRequest (
307 struct ill_get_ctl *gc, const char *name, const char *sub)
310 ILL_Request *r = (ILL_Request *) odr_malloc(o, sizeof(*r));
313 strcpy(element, name);
316 strcat (element, ",");
317 strcat (element, sub);
319 r->protocol_version_num =
320 ill_get_enumerated (gc, element, "protocol-version-num",
321 ILL_Request_version_2);
323 r->transaction_id = ill_get_Transaction_Id (gc, element, "transaction-id");
324 r->service_date_time =
325 ill_get_Service_Date_Time (gc, element, "service-date-time");
326 r->requester_id = ill_get_System_Id (gc, element, "requester-id");
327 r->responder_id = ill_get_System_Id (gc, element, "responder-id");
328 r->transaction_type =
329 ill_get_enumerated(gc, element, "transaction-type", 1);
330 r->delivery_address = 0; /* TODO */
331 r->delivery_service = 0; /* TODO */
332 r->billing_address = 0; /* TODO */
334 r->num_iLL_service_type = 1;
335 r->iLL_service_type = (ILL_Service_Type **)
336 odr_malloc (o, sizeof(*r->iLL_service_type));
337 *r->iLL_service_type =
338 ill_get_enumerated (gc, element, "ill-service-type",
339 ILL_Service_Type_copy_non_returnable);
341 r->responder_specific_service = 0;
342 r->requester_optional_messages =
343 ill_get_Requester_Optional_Messages_Type (
344 gc, element,"requester-optional-messages");
345 r->search_type = 0; /* TODO */
346 r->num_supply_medium_info_type = 0;
347 r->supply_medium_info_type = 0;
350 ill_get_enumerated (gc, element, "place-on-hold",
351 ILL_Place_On_Hold_Type_according_to_responder_policy);
352 r->client_id = 0; /* TODO */
353 r->item_id = ill_get_Item_Id (gc, element, "item-id");
354 r->supplemental_item_description = 0;
355 r->cost_info_type = 0;
356 r->copyright_compliance =
357 ill_get_ILL_String(gc, element, "copyright-complicance");
358 r->third_party_info_type = 0;
359 r->retry_flag = ill_get_bool (gc, element, "retry-flag", 0);
360 r->forward_flag = ill_get_bool (gc, element, "forward-flag", 0);
361 r->requester_note = ill_get_ILL_String(gc, element, "requester-note");
362 r->forward_note = ill_get_ILL_String(gc, element, "forward-note");
363 r->num_iLL_request_extensions = 0;
364 r->iLL_request_extensions = 0;