/* * Please do not edit this file. * It was generated using rpcgen. */ #ifndef _DB_SCHEME_H_RPCGEN #define _DB_SCHEME_H_RPCGEN #include #ifndef _DB_SCHEMA_H #define _DB_SCHEMA_H #include "db_item.h" #include "db_entry.h" #define DB_KEY_CASE TA_CASE #include "nisdb_rw.h" /* Positional information of where field starts within record and its maximum length in terms of bytes. */ struct db_posn_info { short start_column; short max_len; }; typedef struct db_posn_info db_posn_info; /* Description of a key */ struct db_key_desc { item *key_name; u_long key_flags; int column_number; db_posn_info where; short store_type; }; typedef struct db_key_desc db_key_desc; /* Description of the data field. */ struct db_data_desc { db_posn_info where; short store_type; }; typedef struct db_data_desc db_data_desc; /* A scheme is a description of the fields of a table. */ class db_scheme { protected: struct { int keys_len; db_key_desc *keys_val; } keys; short int max_columns; /* applies to data only ? */ db_data_desc data; STRUCTRWLOCK(scheme); public: /* Accessor: return number of keys in scheme. */ int numkeys() { return keys.keys_len; } /* Accessor: return location of array of key_desc's. */ db_key_desc* keyloc () { return keys.keys_val; } /* Constructor: create empty scheme */ db_scheme() { keys.keys_len = 0; keys.keys_val = NULL; (void) __nisdb_rwinit(&scheme_rwlock); } /* Constructor: create new scheme by making copy of 'orig'. All items within old scheme are also copied (i.e. no shared pointers). */ db_scheme( db_scheme* orig ); /* Constructor: create new sheme by using information in 'zdesc'. */ db_scheme( table_obj * ); /* Destructor: delete all keys associated with scheme and scheme itself. */ ~db_scheme(); /* Free space occupied by columns. */ void clear_columns( int ); /* Predicate: return whether given string is one of the index names of this scheme. If so, return in 'result' the index's number. */ bool_t find_index( char*, int* ); /* Print out description of table. */ void print(); /* Size of the non-MT/LDAP portion of the db_scheme structure */ ulong_t oldstructsize(void) { return ((ulong_t)&(this->scheme_rwlock) - (ulong_t)this); } /* Locking methods */ int acqexcl(void) { return (WLOCK(scheme)); } int relexcl(void) { return (WULOCK(scheme)); } int acqnonexcl(void) { return (RLOCK(scheme)); } int relnonexcl(void) { return (RULOCK(scheme)); } }; typedef class db_scheme * db_scheme_p; #endif /* _DB_SCHEMA_H */ /* the xdr functions */ extern bool_t xdr_db_posn_info(); extern bool_t xdr_db_key_desc(); extern bool_t xdr_db_data_desc(); #endif /* !_DB_SCHEME_H_RPCGEN */