/* ** %COPYRIGHT_XOPEN_START% ** ** Copyright X/Open Company Limited 1993. All rights reserved ** ** Use of this software by the U.S. Government is subject to restricted rights ** as described in the license. ** ** Portions Copyright Digital Equipment Corporation 1993. All rights reserved ** ** Restricted Rights: Use, duplication, or disclosure by the U.S Government is ** subject to restrictions as set forth in subparagraph (C) (1) (ii) of DFARS ** 252.227-7013, or in FAR 52.227-19, or in FAR 52.227-14 Alt, III, as ** applicable. ** ** Portions of this software is proprietary to and embodies the confidential ** technology of Digital Equipment Corporation. Possession, use, or copying of ** this software and media is authorized only pursuant to a valid written ** license from Digital or an authorized sublicensor. ** ** %COPYRIGHT_XOPEN_END% ** ** ** FACILITY: ** ** Digital X.500 Directory Service ** MAILbus 400 Application Program Interface ** ** XOM.H ** ** ABSTRACT: ** ** This is the header file for the X/Open Object Management API for use ** with the Digital X.500 Directory Service and the MAILbus 400 API. ** ** This version mirrors the X/Open OSI-Abstract-Data Manipulation API ** (XOM) CAE specification dated Nov 91. ** ** It is extended from the standard in the following ways: ** ** it provides support for OID class constants in pre-ANSI compilers by ** using octal initialisation ** ** it contains a set of OMX_* macros for use when dynamically ** initialising descriptors ** */ #ifndef _XOM_H_ #define _XOM_H_ /* XOM.H */ /* BEGIN SERVICE INTERFACE */ /* INTERMEDIATE DATA TYPES */ /* typedef system-defined, e.g., int OM_sint; typedef system-defined, e.g., int OM_sint16; typedef system-defined, e.g., long int OM_sint32; typedef system-defined, e.g., unsigned OM_uint; typedef system-defined, e.g., unsigned OM_uint16; typedef system-defined, e.g., long unsigned OM_uint32; */ typedef int OM_sint; typedef short OM_sint16; #if (defined(__alpha) || defined(__ia64)) typedef int OM_sint32; #else typedef long int OM_sint32; #endif typedef unsigned OM_uint; typedef unsigned short OM_uint16; #if (defined(__alpha) || defined(__ia64)) typedef unsigned OM_uint32; #else typedef long unsigned OM_uint32; #endif /* PRIMARY DATA TYPES */ /* Boolean */ typedef OM_uint32 OM_boolean; /* String Length */ typedef OM_uint32 OM_string_length; /* Enumeration */ typedef OM_sint32 OM_enumeration; /* Exclusions */ typedef OM_uint OM_exclusions; /* Integer */ typedef OM_sint32 OM_integer; /* Modification */ typedef OM_uint OM_modification; /* Object */ typedef struct OM_descriptor_struct *OM_object; /* String */ typedef struct { OM_string_length length; void *elements; } OM_string; #define OM_STRING(string) \ { (OM_string_length)(sizeof(string)-1), (string) } /* Workspace */ typedef void *OM_workspace; /* SECONDARY DATA TYPES */ /* Object Identifier */ typedef OM_string OM_object_identifier; /* Private Object */ typedef OM_object OM_private_object; /* Public Object */ typedef OM_object OM_public_object; /* Return Code */ typedef OM_uint OM_return_code; /* Syntax */ typedef OM_uint16 OM_syntax; /* Type */ typedef OM_uint16 OM_type; /* Type List */ typedef OM_type *OM_type_list; /* Value */ 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; /* Value Length */ typedef OM_uint32 OM_value_length; /* Value Number */ typedef OM_uint32 OM_value_number; /* Value Position */ typedef OM_uint32 OM_value_position; /* TERTIARY DATA TYPES */ /* Descriptor */ typedef struct OM_descriptor_struct { OM_type type; OM_syntax syntax; union OM_value_union value; } OM_descriptor; /* SYMBOLIC CONSTANTS */ /* Boolean */ #define OM_FALSE ( (OM_boolean) 0 ) #define OM_TRUE ( (OM_boolean) 1 ) /* Element Position */ #define OM_LENGTH_UNSPECIFIED ( (OM_string_length) 0xFFFFFFFF ) /* Exclusions */ #define OM_NO_EXCLUSIONS ( (OM_exclusions) 0 ) #define OM_EXCLUDE_ALL_BUT_THESE_TYPES ( (OM_exclusions) 1 ) #define OM_EXCLUDE_ALL_BUT_THESE_VALUES ( (OM_exclusions) 2 ) #define OM_EXCLUDE_MULTIPLES ( (OM_exclusions) 4 ) #define OM_EXCLUDE_SUBOBJECTS ( (OM_exclusions) 8 ) #define OM_EXCLUDE_VALUES ( (OM_exclusions) 16 ) #define OM_EXCLUDE_DESCRIPTORS ( (OM_exclusions) 32 ) /* Modification */ #define OM_INSERT_AT_BEGINNING ( (OM_modification) 1 ) #define OM_INSERT_AT_CERTAIN_POINT ( (OM_modification) 2 ) #define OM_INSERT_AT_END ( (OM_modification) 3 ) #define OM_REPLACE_ALL ( (OM_modification) 4 ) #define OM_REPLACE_CERTAIN_VALUES ( (OM_modification) 5 ) /* Object Identifiers */ /* NOTE: These macros rely on the ## token-pasting operator of ANSI C. * On many pre-ANSI compilers the same effect can be obtained by * replacing ## with the open-comment + close-comment delimiters - * i.e. slash-star-star-slash. * Note that we're not putting the actual characters in here, because comments * within comments are not always a good idea!! */ /* AMJ the token-pasting operator has been replaced for non_ansi C*/ #if defined (__STDC__) || defined (WIN32) || defined (__OS2__) || defined (__cplusplus) /* Private macro to calculate length of an object identifier */ #define OMP_LENGTH(oid_string) (sizeof(OMP_O_##oid_string)-1) /* Macro to initialize the syntax and value of an object identifier */ #define OM_OID_DESC(type, oid_name) \ { (type), OM_S_OBJECT_IDENTIFIER_STRING, \ {{ OMP_LENGTH(oid_name) , OMP_D_##oid_name }} } /* Macro to mark the end of a client-allocated public object */ #define OM_NULL_DESCRIPTOR \ { OM_NO_MORE_TYPES, OM_S_NO_MORE_SYNTAXES, \ {{ 0, OM_ELEMENTS_UNSPECIFIED }} } /* Macro to make class constants available within a compilation unit */ #define OM_IMPORT(class_name) \ extern char OMP_D_##class_name []; \ extern OM_string class_name; /* Macro to allocate memory for class constants within a compilation unit */ #define OM_EXPORT(class_name) \ char OMP_D_##class_name[] = OMP_O_##class_name ; \ OM_string class_name = \ { OMP_LENGTH(class_name), OMP_D_##class_name } ; #else /* Private macro to calculate length of an object identifier */ #define OMP_LENGTH(oid_string) (sizeof(OMP_O_/**/oid_string)-1) /* Macro to initialize the syntax and value of an object identifier */ #define OM_OID_DESC(type, oid_name) \ { (type), OM_S_OBJECT_IDENTIFIER_STRING, \ {{ OMP_LENGTH(oid_name) , OMP_D_/**/oid_name }} } /* Macro to mark the end of a client-allocated public object */ #define OM_NULL_DESCRIPTOR \ { OM_NO_MORE_TYPES, OM_S_NO_MORE_SYNTAXES, \ {{ 0, OM_ELEMENTS_UNSPECIFIED }} } /* Macro to make class constants available within a compilation unit */ #define OM_IMPORT(class_name) \ extern char OMP_D_/**/class_name []; \ extern OM_string class_name; /* Macro to allocate memory for class constants within a compilation unit */ #define OM_EXPORT(class_name) \ char OMP_D_/**/class_name[] = OMP_O_/**/class_name ; \ OM_string class_name = \ { OMP_LENGTH(class_name), (void *)OMP_D_/**/class_name } ; #endif /* These macros ease the dynamic creation of public objects. */ /* This macro sets an OID class descriptor */ #define OMX_CLASS_DESC(desc,oidstr) { desc.type = OM_CLASS; \ desc.syntax = OM_S_OBJECT_IDENTIFIER_STRING; \ desc.value.string = oidstr; } /* This macro sets a boolean value descriptor for the given type */ #define OMX_BOOLEAN_DESC(desc,type_name,bool) { desc.type = type_name; \ desc.syntax = OM_S_BOOLEAN; \ desc.value.boolean = bool; } /* This macro sets an enumerated value descriptor for the given type */ #define OMX_ENUM_DESC(desc,type_name,enum) { desc.type = type_name; \ desc.syntax = OM_S_ENUMERATION; \ desc.value.enumeration = enum; } /* This macro sets an integer value descriptor for the given type */ #define OMX_INTEGER_DESC(desc,type_name,integr) { desc.type = type_name; \ desc.syntax = OM_S_INTEGER; \ desc.value.integer = integr; } /* This macro sets a sub-object descriptor for the given type */ #define OMX_OBJECT_DESC(desc,type_name,obj) { desc.type = type_name; \ desc.syntax = OM_S_OBJECT; \ desc.value.object.object = obj; } /* This macro sets the null descriptor */ #define OMX_OM_NULL_DESC(desc) { desc.type = OM_NO_MORE_TYPES; \ desc.syntax = OM_S_NO_MORE_SYNTAXES; \ desc.value.string.length = 0; \ desc.value.string.elements = OM_ELEMENTS_UNSPECIFIED; } /* This macro sets an attribute type descriptor using the given OID string */ #define OMX_ATTR_TYPE_DESC(desc, ds_type, oidstr) { desc.type = ds_type; \ desc.syntax = OM_S_OBJECT_IDENTIFIER_STRING; \ desc.value.string = oidstr; } /* This macro sets a string descriptor given a null (zero) terminated string using the given type name */ #define OMX_ZSTRING_DESC(desc,syntx,type_name,str) { desc.type = type_name; \ desc.syntax = syntx; \ desc.value.string.elements = (void *)str; \ desc.value.string.length = strlen(str); } /* This macro sets a string descriptor given the length and elements pointer and using the given type name */ #define OMX_STRING_DESC(desc,syntx,type_name,str,len) { desc.type = type_name;\ desc.syntax = syntx; \ desc.value.string.elements = (void *)str; \ desc.value.string.length = len; } /* Example: Header files: #include #include #include Declarations: OM_EXPORT(DS_A_SURNAME) OM_EXPORT(DS_A_TITLE) OM_descriptor cpub_eis[5]; Assignment: OMX_CLASS_DESC( cpub_eis[0], DS_C_ENTRY_INFO_SELECTION); OMX_ATTR_TYPE_DESC( cpub_eis[1], DS_ATTRIBUTES_SELECTED,DS_A_SURNAME); OMX_ATTR_TYPE_DESC( cpub_eis[2], DS_ATTRIBUTES_SELECTED,DS_A_TITLE); OMX_ENUM_DESC( cpub_eis[3], DS_INFO_TYPE, DS_TYPES_ONLY); OMX_OM_NULL_DESC( cpub_eis[4]); */ /* Constant for the OM package */ #ifdef __STDC__ #define OMP_O_OM_OM "\x56\x06\x01\x02\x04" #else #define OMP_O_OM_OM "\126\6\1\2\4" #endif /* Constant for the Encoding class */ #ifdef __STDC__ #define OMP_O_OM_C_ENCODING "\x56\x06\x01\x02\x04\x01" #else #define OMP_O_OM_C_ENCODING "\126\6\1\2\4\1" #endif /* Constant for the External class */ #ifdef __STDC__ #define OMP_O_OM_C_EXTERNAL "\x56\x06\x01\x02\x04\x02" #else #define OMP_O_OM_C_EXTERNAL "\126\6\1\2\4\2" #endif /* Constant for the Object class */ #ifdef __STDC__ #define OMP_O_OM_C_OBJECT "\x56\x06\x01\x02\x04\x03" #else #define OMP_O_OM_C_OBJECT "\126\6\1\2\4\3" #endif /* Constant for the BER Object Identifier */ #ifdef __STDC__ #define OMP_O_OM_BER "\x51\x01" #else #define OMP_O_OM_BER "\121\1" #endif /* Constant for the Canonical-BER Object Identifier */ #ifdef __STDC__ #define OMP_O_OM_CANONICAL_BER "\x56\x06\x01\x02\x04\x04" #else #define OMP_O_OM_CANONICAL_BER "\126\6\1\2\4\4" #endif /* Return Code */ #define OM_SUCCESS ( (OM_return_code) 0 ) #define OM_ENCODING_INVALID ( (OM_return_code) 1 ) #define OM_FUNCTION_DECLINED ( (OM_return_code) 2 ) #define OM_FUNCTION_INTERRUPTED ( (OM_return_code) 3 ) #define OM_MEMORY_INSUFFICIENT ( (OM_return_code) 4 ) #define OM_NETWORK_ERROR ( (OM_return_code) 5 ) #define OM_NO_SUCH_CLASS ( (OM_return_code) 6 ) #define OM_NO_SUCH_EXCLUSION ( (OM_return_code) 7 ) #define OM_NO_SUCH_MODIFICATION ( (OM_return_code) 8 ) #define OM_NO_SUCH_OBJECT ( (OM_return_code) 9 ) #define OM_NO_SUCH_RULES ( (OM_return_code) 10 ) #define OM_NO_SUCH_SYNTAX ( (OM_return_code) 11 ) #define OM_NO_SUCH_TYPE ( (OM_return_code) 12 ) #define OM_NO_SUCH_WORKSPACE ( (OM_return_code) 13 ) #define OM_NOT_AN_ENCODING ( (OM_return_code) 14 ) #define OM_NOT_CONCRETE ( (OM_return_code) 15 ) #define OM_NOT_PRESENT ( (OM_return_code) 16 ) #define OM_NOT_PRIVATE ( (OM_return_code) 17 ) #define OM_NOT_THE_SERVICES ( (OM_return_code) 18 ) #define OM_PERMANENT_ERROR ( (OM_return_code) 19 ) #define OM_POINTER_INVALID ( (OM_return_code) 20 ) #define OM_SYSTEM_ERROR ( (OM_return_code) 21 ) #define OM_TEMPORARY_ERROR ( (OM_return_code) 22 ) #define OM_TOO_MANY_VALUES ( (OM_return_code) 23 ) #define OM_VALUES_NOT_ADJACENT ( (OM_return_code) 24 ) #define OM_WRONG_VALUE_LENGTH ( (OM_return_code) 25 ) #define OM_WRONG_VALUE_MAKEUP ( (OM_return_code) 26 ) #define OM_WRONG_VALUE_NUMBER ( (OM_return_code) 27 ) #define OM_WRONG_VALUE_POSITION ( (OM_return_code) 28 ) #define OM_WRONG_VALUE_SYNTAX ( (OM_return_code) 29 ) #define OM_WRONG_VALUE_TYPE ( (OM_return_code) 30 ) /* String (Elements component) */ #define OM_ELEMENTS_UNSPECIFIED ( (void *) 0 ) /* Syntax */ #define OM_S_NO_MORE_SYNTAXES ( (OM_syntax) 0 ) #define OM_S_BIT_STRING ( (OM_syntax) 3 ) #define OM_S_BOOLEAN ( (OM_syntax) 1 ) #define OM_S_ENCODING_STRING ( (OM_syntax) 8 ) #define OM_S_ENUMERATION ( (OM_syntax) 10 ) #define OM_S_GENERAL_STRING ( (OM_syntax) 27 ) #define OM_S_GENERALISED_TIME_STRING ( (OM_syntax) 24 ) #define OM_S_GENERALIZED_TIME_STRING OM_S_GENERALISED_TIME_STRING #define OM_S_GRAPHIC_STRING ( (OM_syntax) 25 ) #define OM_S_IA5_STRING ( (OM_syntax) 22 ) #define OM_S_INTEGER ( (OM_syntax) 2 ) #define OM_S_NULL ( (OM_syntax) 5 ) #define OM_S_NUMERIC_STRING ( (OM_syntax) 18 ) #define OM_S_OBJECT ( (OM_syntax) 127 ) #define OM_S_OBJECT_DESCRIPTOR_STRING ( (OM_syntax) 7 ) #define OM_S_OBJECT_IDENTIFIER_STRING ( (OM_syntax) 6 ) #define OM_S_OCTET_STRING ( (OM_syntax) 4 ) #define OM_S_PRINTABLE_STRING ( (OM_syntax) 19 ) #define OM_S_TELETEX_STRING ( (OM_syntax) 20 ) #define OM_S_UTC_TIME_STRING ( (OM_syntax) 23 ) #define OM_S_VIDEOTEX_STRING ( (OM_syntax) 21 ) #define OM_S_VISIBLE_STRING ( (OM_syntax) 26 ) #define OM_S_LONG_STRING ((OM_syntax) 0x8000) #define OM_S_NO_VALUE ((OM_syntax) 0x4000) #define OM_S_LOCAL_STRING ((OM_syntax) 0x2000) #define OM_S_SERVICE_GENERATED ((OM_syntax) 0x1000) #define OM_S_PRIVATE ((OM_syntax) 0x0800) #define OM_S_SYNTAX ((OM_syntax) 0x03FF) /* Type */ #define OM_NO_MORE_TYPES ( (OM_type) 0 ) #define OM_ARBITRARY_ENCODING ( (OM_type) 1 ) #define OM_ASN1_ENCODING ( (OM_type) 2 ) #define OM_CLASS ( (OM_type) 3 ) #define OM_DATA_VALUE_DESCRIPTOR ( (OM_type) 4 ) #define OM_DIRECT_REFERENCE ( (OM_type) 5 ) #define OM_INDIRECT_REFERENCE ( (OM_type) 6 ) #define OM_OBJECT_CLASS ( (OM_type) 7 ) #define OM_OBJECT_ENCODING ( (OM_type) 8 ) #define OM_OCTET_ALIGNED_ENCODING ( (OM_type) 9 ) #define OM_PRIVATE_OBJECT ( (OM_type) 10 ) #define OM_RULES ( (OM_type) 11 ) /* Value Position */ #define OM_ALL_VALUES ( (OM_value_position) 0xFFFFFFFF ) /* WORKSPACE INTERFACE */ #include /* END SERVICE INTERFACE */ #endif