static int largeSetLowerBound = 1;
static int mediumSetPresentNumber = 0;
static Z_ElementSetNames *elementSetNames = 0;
-static odr_int_t setno = 1; /* current set offset */
+static Odr_int setno = 1; /* current set offset */
static enum oid_proto protocol = PROTO_Z3950; /* current app protocol */
#define RECORDSYNTAX_MAX 20
static char *recordsyntax_list[RECORDSYNTAX_MAX];
printf(" ");
}
-static void print_int(int iLevel, const char *pTag, odr_int_t *pInt)
+static void print_int(int iLevel, const char *pTag, Odr_int *pInt)
{
if (pInt != NULL)
{
}
}
+static void print_bool(int iLevel, const char *pTag, Odr_bool *pInt)
+{
+ if (pInt != NULL)
+ {
+ print_level(iLevel);
+ printf("%s: %d\n", pTag, *pInt);
+ }
+}
+
static void print_string(int iLevel, const char *pTag, const char *pString)
{
if (pString != NULL)
{
printf("Received ResourceControlRequest.\n");
print_referenceId(1, req->referenceId);
- print_int(1, "Suspended Flag", req->suspendedFlag);
+ print_bool(1, "Suspended Flag", req->suspendedFlag);
print_int(1, "Partial Results Available", req->partialResultsAvailable);
- print_int(1, "Response Required", req->responseRequired);
- print_int(1, "Triggered Request Flag", req->triggeredRequestFlag);
+ print_bool(1, "Response Required", req->responseRequired);
+ print_bool(1, "Triggered Request Flag", req->triggeredRequestFlag);
print_external(1, req->resourceReport);
return 0;
}
/* PRESENT SERVICE ----------------------------- */
static void parse_show_args(const char *arg_c, char *setstring,
- odr_int_t *start, odr_int_t *number)
+ Odr_int *start, Odr_int *number)
{
char arg[40];
char *p;
Z_APDU *apdu = zget_APDU(out, Z_APDU_presentRequest);
Z_PresentRequest *req = apdu->u.presentRequest;
Z_RecordComposition compo;
- odr_int_t nos = 1;
+ Odr_int nos = 1;
char setstring[100];
req->referenceId = set_refid(out);
static int send_SRW_presentRequest(const char *arg)
{
char setstring[100];
- odr_int_t nos = 1;
+ Odr_int nos = 1;
Z_SRW_PDU *sr = srw_sr;
if (!sr)
}
int send_scanrequest(const char *set, const char *query,
- odr_int_t pp, odr_int_t num, const char *term)
+ Odr_int pp, Odr_int num, const char *term)
{
Z_APDU *apdu = zget_APDU(out, Z_APDU_scanRequest);
Z_ScanRequest *req = apdu->u.scanRequest;
various PDUs of the Z39.50 protocol, as well as for the complex types
appearing within the PDUs. For the primitive data types, the C
representation often takes the form of an ordinary C language type,
- such as <literal>int</literal>. For ASN.1 constructs that have no direct
+ such as <literal>Odr_int</literal> which is equivalent to an integral
+ C integer. For ASN.1 constructs that have no direct
representation in C, such as general octet strings and bit strings,
the &odr; module (see section <link linkend="odr">The ODR Module</link>)
provides auxiliary definitions.
options</entry><entry>Odr_bitmask</entry><entry>Empty bitmask
</entry></row>
<row><entry>
- preferredMessageSize</entry><entry>int</entry><entry>30*1024
+ preferredMessageSize</entry><entry>Odr_int</entry><entry>30*1024
</entry></row>
<row><entry>
- maximumRecordSize</entry><entry>int</entry><entry>30*1024
+ maximumRecordSize</entry><entry>Odr_int</entry><entry>30*1024
</entry></row>
<row><entry>
idAuthentication</entry><entry>Z_IdAuthentication</entry><entry>NULL
options</entry><entry>Odr_bitmask</entry><entry>Empty bitmask
</entry></row>
<row><entry>
- preferredMessageSize</entry><entry>int</entry><entry>30*1024
+ preferredMessageSize</entry><entry>Odr_int</entry><entry>30*1024
</entry></row>
<row><entry>
- maximumRecordSize</entry><entry>int</entry><entry>30*1024
+ maximumRecordSize</entry><entry>Odr_int</entry><entry>30*1024
</entry></row>
<row><entry>
- result</entry><entry>bool_t</entry><entry>TRUE
+ result</entry><entry>Odr_bool</entry><entry>TRUE
</entry></row>
<row><entry>
implementationId</entry><entry>char*</entry><entry>"id)"
referenceId</entry><entry>Z_ReferenceId</entry><entry>NULL
</entry></row>
<row><entry>
- smallSetUpperBound</entry><entry>int</entry><entry>0
+ smallSetUpperBound</entry><entry>Odr_int</entry><entry>0
</entry></row>
<row><entry>
- largeSetLowerBound</entry><entry>int</entry><entry>1
+ largeSetLowerBound</entry><entry>Odr_int</entry><entry>1
</entry></row>
<row><entry>
- mediumSetPresentNumber</entry><entry>int</entry><entry>0
+ mediumSetPresentNumber</entry><entry>Odr_int</entry><entry>0
</entry></row>
<row><entry>
- replaceIndicator</entry><entry>bool_t</entry><entry>TRUE
+ replaceIndicator</entry><entry>Odr_bool</entry><entry>TRUE
</entry></row>
<row><entry>
resultSetName</entry><entry>char *</entry><entry>"default"
</entry></row>
<row><entry>
- num_databaseNames</entry><entry>int</entry><entry>0
+ num_databaseNames</entry><entry>Odr_int</entry><entry>0
</entry></row>
<row><entry>
databaseNames</entry><entry>char **</entry><entry>NULL
referenceId</entry><entry>Z_ReferenceId</entry><entry>NULL
</entry></row>
<row><entry>
- resultCount</entry><entry>int</entry><entry>0
+ resultCount</entry><entry>Odr_int</entry><entry>0
</entry></row>
<row><entry>
- numberOfRecordsReturned</entry><entry>int</entry><entry>0
+ numberOfRecordsReturned</entry><entry>Odr_int</entry><entry>0
</entry></row>
<row><entry>
- nextResultSetPosition</entry><entry>int</entry><entry>0
+ nextResultSetPosition</entry><entry>Odr_int</entry><entry>0
</entry></row>
<row><entry>
- searchStatus</entry><entry>bool_t</entry><entry>TRUE
+ searchStatus</entry><entry>Odr_bool</entry><entry>TRUE
</entry></row>
<row><entry>
- resultSetStatus</entry><entry>int</entry><entry>NULL
+ resultSetStatus</entry><entry>Odr_int</entry><entry>NULL
</entry></row>
<row><entry>
- presentStatus</entry><entry>int</entry><entry>NULL
+ presentStatus</entry><entry>Odr_int</entry><entry>NULL
</entry></row>
<row><entry>
records</entry><entry>Z_Records</entry><entry>NULL
resultSetId</entry><entry>char*</entry><entry>"default"
</entry></row>
<row><entry>
- resultSetStartPoint</entry><entry>int</entry><entry>1
+ resultSetStartPoint</entry><entry>Odr_int</entry><entry>1
</entry></row>
<row><entry>
- numberOfRecordsRequested</entry><entry>int</entry><entry>10
+ numberOfRecordsRequested</entry><entry>Odr_int</entry><entry>10
</entry></row>
<row><entry>
- num_ranges</entry><entry>int</entry><entry>0
+ num_ranges</entry><entry>Odr_int</entry><entry>0
</entry></row>
<row><entry>
additionalRanges</entry><entry>Z_Range</entry><entry>NULL
preferredRecordSyntax</entry><entry>Odr_oid</entry><entry>NULL
</entry></row>
<row><entry>
- maxSegmentCount</entry><entry>int</entry><entry>NULL
+ maxSegmentCount</entry><entry>Odr_int</entry><entry>NULL
</entry></row>
<row><entry>
- maxRecordSize</entry><entry>int</entry><entry>NULL
+ maxRecordSize</entry><entry>Odr_int</entry><entry>NULL
</entry></row>
<row><entry>
- maxSegmentSize</entry><entry>int</entry><entry>NULL
+ maxSegmentSize</entry><entry>Odr_int</entry><entry>NULL
</entry></row>
<row><entry>
otherInfo</entry><entry>Z_OtherInformation</entry><entry>NULL
referenceId</entry><entry>Z_ReferenceId</entry><entry>NULL
</entry></row>
<row><entry>
- numberOfRecordsReturned</entry><entry>int</entry><entry>0
+ numberOfRecordsReturned</entry><entry>Odr_int</entry><entry>0
</entry></row>
<row><entry>
- nextResultSetPosition</entry><entry>int</entry><entry>0
+ nextResultSetPosition</entry><entry>Odr_int</entry><entry>0
</entry></row>
<row><entry>
- presentStatus</entry><entry>int</entry><entry>Z_PresentStatus_success
+ presentStatus</entry><entry>Odr_int</entry><entry>Z_PresentStatus_success
</entry></row>
<row><entry>
records</entry><entry>Z_Records</entry><entry>NULL
</entry><entry>Z_ReferenceId</entry><entry>NULL
</entry></row>
<row><entry>
- deleteFunction</entry><entry>int</entry><entry>Z_DeleteResultSetRequest_list
+ deleteFunction</entry><entry>Odr_int</entry><entry>Z_DeleteResultSetRequest_list
</entry></row>
<row><entry>
- num_ids</entry><entry>int</entry><entry>0
+ num_ids</entry><entry>Odr_int</entry><entry>0
</entry></row>
<row><entry>
resultSetList</entry><entry>char**</entry><entry>NULL
referenceId</entry><entry>Z_ReferenceId</entry><entry>NULL
</entry></row>
<row><entry>
- deleteOperationStatus</entry><entry>int</entry>
+ deleteOperationStatus</entry><entry>Odr_int</entry>
<entry>Z_DeleteStatus_success</entry></row>
<row><entry>
- num_statuses</entry><entry>int</entry><entry>0
+ num_statuses</entry><entry>Odr_int</entry><entry>0
</entry></row>
<row><entry>
deleteListStatuses</entry><entry>Z_ListStatus**</entry><entry>NULL
</entry></row>
<row><entry>
- numberNotDeleted</entry><entry>int</entry><entry>NULL
+ numberNotDeleted</entry><entry>Odr_int</entry><entry>NULL
</entry></row>
<row><entry>
- num_bulkStatuses</entry><entry>int</entry><entry>0
+ num_bulkStatuses</entry><entry>Odr_int</entry><entry>0
</entry></row>
<row><entry>
bulkStatuses</entry><entry>Z_ListStatus</entry><entry>NUL
referenceId</entry><entry>Z_ReferenceId</entry><entry>NULL
</entry></row>
<row><entry>
- num_databaseNames</entry><entry>int</entry><entry>0
+ num_databaseNames</entry><entry>Odr_int</entry><entry>0
</entry></row>
<row><entry>
databaseNames</entry><entry>char**</entry><entry>NULL
termListAndStartPoint</entry><entry>Z_AttributesPlus...
</entry><entry>NULL</entry></row>
<row><entry>
- stepSize</entry><entry>int</entry><entry>NULL
+ stepSize</entry><entry>Odr_int</entry><entry>NULL
</entry></row>
<row><entry>
- numberOfTermsRequested</entry><entry>int</entry><entry>20
+ numberOfTermsRequested</entry><entry>Odr_int</entry><entry>20
</entry></row>
<row><entry>
- preferredPositionInResponse</entry><entry>int</entry><entry>NULL
+ preferredPositionInResponse</entry><entry>Odr_int</entry><entry>NULL
</entry></row>
<row><entry>
otherInfo</entry><entry>Z_OtherInformation</entry><entry>NULL
referenceId</entry><entry>Z_ReferenceId</entry><entry>NULL
</entry></row>
<row><entry>
- stepSize</entry><entry>int</entry><entry>NULL
+ stepSize</entry><entry>Odr_int</entry><entry>NULL
</entry></row>
<row><entry>
- scanStatus</entry><entry>int</entry><entry>Z_Scan_success
+ scanStatus</entry><entry>Odr_int</entry><entry>Z_Scan_success
</entry></row>
<row><entry>
- numberOfEntriesReturned</entry><entry>int</entry><entry>0
+ numberOfEntriesReturned</entry><entry>Odr_int</entry><entry>0
</entry></row>
<row><entry>
- positionOfTerm</entry><entry>int</entry><entry>NULL
+ positionOfTerm</entry><entry>Odr_int</entry><entry>NULL
</entry></row>
<row><entry>
entries</entry><entry>Z_ListEntris</entry><entry>NULL
referenceId</entry><entry>Z_ReferenceId</entry><entry>NULL
</entry></row>
<row><entry>
- requestedAction</entry><entry>int</entry><entry>
+ requestedAction</entry><entry>Odr_int</entry><entry>
Z_TriggerResourceCtrl_resou..
</entry></row>
<row><entry>
prefResourceReportFormat</entry><entry>Odr_oid</entry><entry>NULL
</entry></row>
<row><entry>
- resultSetWanted</entry><entry>bool_t</entry><entry>NULL
+ resultSetWanted</entry><entry>Odr_bool</entry><entry>NULL
</entry></row>
<row><entry>
otherInfo</entry><entry>Z_OtherInformation</entry><entry>NULL
referenceId</entry><entry>Z_ReferenceId</entry><entry>NULL
</entry></row>
<row><entry>
- suspendedFlag</entry><entry>bool_t</entry><entry>NULL
+ suspendedFlag</entry><entry>Odr_bool</entry><entry>NULL
</entry></row>
<row><entry>
resourceReport</entry><entry>Z_External</entry><entry>NULL
</entry></row>
<row><entry>
- partialResultsAvailable</entry><entry>int</entry><entry>NULL
+ partialResultsAvailable</entry><entry>Odr_int</entry><entry>NULL
</entry></row>
<row><entry>
- responseRequired</entry><entry>bool_t</entry><entry>FALSE
+ responseRequired</entry><entry>Odr_bool</entry><entry>FALSE
</entry></row>
<row><entry>
- triggeredRequestFlag</entry><entry>bool_t</entry><entry>NULL
+ triggeredRequestFlag</entry><entry>Odr_bool</entry><entry>NULL
</entry></row>
<row><entry>
otherInfo</entry><entry>Z_OtherInformation</entry><entry>NULL
referenceId</entry><entry>Z_ReferenceId</entry><entry>NULL
</entry></row>
<row><entry>
- numberOfRecordsReturned</entry><entry>int</entry><entry>value=0
+ numberOfRecordsReturned</entry><entry>Odr_int</entry><entry>value=0
</entry></row>
<row><entry>
- num_segmentRecords</entry><entry>int</entry><entry>0
+ num_segmentRecords</entry><entry>Odr_int</entry><entry>0
</entry></row>
<row><entry>
segmentRecords</entry><entry>Z_NamePlusRecord</entry><entry>NULL
referenceId</entry><entry>Z_ReferenceId</entry><entry>NULL
</entry></row>
<row><entry>
- closeReason</entry><entry>int</entry><entry>Z_Close_finished
+ closeReason</entry><entry>Odr_int</entry><entry>Z_Close_finished
</entry></row>
<row><entry>
diagnosticInformation</entry><entry>char*</entry><entry>NULL
<example id="example.odr.encoding.and.decoding.functions">
<title>Encoding and decoding functions</title>
<synopsis>
- int odr_integer(ODR o, int **p, int optional, const char *name);
+ int odr_integer(ODR o, Odr_int **p, int optional, const char *name);
int z_APDU(ODR o, Z_APDU **p, int optional, const char *name);
</synopsis>
void do_nothing_useful(int value)
{
ODR encode, decode;
- int *valp, *resvalp;
+ Odr_int *valp, *resvalp;
char *bufferp;
int len;
printf("decoding went bad\n");
return;
}
- printf("the value is %d\n", *resvalp);
+ /* ODR_INT_PRINTF format for printf (such as %d) */
+ printf("the value is " ODR_INT_PRINTF "\n", *resvalp);
/* clean up */
odr_destroy(encode);
</para>
<synopsis>
- int odr_integer(ODR o, int **p, int optional, const char *name);
+ int odr_integer(ODR o, Odr_int **p, int optional, const char *name);
</synopsis>
<para>
- (we don't allow values that can't be contained in a C integer.)
+ The <literal>Odr_int</literal> is just a simple integer.
</para>
<para>
<sect3 id="odr.boolean"><title>BOOLEAN</title>
<synopsis>
-int odr_bool(ODR o, bool_t **p, int optional, const char *name);
+int odr_bool(ODR o, Odr_bool **p, int optional, const char *name);
</synopsis>
</sect3>
<sect3 id="odr.null"><title>NULL</title>
<synopsis>
-int odr_null(ODR o, bool_t **p, int optional, const char *name);
+int odr_null(ODR o, Odr_null **p, int optional, const char *name);
</synopsis>
<para>
</para>
<screen>
-int myInt(ODR o, int **p, int optional, const char *name)
+int myInt(ODR o, Odr_int **p, int optional, const char *name)
{
return odr_implicit_tag(o, odr_integer, p,
ODR_CONTEXT, 210, optional, name);
<screen>
typedef struct MySequence
{
- int *intval;
- bool_t *boolval;
+ Odr_int *intval;
+ Odr_bool *boolval;
} MySequence;
int mySequence(ODR o, MySequence **p, int optional, const char *name)
typedef struct MyArray
{
int num_elements;
- int **elements;
+ Odr_int **elements;
} MyArray;
</screen>
} which;
union
{
- int *untagged;
- int *tagged;
- bool_t *other;
+ Odr_int *untagged;
+ Odr_int *tagged;
+ Odr_bool *other;
} u;
};
</screen>
bend_request request;
bend_association association;
int *fd;
- odr_int_t hits; /* number of hits */
+ Odr_int hits; /* number of hits */
int errcode; /* 0==OK */
char *errstring; /* system error string or NULL */
Z_OtherInformation *search_info; /* additional search info */
/** \brief Information for scan entry */
struct scan_entry {
char *term; /* the returned scan term */
- odr_int_t occurrences;/* no of occurrences or -1 if error (see below) */
+ Odr_int occurrences;/* no of occurrences or -1 if error (see below) */
int errcode; /* Bib-1 diagnostic code; only used when occur.= -1 */
char *errstring; /* Additional string */
char *display_term;
ODR stream; /* encoding stream - memory source if required */
ODR print; /* printing stream */
- odr_int_t *step_size; /* step size */
- odr_int_t term_position; /* desired index of term in result list/returned */
+ Odr_int *step_size; /* step size */
+ Odr_int term_position; /* desired index of term in result list/returned */
int num_entries; /* number of entries requested/returned */
/* scan term entries. The called handler does not have
int num_setnames;
char **setnames;
Z_ReferenceId *referenceId;
- int delete_status; /* status for the whole operation */
- odr_int_t *statuses; /* status each set - indexed as setnames */
+ int delete_status; /* status for the whole operation */
+ Odr_int *statuses; /* status each set - indexed as setnames */
ODR stream;
ODR print;
} bend_delete_rr;
/** \brief NMEM handle (an opaque pointer to memory) */
typedef struct nmem_control *NMEM;
+/** \brief Set to 1 if YAZ BER integer is 64-bit ; 0 otherwise */
+#define NMEM_64 0
+
+#if NMEM_64
+/** \brief BER/utility integer (64-bit or more) */
+typedef long long int nmem_int_t;
+/** \brief printf format for nmem_int_t type */
+#define NMEM_INT_PRINTF "%lld"
+#else
+/** \brief BER/utility integer (32-bit on most platforms) */
+typedef int nmem_int_t;
+/** \brief printf format for nmem_int_t type */
+#define NMEM_INT_PRINTF "%d"
+#endif
+
+/** \brief BER/utility boolean */
+typedef int nmem_bool_t;
+
/** \brief releases memory associaged with an NMEM handle
\param n NMEM handle
*/
YAZ_EXPORT void nmem_strsplit_blank(NMEM nmem, const char *dstr,
char ***darray, int *num);
-/** \brief allocates integer for NMEM
+/** \brief allocates and sets integer for NMEM
\param nmem NMEM handle
\param v integer value
\returns pointer to created integer
*/
-YAZ_EXPORT int *nmem_intdup(NMEM nmem, int v);
+YAZ_EXPORT nmem_int_t *nmem_intdup(NMEM nmem, nmem_int_t v);
-YAZ_EXPORT long long int *nmem_longintdup(NMEM nmem, long long int v);
+/** \brief allocates and sets boolean for NMEM
+ \param nmem NMEM handle
+ \param v value (0=false, != 0 true)
+ \returns pointer to created boolean
+*/
+YAZ_EXPORT nmem_bool_t *nmem_booldup(NMEM nmem, nmem_bool_t v);
/** \brief transfers memory from one NMEM handle to another
\param src source NMEM handle
YAZ_BEGIN_CDECL
-#define ODR_INT_PRINTF "%lld"
-
-typedef long long int odr_int_t;
-typedef int odr_bool_t;
+typedef nmem_int_t Odr_int;
+typedef nmem_bool_t Odr_bool;
+#define ODR_INT_PRINTF NMEM_INT_PRINTF
#ifndef bool_t
#define bool_t int
YAZ_EXPORT char *odr_strdup(ODR o, const char *str);
YAZ_EXPORT char *odr_strdupn(ODR o, const char *str, size_t n);
YAZ_EXPORT char *odr_strdup_null(ODR o, const char *str);
-YAZ_EXPORT odr_int_t *odr_intdup(ODR o, odr_int_t v);
-YAZ_EXPORT odr_bool_t *odr_booldup(ODR o, odr_bool_t v);
+YAZ_EXPORT Odr_int *odr_intdup(ODR o, Odr_int v);
+YAZ_EXPORT Odr_bool *odr_booldup(ODR o, Odr_bool v);
YAZ_EXPORT Odr_oct *odr_create_Odr_oct(ODR o, const unsigned char *buf,
int sz);
YAZ_EXPORT NMEM odr_extract_mem(ODR o);
YAZ_EXPORT int ber_enctag(ODR o, int zclass, int tag, int constructed);
YAZ_EXPORT int ber_dectag(const unsigned char *buf, int *zclass,
int *tag, int *constructed, int max);
-YAZ_EXPORT int odr_bool(ODR o, int **p, int opt, const char *name);
-YAZ_EXPORT int odr_integer(ODR o, odr_int_t **p, int opt, const char *name);
-YAZ_EXPORT int odr_enum(ODR o, odr_int_t **p, int opt, const char *name);
+YAZ_EXPORT int odr_bool(ODR o, Odr_bool **p, int opt, const char *name);
+YAZ_EXPORT int odr_integer(ODR o, Odr_int **p, int opt, const char *name);
+YAZ_EXPORT int odr_enum(ODR o, Odr_int **p, int opt, const char *name);
YAZ_EXPORT int odr_implicit_settag(ODR o, int zclass, int tag);
YAZ_EXPORT int ber_enclen(ODR o, int len, int lenlen, int exact);
YAZ_EXPORT int ber_declen(const unsigned char *buf, int *len, int max);
YAZ_EXPORT void odr_prname(ODR o, const char *name);
YAZ_EXPORT int ber_null(ODR o);
YAZ_EXPORT int odr_null(ODR o, Odr_null **p, int opt, const char *name);
-YAZ_EXPORT int ber_integer(ODR o, odr_int_t *val);
+YAZ_EXPORT int ber_integer(ODR o, Odr_int *val);
YAZ_EXPORT int odr_constructed_begin(ODR o, void *p, int zclass, int tag,
const char *name);
YAZ_EXPORT int odr_constructed_end(ODR o);
typedef struct Odr_external
{
Odr_oid *direct_reference; /* OPTIONAL */
- odr_int_t *indirect_reference; /* OPTIONAL */
+ Odr_int *indirect_reference; /* OPTIONAL */
char *descriptor; /* OPTIONAL */
int which;
#define ODR_EXTERNAL_single 0
struct Z_External
{
Odr_oid *direct_reference;
- odr_int_t *indirect_reference;
+ Odr_int *indirect_reference;
char *descriptor;
int which;
/* Generic types */
#define Z_SRW_recordPacking_URL 2
char *recordData_buf;
int recordData_len;
- odr_int_t *recordPosition;
+ Odr_int *recordPosition;
} Z_SRW_record;
typedef struct {
char *sortKeys;
char *xSortKeys;
} sort;
- odr_int_t *startRecord;
- odr_int_t *maximumRecords;
+ Odr_int *startRecord;
+ Odr_int *maximumRecords;
char *recordSchema;
char *recordPacking;
char *recordXPath;
char *database;
char *stylesheet;
- odr_int_t *resultSetTTL;
+ Odr_int *resultSetTTL;
} Z_SRW_searchRetrieveRequest;
typedef struct {
- odr_int_t *numberOfRecords;
+ Odr_int *numberOfRecords;
char * resultSetId;
- odr_int_t *resultSetIdleTime;
+ Odr_int *resultSetIdleTime;
Z_SRW_record *records;
int num_records;
Z_SRW_diagnostic *diagnostics;
int num_diagnostics;
- odr_int_t *nextRecordPosition;
+ Odr_int *nextRecordPosition;
Z_SRW_extra_record **extra_records; /* of size num_records */
} Z_SRW_searchRetrieveResponse;
char *xcql;
char *pqf;
} scanClause;
- odr_int_t *responsePosition;
- odr_int_t *maximumTerms;
+ Odr_int *responsePosition;
+ Odr_int *maximumTerms;
char *stylesheet;
char *database;
} Z_SRW_scanRequest;
typedef struct {
char *value;
- odr_int_t *numberOfRecords;
+ Odr_int *numberOfRecords;
char *displayTerm;
char *whereInList;
} Z_SRW_scanTerm;
YAZ_EXPORT char *yaz_uri_val(const char *path, const char *name, ODR o);
YAZ_EXPORT void yaz_uri_val_int(const char *path, const char *name,
- ODR o, odr_int_t **intp);
+ ODR o, Odr_int **intp);
YAZ_EXPORT int yaz_srw_decode(Z_HTTP_Request *hreq, Z_SRW_PDU **srw_pdu,
Z_SOAP **soap_package, ODR decode, char **charset);
YAZ_EXPORT int yaz_sru_decode(Z_HTTP_Request *hreq, Z_SRW_PDU **srw_pdu,
#include "odr-priv.h"
-static int ber_encinteger(ODR o, odr_int_t val);
-static int ber_decinteger(const unsigned char *buf, odr_int_t *val, int max);
+static int ber_encinteger(ODR o, Odr_int val);
+static int ber_decinteger(const unsigned char *buf, Odr_int *val, int max);
-int ber_integer(ODR o, odr_int_t *val)
+int ber_integer(ODR o, Odr_int *val)
{
int res;
/*
* Returns: number of bytes written or -1 for error (out of bounds).
*/
-int ber_encinteger(ODR o, odr_int_t val)
+int ber_encinteger(ODR o, Odr_int val)
{
int a, len;
union { int i; unsigned char c[sizeof(int)]; } tmp;
/*
* Returns: Number of bytes read or 0 if no match, -1 if error.
*/
-int ber_decinteger(const unsigned char *buf, odr_int_t *val, int max)
+int ber_decinteger(const unsigned char *buf, Odr_int *val, int max)
{
const unsigned char *b = buf;
unsigned char fill;
wrbuf_puts(type_str, yaz_tok_parse_string(tp));
t = yaz_tok_move(tp);
}
- elem->attributeType = nmem_longintdup(ct->nmem, 0);
+ elem->attributeType = nmem_intdup(ct->nmem, 0);
if (sscanf(wrbuf_cstr(type_str), ODR_INT_PRINTF, elem->attributeType)
!= 1)
{
{
elem->which = Z_AttributeValue_numeric;
elem->value.numeric =
- nmem_longintdup(ct->nmem, atoi(value_str));
+ nmem_intdup(ct->nmem, atoi(value_str));
}
else
{
return r;
}
-odr_int_t *ill_get_int(struct ill_get_ctl *gc, const char *name,
- const char *sub, odr_int_t val)
+Odr_int *ill_get_int(struct ill_get_ctl *gc, const char *name,
+ const char *sub, Odr_int val)
{
ODR o = gc->odr;
char element[128];
return odr_intdup(o, val);
}
-odr_int_t *ill_get_enumerated (struct ill_get_ctl *gc, const char *name,
- const char *sub, odr_int_t val)
+Odr_int *ill_get_enumerated (struct ill_get_ctl *gc, const char *name,
+ const char *sub, Odr_int val)
{
return ill_get_int(gc, name, sub, val);
}
return dst;
}
-long long int *nmem_longintdup(NMEM mem, long long int v)
+nmem_int_t *nmem_intdup(NMEM mem, nmem_int_t v)
{
- long long int *dst = (long long int*) nmem_malloc (mem, sizeof(*dst));
+ nmem_int_t *dst = (nmem_int_t*) nmem_malloc (mem, sizeof(*dst));
*dst = v;
return dst;
}
-int *nmem_intdup(NMEM mem, int v)
+nmem_bool_t *nmem_booldup(NMEM mem, nmem_bool_t v)
{
- int *dst = (int*) nmem_malloc (mem, sizeof(*dst));
+ nmem_bool_t *dst = (nmem_bool_t*) nmem_malloc (mem, sizeof(*dst));
*dst = v;
return dst;
}
* Top level boolean en/decoder.
* Returns 1 on success, 0 on error.
*/
-int odr_bool(ODR o, int **p, int opt, const char *name)
+int odr_bool(ODR o, Odr_int **p, int opt, const char *name)
{
int res, cons = 0;
* Top level enum en/decoder.
* Returns 1 on success, 0 on error.
*/
-int odr_enum(ODR o, odr_int_t **p, int opt, const char *name)
+int odr_enum(ODR o, Odr_int **p, int opt, const char *name)
{
int res, cons = 0;
return 0;
}
if (o->direction == ODR_DECODE)
- *p = (odr_int_t *)odr_malloc(o, sizeof(**p));
+ *p = (Odr_int *)odr_malloc(o, sizeof(**p));
return ber_integer(o, *p);
}
/*
* Top level integer en/decoder.
* Returns 1 on success, 0 on error.
*/
-int odr_integer(ODR o, odr_int_t **p, int opt, const char *name)
+int odr_integer(ODR o, Odr_int **p, int opt, const char *name)
{
int res, cons = 0;
return 0;
}
if (o->direction == ODR_DECODE)
- *p = (odr_int_t *)odr_malloc(o, sizeof(**p));
+ *p = (Odr_int *)odr_malloc(o, sizeof(**p));
return ber_integer(o, *p);
}
/*
return nmem_strdupn(o->mem, str, n);
}
-odr_int_t *odr_intdup(ODR o, odr_int_t v)
+Odr_int *odr_intdup(ODR o, Odr_int v)
{
- return nmem_longintdup(o->mem, v);
+ return nmem_intdup(o->mem, v);
}
-odr_bool_t *odr_booldup(ODR o, odr_bool_t v)
+Odr_bool *odr_booldup(ODR o, Odr_bool v)
{
- return nmem_intdup(o->mem, v);
+ return nmem_booldup(o->mem, v);
}
int odr_total(ODR o)
static Z_RPNStructure *rpn_structure(struct yaz_pqf_parser *li, ODR o,
int num_attr, int max_attr,
- odr_int_t *attr_list, char **attr_clist,
+ Odr_int *attr_list, char **attr_clist,
Odr_oid **attr_set);
static Odr_oid *query_oid_getvalbyname(struct yaz_pqf_parser *li, ODR o)
}
static int p_query_parse_attr(struct yaz_pqf_parser *li, ODR o,
- int num_attr, odr_int_t *attr_list,
+ int num_attr, Odr_int *attr_list,
char **attr_clist, Odr_oid **attr_set)
{
const char *cp;
}
static Z_AttributesPlusTerm *rpn_term(struct yaz_pqf_parser *li, ODR o,
- int num_attr, odr_int_t *attr_list,
+ int num_attr, Odr_int *attr_list,
char **attr_clist, Odr_oid **attr_set)
{
Z_AttributesPlusTerm *zapt;
else
{
int i, k = 0;
- odr_int_t *attr_tmp;
+ Odr_int *attr_tmp;
elements = (Z_AttributeElement**)
odr_malloc (o, num_attr * sizeof(*elements));
- attr_tmp = (odr_int_t *)odr_malloc(o, num_attr * 2 * sizeof(*attr_tmp));
+ attr_tmp = (Odr_int *)odr_malloc(o, num_attr * 2 * sizeof(*attr_tmp));
memcpy(attr_tmp, attr_list, num_attr * 2 * sizeof(*attr_tmp));
for (i = num_attr; --i >= 0; )
{
}
static Z_Operand *rpn_simple(struct yaz_pqf_parser *li, ODR o,
- int num_attr, odr_int_t *attr_list,
+ int num_attr, Odr_int *attr_list,
char **attr_clist,
Odr_oid **attr_set)
{
static Z_Complex *rpn_complex(struct yaz_pqf_parser *li, ODR o,
int num_attr, int max_attr,
- odr_int_t *attr_list, char **attr_clist,
+ Odr_int *attr_list, char **attr_clist,
Odr_oid **attr_set)
{
Z_Complex *zc;
static Z_RPNStructure *rpn_structure(struct yaz_pqf_parser *li, ODR o,
int num_attr, int max_attr,
- odr_int_t *attr_list,
+ Odr_int *attr_list,
char **attr_clist,
Odr_oid **attr_set)
{
Z_RPNQuery *p_query_rpn_mk(ODR o, struct yaz_pqf_parser *li, const char *qbuf)
{
Z_RPNQuery *zq;
- odr_int_t attr_array[1024];
+ Odr_int attr_array[1024];
char *attr_clist[512];
Odr_oid *attr_set[512];
Odr_oid *top_set = 0;
Odr_oid **attributeSetP,
const char *qbuf)
{
- odr_int_t attr_list[1024];
+ Odr_int attr_list[1024];
char *attr_clist[512];
Odr_oid *attr_set[512];
int num_attr = 0;
return zget_surrogateDiagRec(assoc->encode, dbname, error, addinfo);
}
-static Z_Records *pack_records(association *a, char *setname, odr_int_t start,
- odr_int_t *num, Z_RecordComposition *comp,
- odr_int_t *next, odr_int_t *pres,
+static Z_Records *pack_records(association *a, char *setname, Odr_int start,
+ Odr_int *num, Z_RecordComposition *comp,
+ Odr_int *next, Odr_int *pres,
Z_ReferenceId *referenceId,
Odr_oid *oid, int *errcode)
{
Z_APDU *apdu = (Z_APDU *)odr_malloc(assoc->encode, sizeof(*apdu));
Z_SearchResponse *resp = (Z_SearchResponse *)
odr_malloc(assoc->encode, sizeof(*resp));
- odr_int_t *nulint = odr_intdup(assoc->encode, 0);
- odr_int_t *next = odr_intdup(assoc->encode, 0);
- odr_int_t *none = odr_intdup(assoc->encode, Z_SearchResponse_none);
+ Odr_int *nulint = odr_intdup(assoc->encode, 0);
+ Odr_int *next = odr_intdup(assoc->encode, 0);
+ Odr_int *none = odr_intdup(assoc->encode, Z_SearchResponse_none);
int returnedrecs = 0;
apdu->which = Z_APDU_searchResponse;
else
{
bool_t *sr = odr_booldup(assoc->encode, 1);
- odr_int_t *toget = odr_intdup(assoc->encode, 0);
+ Odr_int *toget = odr_intdup(assoc->encode, 0);
Z_RecordComposition comp, *compp = 0;
yaz_log(log_requestdetail, "resultCount: " ODR_INT_PRINTF, bsrt->hits);
if (*toget && !resp->records)
{
- odr_int_t *presst = odr_intdup(assoc->encode, 0);
+ Odr_int *presst = odr_intdup(assoc->encode, 0);
/* Call bend_present if defined */
if (assoc->init->bend_present)
{
Z_PresentRequest *req = reqb->apdu_request->u.presentRequest;
Z_APDU *apdu;
Z_PresentResponse *resp;
- odr_int_t *next;
- odr_int_t *num;
+ Odr_int *next;
+ Odr_int *num;
int errcode = 0;
const char *errstring = 0;
Z_APDU *apdu = (Z_APDU *)odr_malloc(assoc->encode, sizeof(*apdu));
Z_ScanResponse *res = (Z_ScanResponse *)
odr_malloc(assoc->encode, sizeof(*res));
- odr_int_t *scanStatus = odr_intdup(assoc->encode, Z_Scan_failure);
- odr_int_t *numberOfEntriesReturned = odr_intdup(assoc->encode, 0);
+ Odr_int *scanStatus = odr_intdup(assoc->encode, Z_Scan_failure);
+ Odr_int *numberOfEntriesReturned = odr_intdup(assoc->encode, 0);
Z_ListEntries *ents = (Z_ListEntries *)
odr_malloc(assoc->encode, sizeof(*ents));
Z_DiagRecs *diagrecs_p = NULL;
bdrr->statuses = 0;
if (bdrr->num_setnames > 0)
{
- bdrr->statuses = (odr_int_t*)
+ bdrr->statuses = (Odr_int*)
odr_malloc(assoc->encode, sizeof(*bdrr->statuses) *
bdrr->num_setnames);
for (i = 0; i < bdrr->num_setnames; i++)
association_state state;
/* session parameters */
- odr_int_t preferredMessageSize;
- odr_int_t maximumRecordSize;
+ Odr_int preferredMessageSize;
+ Odr_int maximumRecordSize;
int version; /* highest version-bit set (2 or 3) */
unsigned cs_get_mask;
}
static void add_xsd_integer(xmlNodePtr ptr, const char *elem,
- const odr_int_t *val)
+ const Odr_int *val)
{
if (val)
{
}
static int match_xsd_integer(xmlNodePtr ptr, const char *elem, ODR o,
- odr_int_t **val)
+ Odr_int **val)
{
#if CHECK_TYPE
struct _xmlAttr *attr;
}
#endif
-void yaz_uri_val_int(const char *path, const char *name, ODR o, odr_int_t **intp)
+void yaz_uri_val_int(const char *path, const char *name, ODR o, Odr_int **intp)
{
const char *v = yaz_uri_val(path, name, o);
if (v)
#if YAZ_HAVE_XML2
static int yaz_sru_decode_integer(ODR odr, const char *pname,
- const char *valstr, odr_int_t **valp,
+ const char *valstr, Odr_int **valp,
Z_SRW_diagnostic **diag, int *num_diag,
int min_value)
{
}
static void add_val_int(ODR o, char **name, char **value, int *i,
- char *a_name, odr_int_t *val)
+ char *a_name, Odr_int *val)
{
if (val)
{
return odr_booldup(odr, 1);
}
-odr_int_t *intVal(ODR odr, const char *str)
+Odr_int *intVal(ODR odr, const char *str)
{
return odr_intdup(odr, atoi(str));
}
odr_destroy(odr_decode);
}
+/* example from documentation.. 'Using Odr' */
+void do_nothing_useful(int value)
+{
+ ODR encode, decode;
+ Odr_int *valp, *resvalp;
+ char *bufferp;
+ int len;
+
+ /* allocate streams */
+ if (!(encode = odr_createmem(ODR_ENCODE)))
+ return;
+ if (!(decode = odr_createmem(ODR_DECODE)))
+ return;
+
+ valp = &value;
+ if (odr_integer(encode, &valp, 0, 0) == 0)
+ {
+ printf("encoding went bad\n");
+ return;
+ }
+ bufferp = odr_getbuf(encode, &len, 0);
+ printf("length of encoded data is %d\n", len);
+
+ /* now let's decode the thing again */
+ odr_setbuf(decode, bufferp, len, 0);
+ if (odr_integer(decode, &resvalp, 0, 0) == 0)
+ {
+ printf("decoding went bad\n");
+ return;
+ }
+ /* ODR_INT_PRINTF format for printf (such as %d) */
+ printf("the value is " ODR_INT_PRINTF "\n", *resvalp);
+
+ /* clean up */
+ odr_destroy(encode);
+ odr_destroy(decode);
+}
+
int main(int argc, char **argv)
{
YAZ_CHECK_INIT(argc, argv);
}
proc asnBasicINTEGER {} {
- return {odr_integer {odr_int_t}}
+ return {odr_integer {Odr_int}}
}
proc asnBasicENUMERATED {} {
- return {odr_enum {odr_int_t}}
+ return {odr_enum {Odr_int}}
}
proc asnBasicNULL {} {
}
proc asnBasicBOOLEAN {} {
- return {odr_bool {bool_t}}
+ return {odr_bool {Odr_bool}}
}
proc asnBasicOCTET {} {