|
|
Index Data > YAZ > YAZ User's Guide and Reference > Preparing PDUs A structure representing a complex ASN.1 type doesn't in itself contain the members of that type. Instead, the structure contains pointers to the members of the type. This is necessary, in part, to allow a mechanism for specifying which of the optional structure (SEQUENCE) members are present, and which are not. It follows that you will need to somehow provide space for the individual members of the structure, and set the pointers to refer to the members. The conversion routines don't care how you allocate and maintain your C structures - they just follow the pointers that you provide. Depending on the complexity of your application, and your personal taste, there are at least three different approaches that you may take when you allocate the structures. You can use static or automatic local variables in the function that prepares the PDU. This is a simple approach, and it provides the most efficient form of memory management. While it works well for flat PDUs like the InitReqest, it will generally not be sufficient for say, the generation of an arbitrarily complex RPN query structure.
You can individually create the structure and its members using the
You can use the
You can combine all of the methods described here. This will often be
the most practical approach. For instance, you might use
The Z39.50 ASN.1 module provides an important aid in creating new PDUs. For
each of the PDU types (say, The prototype for the individual PDU types generally look like this:
Z_<type> *zget_<type>(ODR o);
eg.:
Z_InitRequest *zget_InitRequest(ODR o);
The ODR handle should generally be your encoding stream, but it needn't be.
As well as the individual PDU functions, a function
Z_APDU *zget_APDU(ODR o, int which);
The |
|||
|
|
||||
| Copyright Index Data ApS 2008 | ||||