/* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ /* bos720 src/bos/usr/include/odmi.h 1.36 */ /* */ /* Licensed Materials - Property of IBM */ /* */ /* COPYRIGHT International Business Machines Corp. 1989,1993 */ /* All Rights Reserved */ /* */ /* US Government Users Restricted Rights - Use, duplication or */ /* disclosure restricted by GSA ADP Schedule Contract with IBM Corp. */ /* */ /* IBM_PROLOG_END_TAG */ /* static char sccsid[] = "@(#)66 1.36 src/bos/usr/include/odmi.h, libodm, bos720 4/14/09 15:54:52"; */ /* * COMPONENT_NAME: LIBODM * * FUNCTIONS: * * ORIGINS: 27 * * -- ( when * combined with the aggregated modules for this product) * OBJECT CODE ONLY SOURCE MATERIALS * * (C) COPYRIGHT International Business Machines Corp. 1989,2009 * All Rights Reserved * US Government Users Restricted Rights - Use, duplication or * disclosure restricted by GSA ADP Schedule Contract with IBM Corp. */ #ifndef _H_ODMI #define _H_ODMI #include #include #include #ifdef __cplusplus extern "C" { #endif #define MAX_ODMI_NAME MAXNAMLEN #define MAX_ODMI_CRIT 256 #define MAX_CLASSES 1024 #define MAX_ODM_PATH PATH_MAX /* For redefining old (now obsolete) names */ #define objlistinfo listinfo #define odmcf_errno odmerrno /* Used with odm_get_obj() */ #define ODM_FIRST 1 /* Get the first object */ #define ODM_NEXT 0 /* Get the next object */ /* Used with odm_lock() */ #define ODM_WAIT -1 /* Wait forevever */ #define ODM_NOWAIT 0 /* Return immediately if lock cannot be granted */ /* The Class structure is the primary means of identifying an ODM class to * the ODM library routines. The Class structure is either generated by * the odmcreate command, in which case it will typically have a name of * form _CLASS, or a pointer to the structure is obtained by the * application calling the odm_mount_class() routine. If using the Class * structure generated by the odmcreate command, the .c file that the command * generates will need to be compiled with the application. * * In any case, the structure is primarily for internal use by the ODM * library. An application must never modify data in this structure. * The only field that has meaning to an application is the "structsize" * value. After calling the odm_mount_class(), odm_open_class, or * odm_open_class_rdonly() routine, the structsize value will indicater * the size, in bytes, of an ODM object as seen by the application. Since * some objects contain pointers, the object size may be different for * 32-bit and 64-bit applications. * * Note - the remaining fields in the Class structure are intended for * internal ODM library use only. Any use of these fields by an application * may result in compatibility problems with other releases. * */ struct Class { int begin_magic; char *classname; int structsize; int nelem; struct ClassElem *elem; struct StringClxn *clxnp; int open; struct ClassHdr *hdr; char *data; int fd; int current; struct Crit *crit; int ncrit; char critstring[MAX_ODMI_CRIT]; int reserved; int end_magic; }; struct ClassElem { char *elemname; int type; int offset; int size; struct Class *link; /* if link or vlink */ char *col; /* if link or vlink */ int linktype; /* if link or vlink */ char *holder; /* temp storage during change */ int ordinal; /* future use for virtual database */ int reserved; }; struct ClassHdr { int magic; int ndata; int version; /* number of times modified */ }; #define ODMI_MAGIC 0xdcfac /* hex chars from ODmCF_mAgiC */ struct StringClxn { char *clxnname; int open; struct ClassHdr *hdr; char *data; int fd; long reserved[2]; }; #define VCHAR_MAGIC 0xcaa1c /* hex chars from vChAr_mAg1C */ #define MAX_CRITELEM_LEN 1024 struct Crit { char value[MAX_CRITELEM_LEN]; char name[MAX_CRITELEM_LEN]; int relation; int offset; int type; int match; }; /* ODM error numbers */ /* If an error is added, the message files must be updated */ /* (odmmsg.h, libodm.msg) */ #define ODMI_OPEN_ERR 5900 /* Cannot open object class */ #define ODMI_MALLOC_ERR 5901 /* Cannot allocate memory */ #define ODMI_MAGICNO_ERR 5902 /* Invalid file magic number */ #define ODMI_NO_OBJECT 5903 #define ODMI_BAD_CRIT 5904 /* Invalid search criteria */ #define ODMI_INTERNAL_ERR 5905 #define ODMI_TOOMANYCLASSES 5906 /* Accessing too many classes */ #define ODMI_LINK_NOT_FOUND 5907 #define ODMI_INVALID_CLASS 5908 #define ODMI_CLASS_EXISTS 5909 #define ODMI_CLASS_DNE 5910 #define ODMI_BAD_CLASSNAME 5911 #define ODMI_UNLINKCLASS_ERR 5912 #define ODMI_UNLINKCLXN_ERR 5913 #define ODMI_INVALID_CLXN 5914 #define ODMI_CLXNMAGICNO_ERR 5915 #define ODMI_BAD_CLXNNAME 5916 #define ODMI_CLASS_PERMS 5917 /* PERMISSIONS DON'T ALLOW OPEN */ #define ODMI_BAD_TIMEOUT 5918 /* INVALID TIMEOUT VALUE */ #define ODMI_BAD_TOKEN 5919 /* UNABLE TO OPEN/CREATE TOKEN */ #define ODMI_LOCK_BLOCKED 5920 /* ANOTHER PROCESS HAS LOCK */ #define ODMI_LOCK_ENV 5921 /* CANNOT GET/SET ENV VARIABLE */ #define ODMI_UNLOCK 5922 /* CANNOT UNLOCK THE TOKEN */ #define ODMI_BAD_LOCK 5923 /* UNABLE TO SET LOCK */ #define ODMI_LOCK_ID 5924 /* INVALID LOCK ID */ #define ODMI_PARAMS 5925 /* INVALID PARAMETERS PASSED IN */ #define ODMI_OPEN_PIPE 5926 /* COULD NOT OPEN CHILD PIPE */ #define ODMI_READ_PIPE 5927 /* COULD NOT READ FROM CHILD PIPE*/ #define ODMI_FORK 5928 /* COULD NOT FORK CHILD PROCESS */ #define ODMI_INVALID_PATH 5929 /* PATH OR FILE IS INVALID */ #define ODMI_READ_ONLY 5930 /* CLASS IS OPENED AS READ-ONLY */ #define ODMI_NO_SPACE 5931 /* FILESYSTEM FULL */ #define ODMI_VERSION_ERROR 5932 /* Invalid object class version */ /* Object Class Collection Errors */ #define VCHAR_OPEN_ERR 5800 #define VCHAR_MAGICNO_ERR 5801 #define VCHAR_CLASS_DNE 5802 #define VCHAR_BADSTRINGADDR 5803 #define VCHAR_CLASS_PERMS 5804 /* This structure used with odm_get_list() and odm_free_list() */ struct listinfo { char classname[MAX_ODMI_NAME]; char crit[MAX_ODMI_CRIT]; int num; int valid; #ifndef __cplusplus struct Class *class; #else struct Class *____class; #endif }; /* This structure used with odm_get_class_info() */ struct odm_classinfo { int total; int active; int version; int data_offset; }; /* ODM TYPES AND OBJECT CLASS RELATIONSHIPS */ #define ODM_CHAR 0 #define ODM_LONGCHAR 1 #define ODM_BINARY 2 #define ODM_SHORT 3 #define ODM_LONG 4 #define ODM_LINK 5 #define ODM_METHOD 6 #define ODM_VCHAR 7 #define ODM_DOUBLE 8 #define ODM_ULONG 9 #define ODM_LONG_LONG 10 #define ODM_ULONG_LONG 11 /* ODM type of 12 is reserved for libodm internal use */ /* FILE FORMATS - these are all obsolete */ #define STANZA 1 #define COLON 2 #define ODM 4 #define DMS 6 #define WHITESPACE 8 #define LINK_INFO_OFFSET 4 /* obsolete */ #define LINK_VAL_OFFSET 8 /* obsolete */ typedef struct Class *CLASS_SYMBOL; /* The class symbol for most */ /* applications will be: */ /* _CLASS */ #if defined(_THREAD_SAFE) || defined(_THREAD_SAFE_ERRNO) /* * Per thread errno is provided by the threads provider. Both the extern int * and the per thread value must be maintained by the threads library. */ /* This is the function prototype for function referenced in odmerrno def. */ extern int (*odmErrno(void)); #define odmerrno (*odmErrno()) #else /* This is the odmerrno declaration for non-threaded use. */ extern int odmerrno; #endif /* _THREAD_SAFE || _THREAD_SAFE_ERRNO */ extern int odm_initialized; extern int odm_read_only; /* Obsolete */ /* libodm function prototypes */ int odm_add_obj(CLASS_SYMBOL,void *); int odm_change_obj(CLASS_SYMBOL,void *); int odm_close_class(CLASS_SYMBOL); int odm_create_class(CLASS_SYMBOL); int odm_free_list(void *, struct listinfo *); void *odm_get_by_id(CLASS_SYMBOL, int, void *); int odm_get_class_info(CLASS_SYMBOL, struct odm_classinfo *); void *odm_get_first(CLASS_SYMBOL, char *, void *); void *odm_get_list(CLASS_SYMBOL, char *, struct listinfo *, int, int); void *odm_get_next(CLASS_SYMBOL, void *); void *odm_get_obj(CLASS_SYMBOL, char *, void *, int); int odm_initialize(void); int odm_lock(char *, int); CLASS_SYMBOL odm_mount_class(char *); int odm_err_msg(int, char **); CLASS_SYMBOL odm_open_class(CLASS_SYMBOL); CLASS_SYMBOL odm_open_class_rdonly(CLASS_SYMBOL); int odm_rm_by_id(CLASS_SYMBOL, long); int odm_rm_class(CLASS_SYMBOL); int odm_rm_obj(CLASS_SYMBOL,char *); int odm_run_method(char *, char*, char **, char **); char *odm_set_path(char *); int odm_set_perms(int); int odm_terminate(void); int odm_unlock(int); #ifdef __cplusplus } #endif #endif /* _H_ODMI */