4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
25 * Copyright 2015 Gary Mills
26 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
27 * Use is subject to license terms.
31 %#include "ldap_xdr.h"
39 %#include "db_item_c.h"
40 %#include "db_entry_c.h"
43 %#include "db_entry.h"
46 const DB_KEY_CASE = TA_CASE;
50 %#include "nisdb_rw.h"
52 %/* Positional information of where field starts within record
53 % and its maximum length in terms of bytes. */
55 short int start_column;
59 %/* Description of a key */
62 unsigned long key_flags; /* corresponds to tc_flags in table_col defn */
63 int column_number; /* column within data structure */
64 db_posn_info where; /* where within record entry is 'key' located */
65 short int store_type; /* ISAM or SS ? maybe useless */
68 %/* Description of the data field. */
70 db_posn_info where; /* where within record entry is 'data' located */
71 short int store_type; /* ISAM or SS ? maybe useless */
74 %/* A scheme is a description of the fields of a table. */
76 #if RPC_HDR || RPC_XDR
81 short int max_columns; /* applies to data only ? */
83 __nisdb_rwlock_t scheme_rwlock;
86 typedef struct db_scheme * db_scheme_p;
97 % db_key_desc *keys_val;
99 % short int max_columns; /* applies to data only ? */
101 % STRUCTRWLOCK(scheme);
104 %/* Accessor: return number of keys in scheme. */
105 % int numkeys() { return keys.keys_len; }
107 %/* Accessor: return location of array of key_desc's. */
108 % db_key_desc* keyloc () { return keys.keys_val; }
110 %/* Constructor: create empty scheme */
113 % keys.keys_val = NULL;
114 % (void) __nisdb_rwinit(&scheme_rwlock);
117 %/* Constructor: create new scheme by making copy of 'orig'.
118 % All items within old scheme are also copied (i.e. no shared pointers). */
119 % db_scheme( db_scheme* orig );
121 %/* Constructor: create new sheme by using information in 'zdesc'. */
122 % db_scheme( table_obj * );
124 %/* Destructor: delete all keys associated with scheme and scheme itself. */
127 %/* Free space occupied by columns. */
128 % void clear_columns( int );
130 %/* Predicate: return whether given string is one of the index names
131 % of this scheme. If so, return in 'result' the index's number. */
132 % bool_t find_index( char*, int* );
134 %/* Print out description of table. */
137 %/* Size of the non-MT/LDAP portion of the db_scheme structure */
138 % ulong_t oldstructsize(void) {
139 % return ((ulong_t)&(this->scheme_rwlock) - (ulong_t)this);
142 %/* Locking methods */
144 % int acqexcl(void) {
145 % return (WLOCK(scheme));
148 % int relexcl(void) {
149 % return (WULOCK(scheme));
152 % int acqnonexcl(void) {
153 % return (RLOCK(scheme));
156 % int relnonexcl(void) {
157 % return (RULOCK(scheme));
161 %typedef class db_scheme * db_scheme_p;
166 %#endif /* _DB_SCHEMA_H */