The following macro initializes a descriptor:
OM_OID_DESC(type, OID_name)
It sets the type component to that given, sets the syntax component to OM_S_OBJECT_IDENTIFIER_STRING, and sets the value component to the specified object identifier.
The following macro initializes a descriptor to mark the end of a client-allocated public object:
OM_NULL_DESCRIPTOR
For each class there is a global variable of type OM_STRING with the same name; for example, the External class has a variable called OM_C_EXTERNAL. This is also the case for other object identifiers; for example, the object identifier for BER rules has a variable called OM_BER. This global variable can be supplied as a parameter to functions when required.
This variable is valid only when it is exported by an OM_EXPORT macro and imported by an OM_IMPORT macro in the compilation units that use it. This variable cannot form part of a descriptor, but the value of its length and elements components can be used. The following code fragment provides examples of the use of the macros and constants.
/* Examples of the use of the macros and constants */
#include <xom.h>
OM_IMPORT(OM_C_ENCODING)
OM_IMPORT(OM_CANONICAL_BER)
/* The following sequence must appear in just one compilation
* unit in place of the above:
*
* #include <xom.h>
*
* OM_EXPORT(OM_C_ENCODING)
* OM_EXPORT(OM_CANONICAL_BER)
*/
main( )
{
/* Use #1 - Define a public object of class Encoding
* (Note: xxxx is a Message Handling class which
* can be encoded)
*/
OM_descriptor my_public_object[] = {
OM_OID_DESC(OM_CLASS, OM_C_ENCODING),
OM_OID_DESC(OM_OBJECT_CLASS, MA_C_xxxx),
{ OM_OBJECT_ENCODING, OM_S_ENCODING_STRING, \
some_BER_value },
OM_OID_DESC(OM_RULES, OM_CANONICAL_BER),
OM_NULL_DESCRIPTOR
};
/* Use #2 - Pass class Encoding as parameter to om_instance( )
*/
return_code = om_instance(my_object, OM_C_ENCODING,
&boolean_result);
}