|
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
">EXTERNAL DataIn order to achieve extensibility and adaptability to different application domains, the new version of the protocol defines many structures outside of the main ASN.1 specification, referencing them through ASN.1 EXTERNAL constructs. To simplify the construction and access to the externally referenced data, the Z39.50 ASN.1 module defines a specialized version of the EXTERNAL construct, called Z_External.It is defined thus:
When decoding, the Z39.50 ASN.1 module will attempt to determine which syntax describes the data by looking at the reference fields (currently only the direct-reference). For ASN.1 structured data, you need only consult the which field to determine the type of data. You can the access the data directly through the union. When constructing data for encoding, you set the union pointer to point to the data, and set the which field accordingly. Remember also to set the direct (or indirect) reference to the correct OID for the data type. For non-ASN.1 data such as MARC records, use the octet_aligned arm of the union. Some servers return ASN.1 structured data values (eg. database records) as BER-encoded records placed in the octet-aligned branch of the EXTERNAL CHOICE. The ASN-module will not automatically decode these records. To help you decode the records in the application, the function
Can be used to retrieve information about the known, external data types. The function return a pointer to a static area, or NULL, if no match for the given direct reference is found. The Z_ext_typeent is defined as:
The what member contains the Z_External union discriminator value for the given type: For the SUTRS record syntax, the value would be Z_External_sutrs. The fun member contains a pointer to the function which encodes/decodes the given type. Again, for the SUTRS record syntax, the value of fun would be z_SUTRS (a function pointer). If you receive an EXTERNAL which contains an octet-string value that you suspect of being an ASN.1-structured data value, you can use z_ext_gettypebyref to look for the provided direct-reference. If the return value is different from NULL, you can use the provided function to decode the BER string (see section Using ODR). If you want to send EXTERNALs containing ASN.1-structured values in the occtet-aligned branch of the CHOICE, this is possible too. However, on the encoding phase, it requires a somewhat involved juggling around of the various buffers involved. If you need to add new, externally defined data types, you must update the struct above, in the source file prt-ext.h, as well as the encoder/decoder in the file prt-ext.c. When changing the latter, remember to update both the arm arrary and the list type_table, which drives the CHOICE biasing that is necessary to tell the different, structured types apart on decoding.
|