From 9d5b598c238693453bf2c7688374af1d940ce834 Mon Sep 17 00:00:00 2001 From: Sebastian Hammer Date: Mon, 21 Aug 1995 09:16:32 +0000 Subject: [PATCH] Added Extended services + Item Order --- asn/prt-exd.c | 193 +++++++++++++++++++++++++++++++++++++++++++++++++++++ include/prt-exd.h | 145 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 338 insertions(+) create mode 100644 asn/prt-exd.c create mode 100644 include/prt-exd.h diff --git a/asn/prt-exd.c b/asn/prt-exd.c new file mode 100644 index 0000000..6ae2989 --- /dev/null +++ b/asn/prt-exd.c @@ -0,0 +1,193 @@ +/* + * Copyright (c) 1995, Index Data. + * See the file LICENSE for details. + * Sebastian Hammer, Adam Dickmeiss + * + * $Log: prt-exd.c,v $ + * Revision 1.1 1995-08-21 09:16:32 quinn + * Added Extended services + Item Order + * + * + */ + +#include + +int z_TaskPackage(ODR o, Z_TaskPackage **p, int opt) +{ + if (!odr_sequence_begin(o, p, sizeof(**p))) + return opt && odr_ok(o); + return + odr_implicit(o, odr_oid, &(*p)->packageType, ODR_CONTEXT, 1, 0) && + odr_implicit(o, z_InternationalString, &(*p)->packageName, ODR_CONTEXT, + 2, 1) && + odr_implicit(o, z_InternationalString, &(*p)->userId, ODR_CONTEXT, + 3, 1) && + odr_implicit(o, z_IntUnit, &(*p)->retentionTime, ODR_CONTEXT, 4, 1) && + odr_implicit(o, z_Permissions, &(*p)->permissions, ODR_CONTEXT, 5, 1) && + odr_implicit(o, z_InternationalString, &(*p)->description, ODR_CONTEXT, + 6, 1) && + odr_implicit(o, odr_octetstring, &(*p)->targetReference, ODR_CONTEXT, + 7, 0) && + odr_implicit(o, odr_generalizedtime, &(*p)->creationDateTime, + ODR_CONTEXT, + 8, 1) && + odr_implicit(o, odr_integer, &(*p)->taskStatus, ODR_CONTEXT, 9, 0) && + odr_implicit_settag(o, ODR_CONTEXT, 10) && + (odr_sequence_of(o, z_DiagRec, &(*p)->packageDiagnostics, + &(*p)->num_packageDiagnostics) || odr_ok(o)) && + odr_implicit(o, z_External, &(*p)->taskSpecificParameters, ODR_CONTEXT, + 11, 0) && + odr_sequence_end(o); +} + +/* ----------------------- ITEM ORDER --------------------- */ + +int z_IOTargetPart(ODR o, Z_IOTargetPart **p, int opt) +{ + if (!odr_sequence_begin(o, p, sizeof(**p))) + return opt && odr_ok(o); + return + odr_implicit(o, z_External, &(*p)->itemRequest, ODR_CONTEXT, 1, 1) && + odr_implicit(o, z_External, &(*p)->statusOrErrorReport, ODR_CONTEXT, + 2, 0) && + odr_implicit(o, odr_integer, &(*p)->auxiliaryStatus, ODR_CONTEXT, + 3, 1) && + odr_sequence_end(o); +} + +int z_IOResultSetItem(ODR o, Z_IOResultSetItem **p, int opt) +{ + if (!odr_sequence_begin(o, p, sizeof(**p))) + return opt && odr_ok(o); + return + odr_implicit(o, z_InternationalString, &(*p)->resultSetId, ODR_CONTEXT, + 1, 0) && + odr_implicit(o, odr_integer, &(*p)->item, ODR_CONTEXT, 2, 1) && + odr_sequence_end(o); +} + +int z_IOOriginPartNotToKeep(ODR o, Z_IOOriginPartNotToKeep **p, int opt) +{ + if (!odr_sequence_begin(o, p, sizeof(**p))) + return opt && odr_ok(o); + return + odr_implicit(o, z_IOResultSetItem, &(*p)->resultSetItem, ODR_CONTEXT, + 1, 0) && + odr_implicit(o, z_External, &(*p)->itemRequest, ODR_CONTEXT, 2, 1) && + odr_sequence_end(o); +} + +int z_IOContact(ODR o, Z_IOContact **p, int opt) +{ + if (!odr_sequence_begin(o, p, sizeof(**p))) + return opt && odr_ok(o); + return + odr_implicit(o, z_InternationalString, &(*p)->name, ODR_CONTEXT, + 1, 1) && + odr_implicit(o, z_InternationalString, &(*p)->phone, ODR_CONTEXT, + 2, 1) && + odr_implicit(o, z_InternationalString, &(*p)->email, ODR_CONTEXT, + 3, 1) && + odr_sequence_end(o); +} + +int z_IOCreditCardInfo(ODR o, Z_IOCreditCardInfo **p, int opt) +{ + if (!odr_sequence_begin(o, p, sizeof(**p))) + return opt && odr_ok(o); + return + odr_implicit(o, z_InternationalString, &(*p)->nameOnCard, ODR_CONTEXT, + 1, 0) && + odr_implicit(o, z_InternationalString, &(*p)->expirationDate, + ODR_CONTEXT, 2, 0) && + odr_implicit(o, z_InternationalString, &(*p)->cardNumber, ODR_CONTEXT, + 3, 0) && + odr_sequence_end(o); +} + +int z_IOBilling(ODR o, Z_IOBilling **p, int opt) +{ + static Odr_arm arm[] = + { + {ODR_IMPLICIT, ODR_CONTEXT, 0, Z_IOBilling_billInvoice, odr_null}, + {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_IOBilling_prepay, odr_null}, + {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_IOBilling_depositAccount, odr_null}, + {ODR_IMPLICIT, ODR_CONTEXT, 3, Z_IOBilling_creditCard, + z_IOCreditCardInfo}, + {ODR_IMPLICIT, ODR_CONTEXT, 4, Z_IOBilling_cardInfoPreviouslySupplied, + odr_null}, + {ODR_IMPLICIT, ODR_CONTEXT, 5, Z_IOBilling_privateKnown, odr_null}, + {ODR_IMPLICIT, ODR_CONTEXT, 6, Z_IOBilling_privateNotKnown, + z_External}, + {-1, -1, -1, -1, 0} + }; + + if (!odr_sequence_begin(o, p, sizeof(**p))) + return opt && odr_ok(o); + return + odr_constructed_begin(o, &(*p)->paymentMethod, + ODR_CONTEXT, 1) && + odr_choice(o, arm, &(*p)->paymentMethod, &(*p)->which) && + odr_constructed_end(o) && + odr_implicit(o, z_InternationalString, &(*p)->customerReference, + ODR_CONTEXT, 2, 1) && + odr_implicit(o, z_InternationalString, &(*p)->customerPONumber, + ODR_CONTEXT, 3, 1) && + odr_sequence_end(o); +} + +int z_IOOriginPartToKeep(ODR o, Z_IOOriginPartToKeep **p, int opt) +{ + if (!odr_sequence_begin(o, p, sizeof(**p))) + return opt && odr_ok(o); + return + odr_implicit(o, z_External, &(*p)->supplDescription, ODR_CONTEXT, + 1, 1) && + odr_implicit(o, z_IOContact, &(*p)->contact, ODR_CONTEXT, 2, 1) && + odr_implicit(o, z_IOBilling, &(*p)->addlBilling, ODR_CONTEXT, + 3, 1) && + odr_sequence_end(o); +} + +int z_IORequest(ODR o, Z_IORequest **p, int opt) +{ + if (!odr_sequence_begin(o, p, sizeof(**p))) + return opt && odr_ok(o); + return + odr_implicit(o, z_IOOriginPartToKeep, &(*p)->toKeep, ODR_CONTEXT, + 1, 1) && + odr_implicit(o, z_IOOriginPartNotToKeep, &(*p)->notToKeep, ODR_CONTEXT, + 2, 0) && + odr_sequence_end(o); +} + +int z_IOTaskPackage(ODR o, Z_IOTaskPackage **p, int opt) +{ + if (!odr_sequence_begin(o, p, sizeof(**p))) + return opt && odr_ok(o); + return + odr_implicit(o, z_IOOriginPartToKeep, &(*p)->originPart, ODR_CONTEXT, + 1, 1) && + odr_implicit(o, z_IOTargetPart, &(*p)->targetPart, ODR_CONTEXT, 2, 0) && + odr_sequence_end(o); +} + +int z_ItemOrder(ODR o, Z_ItemOrder **p, int opt) +{ + static Odr_arm arm[] = + { + {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ItemOrder_esRequest, z_IORequest}, + {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_ItemOrder_taskPackage, + z_IOTaskPackage}, + {-1, -1, -1, -1, 0} + }; + + if (o->direction == ODR_DECODE) + *p = odr_malloc(o, sizeof(**p)); + else if (!*p) + return opt; + if (odr_choice(o, arm, &(*p)->u, &(*p)->which)) + return 1; + *p = 0; + return opt && odr_ok(o); +} diff --git a/include/prt-exd.h b/include/prt-exd.h new file mode 100644 index 0000000..c13fe14 --- /dev/null +++ b/include/prt-exd.h @@ -0,0 +1,145 @@ +/* + * Copyright (c) 1995, Index Data. + * + * Permission to use, copy, modify, distribute, and sell this software and + * its documentation, in whole or in part, for any purpose, is hereby granted, + * provided that: + * + * 1. This copyright and permission notice appear in all copies of the + * software and its documentation. Notices of copyright or attribution + * which appear at the beginning of any file must remain unchanged. + * + * 2. The names of Index Data or the individual authors may not be used to + * endorse or promote products derived from this software without specific + * prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTY OF ANY KIND, + * EXPRESS, IMPLIED, OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY + * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + * IN NO EVENT SHALL INDEX DATA BE LIABLE FOR ANY SPECIAL, INCIDENTAL, + * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR + * NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF + * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + * + */ + +typedef struct Z_TaskPackage +{ + Odr_oid *packageType; + char *packageName; /* OPTIONAL */ + char *userId; /* OPTIONAL */ + Z_IntUnit *retentionTime; /* OPTIONAL */ + Z_Permissions *permissions; /* OPTIONAL */ + char *description; /* OPTIONAL */ + Odr_oct *targetReference; + char *creationDateTime; /* OPTIONAL */ + int *taskStatus; +#define Z_TaskPackage_pending 0 +#define Z_TaskPackage_active 1 +#define Z_TaskPackage_complete 2 +#define Z_TaskPackage_aborted 3 + int num_packageDiagnostics; + Z_DiagRec **packageDiagnostics; /* OPTIONAL */ + Z_External *taskSpecificParameters; +} Z_TaskPackage; + +int z_TaskPackage(ODR o, Z_TaskPackage **p, int opt); + +/* ----------------------- ITEM ORDER ------------------------- */ + +typedef struct Z_IOTargetPart +{ + Z_External *itemRequest; /* OPTIONAL */ + Z_External *statusOrErrorReport; + int *auxiliaryStatus; /* OPTIONAL */ +#define Z_IOTargetPart_notReceived 1 +#define Z_IOTargetPart_loanQueue 2 +#define Z_IOTargetPart_forwarded 3 +#define Z_IOTargetPart_unfilledCopyright 4 +#define Z_IOTargetPart_filledCopyright 1 +} Z_IOTargetPart; + +typedef struct Z_IOResultSetItem +{ + char *resultSetId; + int *item; +} Z_IOResultSetItem; + +typedef struct Z_IOOriginPartNotToKeep +{ + Z_IOResultSetItem *resultSetItem; /* OPTIONAL */ + Z_External *itemRequest; /* OPTIONAL */ +} Z_IOOriginPartNotToKeep; + +typedef struct Z_IOContact +{ + char *name; /* OPTIONAL */ + char *phone; /* OPTIONAL */ + char *email; /* OPTIONAL */ +} Z_IOContact; + +typedef struct Z_IOCreditCardInfo +{ + char *nameOnCard; + char *expirationDate; + char *cardNumber; +} Z_IOCreditCardInfo; + +typedef struct Z_IOBilling +{ + enum + { + Z_IOBilling_billInvoice, + Z_IOBilling_prepay, + Z_IOBilling_depositAccount, + Z_IOBilling_creditCard, + Z_IOBilling_cardInfoPreviouslySupplied, + Z_IOBilling_privateKnown, + Z_IOBilling_privateNotKnown + } which; + union + { + Odr_null *noinfo; + Z_IOCreditCardInfo *creditCard; + Z_External *privateNotKnown; + } paymentMethod; + char *customerReference; /* OPTIONAL */ + char *customerPONumber; /* OPTIONAL */ +} Z_IOBilling; + +typedef struct Z_IOOriginPartToKeep +{ + Z_External *supplDescription; /* OPTIONAL */ + Z_IOContact *contact; /* OPTIONAL */ + Z_IOBilling *addlBilling; /* OPTIONAL */ +} Z_IOOriginPartToKeep; + +typedef struct Z_IORequest +{ + Z_IOOriginPartToKeep *toKeep; /* OPTIONAL */ + Z_IOOriginPartNotToKeep *notToKeep; +} Z_IORequest; + +typedef struct Z_IOTaskPackage +{ + Z_IOOriginPartToKeep *originPart; /* OPTIONAL */ + Z_IOTargetPart *targetPart; +} Z_IOTaskPackage; + +typedef struct Z_ItemOrder +{ + enum + { + Z_ItemOrder_esRequest, + Z_ItemOrder_taskPackage + } which; + union + { + Z_IORequest *esRequest; + Z_IOTaskPackage *taskPackage; + } u; +} Z_ItemOrder; + +int z_ItemOrder(ODR o, Z_ItemOrder **p, int opt); -- 1.7.10.4