PreviousNext

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:

· length (OM_string_length)

The number of octets by means of which the string is represented, or the OM_LENGTH_UNSPECIFIED value if the string terminates with NULL.

· elements

The string's elements. The bits of a bit string are represented as a sequence of octets. The first octet stores the number of unused bits in the last octet. The bits in the bit string, commencing with the first bit and proceeding to the trailing bit, are placed in bits 7 to 0 of the second octet. These are followed by bits 7 to 0 of the third octet, then by bits 7 to 0 of each octet in turn, followed by as many bits as are required of the final octet, commencing with bit 7.


OM_String Elements

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.