18. XOM Service Interface

Back to Table of Contents

This chapter describes the following aspects of the XOM service interface:

See Chapter 7 for examples of using the XOM interface.

18.1. Standards Conformance

Back to Table of Contents

The DCE XOM implementation conforms to the following specification:

X/Open CAE Specification, OSI-Abstract-Data Manipulation (XOM) (November 1991)

The following apply to the DCE XOM implementation:

18.2. XOM Data Types

Back to Table of Contents The data types of the XOM service interface are defined in this section and listed in Table 18-1. These data types are repeated in the XOM reference pages (see xom.h(4xom) in the OSF DCE Application Development Reference).

Table 18-1: XOM Service Interface Data Types
Data TypeDescription
OM_booleanType definition for a Boolean data value.
OM_descriptorType definition for describing an attribute type and value.
OM_enumerationType definition for an Enumerated data value.
OM_exclusionsType definition for the exclusions parameter for om_get().
OM_integerType definition for an Integer data value.
OM_modificationType definition for the modification parameter for om_put().
OM_objectType definition for a handle to either a private or a public object.
OM_object_identifierType definition for an Object Identifier data value.
OM_private_objectType definition for a handle to an object in an implementation-defined, or private, representation.
OM_public_objectType definition for a defined representation of an object that can be directly interrogated by a programmer.
OM_return_codeType definition for a value returned from all OM functions, indicating either that the function succeeded or why it failed.
OM_stringType definition for a data value of one of the String syntaxes.
OM_syntaxType definition for identifying a syntax type.
OM_typeType definition for identifying an OM attribute type.
OM_type_listType definition for enumerating a sequence of OM attribute types.
OM_valueType definition for representing any data value.
OM_value_lengthType definition for for indicating the number of bits, octets, or characters in a string.
OM_value_positionType definition for designating a particular location within a String data value.
OM_workspaceType definition for identifying an application-specific API that implements OM, such as directory or message handling.

Some data types are defined in terms of the following intermediate data types, whose precise definitions in C are defined by the system:

Note: The OM_sint and OM_uint data types are defined by the range of integers they must accommodate. As typically declared in the C interface, they are defined by the range of integers permitted by the host machine's word size. The latter range, however, always encompasses the former.

The type definitions for these data types are as follows:

typedef int             OM_sint;
typedef short           OM_sint16;
typedef long int        OM_sint32;
typedef unsigned        OM_uint;
typedef unsigned short  OM_uint16;
typedef long unsigned   OM_uint32;

18.2.1. OM.boolean

The C declaration for an OM_boolean data value is as follows:
typedef OM_uint32 OM_boolean;

A data value of this data type is a Boolean; that is, either FALSE or TRUE.

FALSE (OM_FALSE) is indicated by 0 (zero). TRUE is indicated by any other integer, although the symbolic constant OM_TRUE refers to the integer 1 specifically.

18.2.2. OM.descriptor

The OM_descriptor data type is used to describe an attribute type and value. Its C declaration is as follows: "describing"
typedef struct OM_descriptor_struct
{
   OM_type        type;
   OM_syntax      syntax;
   union  OM_value_union value;
}  OM_descriptor;
Note: Other components are encoded in high bits of the syntax member.

See the OM_value data type in Section 18.2.16 or the xom.h(4xom) reference page in the OSF DCE Application Development Reference for a description of the OM_value_union structure.

A data value of this type is a descriptor, which embodies an attribute value. An array of descriptors can represent all the values of all the attributes of an object, and is the representation called OM_public_object. A descriptor has the following components:

18.2.3. OM.enumeration

The OM_enumeration data type is used to indicate an Enumerated data value. Its C declaration is as follows:

typedef OM_sint32 OM_enumeration;

A data value of this data type is an attribute value whose syntax is OM_S_ENUMERATION.

18.2.4. OM.exclusions

The OM_exclusions data type is used for the exclusions parameter of om_get(). Its C declaration is as follows:
typedef OM_uint OM_exclusions;
A data value of this data type is an unordered set of one or more values, all of which are distinct. Each value indicates an exclusion, as defined by om_get(), and is chosen from the following set:

Alternatively, the single value OM_NO_EXCLUSIONS can be chosen; this selects the entire object.

Each value except OM_NO_EXCLUSIONS is represented by a distinct bit. The presence of the value is represented as 1; its absence is represented as 0 (zero). Thus, multiple exclusions are requested by ORing the values that indicate the individual exclusions.

18.2.5. OM.integer

The OM_integer data type is used to indicate an integer data value. Its C declaration is as follows:
typedef OM_sint32 OM_integer;

A data value of this data type is an attribute value whose syntax is OM_S_INTEGER.

18.2.6. OM.modification

The OM_modification data type is used for the modification parameter of om_put(). Its C declaration is as follows:
typedef OM_uint OM_modification;
A data value of this data type indicates a kind of modification, as defined by om_put(). It is chosen from the following set:

18.2.7. OM_object

The OM_object data type is used as a handle to either a private or a public object. Its C declaration is as follows:
typedef struct OM_descriptor_struct *OM_object;

A data value of this data type represents an object, which can be either public or private. It is an ordered sequence of one or more instances of the OM_descriptor data type. See the OM_private_object and OM_public_object data types for restrictions on that sequence (Sections 18.2.9 and 18.2.10, respectively).

18.2.8. OM.object.identifier

The OM_object_identifier data type is used as an ASN.1 object identifier. Its C declaration is as follows:
typedef OM_string OM_object_identifier;

A data value of this data type contains an octet string that comprises the contents octets of the BER encoding of an ASN.1 object identifier.

18.2.8.1. C Declaration of Object Identifiers

Every application program that uses a class or another object identifier must explicitly import it into every compilation unit (C source module) that uses it. Each such class or object identifier name must be explicitly exported from just one compilation module. Most application programs find it convenient to export all the names they use from the same compilation unit. Exporting and importing is performed by using the following two macros:

Object identifiers are defined in the appropriate header files, with the definition identifier having the prefix OMP_O_ followed by the variable name for the object identifier. The constant itself provides the hexadecimal value of the object identifier string.

18.2.8.2. Use of Object Identifiers in C

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 a parameter to om_instance()
 */
return_code = om_instance(my_object, OM_C_ENCODING,
&boolean_result);
}

18.2.9. OM.private.object

The OM_private_object data type is used as a handle to an object in an implementation-defined or private representation. Its C declaration is as follows:
typedef OM_object OM_private_object;

A data value of this data type is the designator or handle to a private object. It comprises a single descriptor whose type component is OM_PRIVATE_OBJECT and whose syntax and value components are unspecified.

Note: The descriptor's syntax and value components are essential to the service's proper operation with respect to the private object.

18.2.10. OM.public.object

The OM_public_object data type is used to define an object that can be directly accessed by a programmer. Its C declaration is as follows:
typedef OM_object OM_public_object;

A data value of this data type is a public object. It comprises one or more (ususally more) descriptors, all but the last of which represent values of attributes of the object.

The descriptors for the values of a particular attribute with two or more values are adjacent to one another in the sequence. Their order is that of the values they represent. The order of the resulting groups of descriptors is unspecified.

Since the Class attribute specific to the Object class is represented among the descriptors, it must be represented before any other attributes. Regardless of whether or not the Class attribute is present, the syntax field of the first descriptor must have the OM_S_SERVICE_GENERATED bit set or cleared appropriately.

The last descriptor signals the end of the sequence of descriptors. The last descriptor's type component is OM_NO_MORE_TYPES and its syntax component is OM_S_NO_MORE_SYNTAXES. The last descriptor's value component is unspecified.

18.2.11. OM.return.code

The OM_return_code data type is used for a value that is returned from all OM functions, indicating either that the function succeeded or why it failed. Its C declaration is as follows:
typedef OM_uint OM_return_code;

A data value of this data type is the integer in the range 0 to 216 that indicates an outcome of an interface function. It is chosen from the set specified in Section 18.4.

Integers in the narrower range 0 to 215 are used to indicate the return codes they define.

18.2.12. OM.string

The OM_string data type is used for a data value of String syntax. Its C declaration is as follows:
typedef OM_uint32 OM_string_length;
typedef struct {
      OM_string_length length;
      void *elements;
} OM_string;

#define OM_STRING(string)\
      { (OM_string_length)(sizeof(string)-1), (string) }

A data value of this data type is a string; that is, an instance of a String syntax. A string is specified either in terms of its length or whether or not it terminates with NULL. A string has the following components:

Figure 18-1: OM_String Elements
Click Here for Graphic

The service supplies a string value with a specified length. The client can supply a string value to the service in either form, either with a specified length or terminated with NULL.

The characters of a character string are represented as any sequence of octets permitted as the primitive contents octets of the BER encoding of an ASN.1 type value. The ASN.1 type defines the type of character string. A 0 (zero) value character follows the characters of the character string, but is not encompassed by the length component. Thus, depending on the type of character string, the 0 (zero) value character can delimit the characters of the character string.

The OM_STRING macro is provided for creating a data value of this data type, given only the value of its elements component. The macro, however, applies to octet strings and character strings, but not to bit strings.

18.2.13. OM_syntax

The OM_syntax data type is used to identify a syntax type. Its C declaration is as follows:
typedef OM_uint16 OM_syntax;

A data value of this data type is an integer in the range 0 to 29 that indicates an individual syntax or a set of syntaxes taken together.

The data value is chosen from among the following:

Integers in the narrower range 0 to 29 are used to indicate the syntaxes they define. The integers in the range 29 to 210 are reserved for vendor extensions. Wherever possible, the integers used are the same as the corresponding ASN.1 universal class number.

18.2.14. OM_type

The OM_type data type is used to identify an OM attribute type. Its C declaration is as follows:
typedef OM_uint16 OM_type;

A data value of this data type is an integer in the range 0 to 216 that indicates a type in the context of a package. However, the following values in Table 18-2 are assigned meanings by the respective data types.

Table 18-2: Assigning Meanings to Values
ValueData Type
OM_NO_MORE_TYPES@OM_type_list
OM_PRIVATE_OBJECT@OM_private_object

Integers in the narrower range 0 to 215 are used to indicate the types they define.

18.2.15. OM.type.list

The OM_type_list data type is used to enumerate a sequence of OM attribute types. Its C declaration is as follows:

typedef OM_type *OM_type_list;

A data value of this data type is an ordered sequence of zero or more type numbers, each of which is an instance of the OM_type data type.

An additional data value, OM_NO_MORE_TYPES, follows and thus delimits the sequence. The C representation of the sequence is an array.

18.2.16. OM_value

The OM_value data type is used to represent any data value. Its C declaration is as follows:
typedef struct {
      OM_uint32 padding;
      OM_object object;
} OM_padded_object;

typedef union OM_value_union {
      OM_string         string;
      OM_boolean        boolean;
      OM_enumeration    enumeration;
      OM_integer        integer;
      OM_padded_object  object;
} OM_value;
Note: The first type definition (in particular, its padding component) aligns the object component with the elements component of the string component in the second type definition. This facilitates initialization in C.

The identifier OM_value_union is defined for reasons of compilation order. It is used in the definition of the OM_descriptor data type.

A data value of this data type is an attribute value. It has no components if the value's syntax is OM_S_NO_MORE_SYNTAXES or OM_S_NO_VALUE. Otherwise, it has one of the following components:

Note: A data value of this data type is only displayed as a component of a descriptor. Thus, it is always accompanied by indicators of the value's syntax. The latter indicator reveals which component is present.

18.2.17. OM.value.length

The OM_value_length data type is used to indicate the number of bits, octets, or characters in a string. Its C declaration is as follows:
typedef OM_uint32 OM_value_length;

A data value of this data type is an integer in the range 0 to 232 that represents the number of bits in a bit string, octets in an octet string, or characters in a character string.

Note: This data type is not used in the definition of the interface. It is provided for use by client programmers for defining attribute constraints.

18.2.18. OM.value.position

The OM_value_position data type is used to indicate an attribute value's position within an attribute. Its C declaration is as follows:
typedef OM_uint32 OM_value_position;

A data value of this data type is an integer in the range 0 to 232-1 that indicates the position of a value within an attribute. However, the value OM_ALL_VALUES has the meaning assigned to it by om_get().

18.2.19. OM.workspace

The OM_workspace data type is used to identify an application-specific API that implements OM; for example, directory or message handling. Its C declaration is as follows:

typedef void *OM_workspace;

A data value of this data type is the designator or handle for a workspace.

18.3. XOM Functions

Back to Table of Contents This section provides an overview of the XOM service interface functions as listed in Table 18-3. For a full description of these functions, see the corresponding reference pages (3xom).

Table 18-3: XOM Service Interface Functions
FunctionDescription
om_copy()Copies a private object.
om_copy_value()Copies a string between private objects.
om_create()Creates a private object.
om_decode<()Not supported by the DCE XOM interface; it returns an OM_FUNCTION_DECLINED error.
om_delete()Deletes a private or service-generated object.
om_encode()Not supported by the DCE XOM interface; it returns an OM_FUNCTION_DECLINED error.
om_get()Gets copies of attribute values from a private object.
om_instance()Tests an object's class.
om_put()Puts attribute values into a private object.
om_read()Reads a segment of a string in a private object.
om_remove()Removes attribute values from a private object.
om_write()Writes a segment of a string into a private object.

The purpose and range of capabilities of the service interface functions can be summarized as follows:

18.4. XOM Return Codes

Back to Table of Contents This section defines the return codes of the service interface, and thus the exceptions that can prevent the successful completion of an interface function.

Refer to the ERRORS section of the (3xom) references pages for a list of the errors that each function can return. For an explanation of these error codes please refer to the OSF DCE Problem Determination Guide.

The return code values are as follows:


© 1990-1996, Transarc Corporation