17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5d67944fbSScott Rotondo  * Common Development and Distribution License (the "License").
6d67944fbSScott Rotondo  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
227c478bd9Sstevel@tonic-gate  *	db_mindex_c.x
237c478bd9Sstevel@tonic-gate  *
24*a87701e9SGary Mills  * Copyright 2015 Gary Mills
25d67944fbSScott Rotondo  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
26a506a34cSth  * Use is subject to license terms.
277c478bd9Sstevel@tonic-gate  */
287c478bd9Sstevel@tonic-gate 
29*a87701e9SGary Mills #if RPC_XDR
30*a87701e9SGary Mills %#include "ldap_xdr.h"
31*a87701e9SGary Mills %#include "nis_clnt.h"
32*a87701e9SGary Mills #endif /* RPC_XDR */
33*a87701e9SGary Mills 
347c478bd9Sstevel@tonic-gate #if RPC_HDR
357c478bd9Sstevel@tonic-gate %#ifndef _DB_MINDEX_H
367c478bd9Sstevel@tonic-gate %#define _DB_MINDEX_H
377c478bd9Sstevel@tonic-gate 
387c478bd9Sstevel@tonic-gate #ifdef USINGC
397c478bd9Sstevel@tonic-gate %#include "db_vers_c.h"
407c478bd9Sstevel@tonic-gate %#include "db_table_c.h"
417c478bd9Sstevel@tonic-gate %#include "db_index_entry_c.h"
427c478bd9Sstevel@tonic-gate %#include "db_index_c.h"
437c478bd9Sstevel@tonic-gate %#include "db_scheme_c.h"
447c478bd9Sstevel@tonic-gate %#include "db_query_c.h"
457c478bd9Sstevel@tonic-gate #else
467c478bd9Sstevel@tonic-gate %#include "db_vers.h"
477c478bd9Sstevel@tonic-gate %#include "db_table.h"
487c478bd9Sstevel@tonic-gate %#include "db_index_entry.h"
497c478bd9Sstevel@tonic-gate %#include "db_index.h"
507c478bd9Sstevel@tonic-gate %#include "db_scheme.h"
517c478bd9Sstevel@tonic-gate %#include "db_query.h"
52a506a34cSth #endif /* USINGC */
537c478bd9Sstevel@tonic-gate %#include "ldap_parse.h"
547c478bd9Sstevel@tonic-gate %#include "nisdb_rw.h"
557c478bd9Sstevel@tonic-gate %#include "ldap_xdr.h"
56a506a34cSth #endif /* RPC_HDR */
577c478bd9Sstevel@tonic-gate 
587c478bd9Sstevel@tonic-gate #if RPC_HDR
597c478bd9Sstevel@tonic-gate %struct db_next_index_desc {
607c478bd9Sstevel@tonic-gate %  entryp location;
617c478bd9Sstevel@tonic-gate %  struct db_next_index_desc *next;
627c478bd9Sstevel@tonic-gate 
637c478bd9Sstevel@tonic-gate #ifndef USINGC
647c478bd9Sstevel@tonic-gate %  db_next_index_desc( entryp loc, struct db_next_index_desc *n )
657c478bd9Sstevel@tonic-gate %    { location = loc; next = n; }
66a506a34cSth #endif /* USINGC */
677c478bd9Sstevel@tonic-gate 
687c478bd9Sstevel@tonic-gate %};
69a506a34cSth #endif /* RPC_HDR */
707c478bd9Sstevel@tonic-gate 
717c478bd9Sstevel@tonic-gate 
727c478bd9Sstevel@tonic-gate #if RPC_HDR || RPC_XDR
737c478bd9Sstevel@tonic-gate #ifdef USINGC
747c478bd9Sstevel@tonic-gate 
757c478bd9Sstevel@tonic-gate struct db_mindex {
767c478bd9Sstevel@tonic-gate   vers rversion;
777c478bd9Sstevel@tonic-gate   db_index indices<>;                /* indices[num_indices] */
787c478bd9Sstevel@tonic-gate   db_table *table;
797c478bd9Sstevel@tonic-gate   db_scheme *scheme;
807c478bd9Sstevel@tonic-gate   __nisdb_ptr_t objPath;
817c478bd9Sstevel@tonic-gate   __nisdb_flag_t noWriteThrough;
827c478bd9Sstevel@tonic-gate   __nisdb_flag_t noLDAPquery;
837c478bd9Sstevel@tonic-gate   __nisdb_flag_t initialLoad;
847c478bd9Sstevel@tonic-gate   __nisdb_ptr_t dbptr;
857c478bd9Sstevel@tonic-gate   __nisdb_rwlock_t mindex_rwlock;
867c478bd9Sstevel@tonic-gate };
877c478bd9Sstevel@tonic-gate typedef struct db_mindex  * db_mindex_p;
887c478bd9Sstevel@tonic-gate 
897c478bd9Sstevel@tonic-gate typedef	string	strP<>;
907c478bd9Sstevel@tonic-gate 
917c478bd9Sstevel@tonic-gate struct xdr_nis_object_s {
927c478bd9Sstevel@tonic-gate 	int		xversion;
937c478bd9Sstevel@tonic-gate 	nis_object	*obj;
947c478bd9Sstevel@tonic-gate 	strP		dirEntry<>;
957c478bd9Sstevel@tonic-gate };
967c478bd9Sstevel@tonic-gate typedef struct xdr_nis_object_s	xdr_nis_object_t;
977c478bd9Sstevel@tonic-gate 
98a506a34cSth #endif /* USINGC */
99a506a34cSth #endif /* RPC_HDR */
1007c478bd9Sstevel@tonic-gate 
1017c478bd9Sstevel@tonic-gate #ifndef USINGC
1027c478bd9Sstevel@tonic-gate #ifdef RPC_HDR
1037c478bd9Sstevel@tonic-gate %
1047c478bd9Sstevel@tonic-gate %struct xdr_nis_object_s {
1057c478bd9Sstevel@tonic-gate %	int				version;
1067c478bd9Sstevel@tonic-gate %	nis_object			*obj;
1077c478bd9Sstevel@tonic-gate %	struct {
1087c478bd9Sstevel@tonic-gate %		uint_t	dirEntry_len;
1097c478bd9Sstevel@tonic-gate %		char	**dirEntry_val;
1107c478bd9Sstevel@tonic-gate %	}				dirEntry;
1117c478bd9Sstevel@tonic-gate %};
1127c478bd9Sstevel@tonic-gate %typedef struct xdr_nis_object_s	xdr_nis_object_t;
1137c478bd9Sstevel@tonic-gate %
1147c478bd9Sstevel@tonic-gate %class db_mindex {
1157c478bd9Sstevel@tonic-gate %  vers rversion;
1167c478bd9Sstevel@tonic-gate %//  int num_indices;
1177c478bd9Sstevel@tonic-gate %//  db_index * indices;                /* indices[num_indices] */
1187c478bd9Sstevel@tonic-gate %  struct {
1197c478bd9Sstevel@tonic-gate %   int indices_len;
1207c478bd9Sstevel@tonic-gate %   db_index *indices_val;
1217c478bd9Sstevel@tonic-gate %  } indices;
1227c478bd9Sstevel@tonic-gate %  db_table *table;
1237c478bd9Sstevel@tonic-gate %  db_scheme *scheme;
1247c478bd9Sstevel@tonic-gate %  __nisdb_ptr_t objPath;
1257c478bd9Sstevel@tonic-gate %  __nisdb_flag_t noWriteThrough;
1267c478bd9Sstevel@tonic-gate %  __nisdb_flag_t noLDAPquery;
1277c478bd9Sstevel@tonic-gate %  __nisdb_flag_t initialLoad;
1287c478bd9Sstevel@tonic-gate %  __nisdb_ptr_t dbptr;
1297c478bd9Sstevel@tonic-gate %  STRUCTRWLOCK(mindex);
1307c478bd9Sstevel@tonic-gate %
1317c478bd9Sstevel@tonic-gate %/* Return a list of index_entries that satsify the given query 'q'.
1327c478bd9Sstevel@tonic-gate %   Return the size of the list in 'count'. Return NULL if list is empty.
1337c478bd9Sstevel@tonic-gate %   Return in 'valid' FALSE if query is not well formed. */
1347c478bd9Sstevel@tonic-gate %  db_index_entry_p satisfy_query(db_query *, long *, bool_t *valid,
1357c478bd9Sstevel@tonic-gate %					bool_t fromLDAP = FALSE);
1367c478bd9Sstevel@tonic-gate %  db_index_entry_p satisfy_query(db_query *, long *, bool_t *valid = NULL);
1377c478bd9Sstevel@tonic-gate %
1387c478bd9Sstevel@tonic-gate %/* Returns a newly db_query containing the index values as
1397c478bd9Sstevel@tonic-gate %   obtained from the given object.  The object itself,
1407c478bd9Sstevel@tonic-gate %   along with information on the scheme given, will determine
1417c478bd9Sstevel@tonic-gate %   which values are extracted from the object and placed into the query.
1427c478bd9Sstevel@tonic-gate %   Returns an empty query if 'obj' is not a valid entry.
1437c478bd9Sstevel@tonic-gate %   Note that space is allocated for the query and the index values
1447c478bd9Sstevel@tonic-gate %   (i.e. do not share pointers with strings in 'obj'.) */
1457c478bd9Sstevel@tonic-gate %  db_query * extract_index_values_from_object( entry_object * );
1467c478bd9Sstevel@tonic-gate %
1477c478bd9Sstevel@tonic-gate %/* Returns a newly created db_query structure containing the index values
1487c478bd9Sstevel@tonic-gate %   as obtained from the record named by 'recnum'.  The record itself, along
1497c478bd9Sstevel@tonic-gate %   with information on the schema definition of this table, will determine
1507c478bd9Sstevel@tonic-gate %   which values are extracted from the record and placed into the result.
1517c478bd9Sstevel@tonic-gate %   Returns NULL if recnum is not a valid entry.
1527c478bd9Sstevel@tonic-gate %   Note that space is allocated for the query and the index values
1537c478bd9Sstevel@tonic-gate %   (i.e. do not share pointers with strings in 'obj'.) */
1547c478bd9Sstevel@tonic-gate %  db_query * extract_index_values_from_record( entryp );
1557c478bd9Sstevel@tonic-gate %
1567c478bd9Sstevel@tonic-gate %/* Returns an array of size 'count' of 'entry_object_p's, pointing to
1577c478bd9Sstevel@tonic-gate %   copies of entry_objects named by the result list of db_index_entries 'res'.
1587c478bd9Sstevel@tonic-gate %*/
1597c478bd9Sstevel@tonic-gate %  entry_object_p * prepare_results( int, db_index_entry_p, db_status* );
1607c478bd9Sstevel@tonic-gate %
1617c478bd9Sstevel@tonic-gate %/* Remove the entry identified by 'recloc' from:
1627c478bd9Sstevel@tonic-gate %   1.  all indices, as obtained by extracting the index values from the entry
1637c478bd9Sstevel@tonic-gate %   2.  table where entry is stored. */
1647c478bd9Sstevel@tonic-gate %  db_status remove_aux( entryp );
1657c478bd9Sstevel@tonic-gate %
1667c478bd9Sstevel@tonic-gate %/*  entry_object * get_record( entryp );*/
1677c478bd9Sstevel@tonic-gate % public:
1687c478bd9Sstevel@tonic-gate %
1697c478bd9Sstevel@tonic-gate %/* Constructor:  Create empty table (no scheme, no table or indices). */
1707c478bd9Sstevel@tonic-gate %  db_mindex();
1717c478bd9Sstevel@tonic-gate %
1727c478bd9Sstevel@tonic-gate %/* Constructor:  Create new table using scheme defintion supplied.
1737c478bd9Sstevel@tonic-gate %   (Make copy of scheme and keep it with table.) */
1747c478bd9Sstevel@tonic-gate %  db_mindex(db_scheme *, char *tablePath);
1757c478bd9Sstevel@tonic-gate %
1767c478bd9Sstevel@tonic-gate %/* destructor */
1777c478bd9Sstevel@tonic-gate %  ~db_mindex();
1787c478bd9Sstevel@tonic-gate %
1797c478bd9Sstevel@tonic-gate %  db_index_entry_p satisfy_query_dbonly(db_query *, long *,
1807c478bd9Sstevel@tonic-gate %					bool_t checkExpire,
1817c478bd9Sstevel@tonic-gate %					bool_t *valid = NULL);
1827c478bd9Sstevel@tonic-gate %
1837c478bd9Sstevel@tonic-gate %/* Returns whether there table is valid (i.e. has scheme). */
1847c478bd9Sstevel@tonic-gate %  bool_t good() { return scheme != NULL && table != NULL; }
1857c478bd9Sstevel@tonic-gate %
1867c478bd9Sstevel@tonic-gate %/* Change the version of the table to the one given. */
1877c478bd9Sstevel@tonic-gate %  void change_version( vers *v ) {  rversion.assign( v );}
1887c478bd9Sstevel@tonic-gate %
1897c478bd9Sstevel@tonic-gate %/* Return the current version of the table. */
1907c478bd9Sstevel@tonic-gate %  vers *get_version()  { return( &rversion ); }
1917c478bd9Sstevel@tonic-gate %
1927c478bd9Sstevel@tonic-gate %/* Reset contents of tables by: deleting indice entries, table entries */
1937c478bd9Sstevel@tonic-gate %  void reset_tables();
1947c478bd9Sstevel@tonic-gate %
1957c478bd9Sstevel@tonic-gate %/* Reset the table by: deleting all the indices, table of entries, and its
1967c478bd9Sstevel@tonic-gate %   scheme. Reset version to 0 */
1977c478bd9Sstevel@tonic-gate %  void reset();
1987c478bd9Sstevel@tonic-gate %
1997c478bd9Sstevel@tonic-gate %/* Initialize table using information from specified file.
2007c478bd9Sstevel@tonic-gate %   The table is first 'reset', then the attempt to load from the file
2017c478bd9Sstevel@tonic-gate %   is made.  If the load failed, the table is again reset.
2027c478bd9Sstevel@tonic-gate %   Therefore, the table will be modified regardless of the success of the
2037c478bd9Sstevel@tonic-gate %   load.  Returns TRUE if successful, FALSE otherwise. */
2047c478bd9Sstevel@tonic-gate %  int load( char * );
2057c478bd9Sstevel@tonic-gate %
2067c478bd9Sstevel@tonic-gate %/* Initialize table using information given in scheme 'how'.
2077c478bd9Sstevel@tonic-gate %   Record the scheme for later use (make copy of it);
2087c478bd9Sstevel@tonic-gate %   create the required number of indices; and create table for storing
2097c478bd9Sstevel@tonic-gate %   entries.
2107c478bd9Sstevel@tonic-gate %   The 'tablePath' is passed on to db_table in order to obtain the
2117c478bd9Sstevel@tonic-gate %   NIS+/LDAP mapping information (if any). */
2127c478bd9Sstevel@tonic-gate %  void init( db_scheme *);
2137c478bd9Sstevel@tonic-gate %
2147c478bd9Sstevel@tonic-gate %/* Write this structure (table, indices, scheme) into the specified file. */
2157c478bd9Sstevel@tonic-gate %  int dump( char *);
2167c478bd9Sstevel@tonic-gate %
2177c478bd9Sstevel@tonic-gate %/* Removes the entry in the table named by given query 'q'.
2187c478bd9Sstevel@tonic-gate %   If a NULL query is supplied, all entries in table are removed.
2197c478bd9Sstevel@tonic-gate %   Returns DB_NOTFOUND if no entry is found.
2207c478bd9Sstevel@tonic-gate %   Returns DB_SUCCESS if one entry is found; this entry is removed from
2217c478bd9Sstevel@tonic-gate %   its record storage, and it is also removed from all the indices of the
2227c478bd9Sstevel@tonic-gate %   table. If more than one entry satisfying 'q' is found, all are removed. */
2237c478bd9Sstevel@tonic-gate %  db_status remove( db_query *);
2247c478bd9Sstevel@tonic-gate %
2257c478bd9Sstevel@tonic-gate %/* Add copy of given entry to table.  Entry is identified by query 'q'.
2267c478bd9Sstevel@tonic-gate %   The entry (if any) satisfying the query is first deleted, then
2277c478bd9Sstevel@tonic-gate %   added to the indices (using index values extracted form the given entry)
2287c478bd9Sstevel@tonic-gate %   and the table.
2297c478bd9Sstevel@tonic-gate %   Returns DB_NOTUNIQUE if more than one entry satisfies the query.
2307c478bd9Sstevel@tonic-gate %   Returns DB_NOTFOUND if query is not well-formed.
2317c478bd9Sstevel@tonic-gate %   Returns DB_SUCCESS if entry can be added.  */
2327c478bd9Sstevel@tonic-gate %  db_status add( db_query *, entry_object* );
2337c478bd9Sstevel@tonic-gate %
2347c478bd9Sstevel@tonic-gate %
2357c478bd9Sstevel@tonic-gate %/* Finds entry that satisfy the query 'q'.  Returns the answer by
2367c478bd9Sstevel@tonic-gate %   setting the pointer 'rp' to point to the list of answers.
2377c478bd9Sstevel@tonic-gate %   Note that the answers are pointers to copies of the entries.
2387c478bd9Sstevel@tonic-gate %   Returns the number of answers find in 'count'.
2397c478bd9Sstevel@tonic-gate %   Returns DB_SUCCESS if search found at least one answer;
2407c478bd9Sstevel@tonic-gate %   returns DB_NOTFOUND if none is found. */
2417c478bd9Sstevel@tonic-gate %  db_status lookup( db_query *, long *, entry_object_p ** );
2427c478bd9Sstevel@tonic-gate %
2437c478bd9Sstevel@tonic-gate %/* Returns the next entry in the table after 'previous' by setting 'answer' to
2447c478bd9Sstevel@tonic-gate %   point to a copy of the entry_object.  Returns DB_SUCCESS if 'previous'
2457c478bd9Sstevel@tonic-gate %   is valid and next entry is found; DB_NOTFOUND otherwise.  Sets 'where'
2467c478bd9Sstevel@tonic-gate %   to location of where entry is found for input as subsequent 'next'
2477c478bd9Sstevel@tonic-gate %   operation. */
2487c478bd9Sstevel@tonic-gate %  db_status next( entryp, entryp *, entry_object ** );
2497c478bd9Sstevel@tonic-gate %
2507c478bd9Sstevel@tonic-gate %/* Returns the next entry in the table after 'previous' by setting 'answer' to
2517c478bd9Sstevel@tonic-gate %   point to a copy of the entry_object.  Returns DB_SUCCESS if 'previous'
2527c478bd9Sstevel@tonic-gate %   is valid and next entry is found; DB_NOTFOUND otherwise.  Sets 'where'
2537c478bd9Sstevel@tonic-gate %   to location of where entry is found for input as subsequent 'next'
2547c478bd9Sstevel@tonic-gate %   operation. */
2557c478bd9Sstevel@tonic-gate %  db_status next( db_next_index_desc*, db_next_index_desc **, entry_object ** );
2567c478bd9Sstevel@tonic-gate %
2577c478bd9Sstevel@tonic-gate %/* Returns the first entry found in the table by setting 'answer' to
2587c478bd9Sstevel@tonic-gate %   a copy of the entry_object.  Returns DB_SUCCESS if found;
2597c478bd9Sstevel@tonic-gate %   DB_NOTFOUND otherwise.  */
2607c478bd9Sstevel@tonic-gate %  db_status first( entryp*, entry_object ** );
2617c478bd9Sstevel@tonic-gate %
2627c478bd9Sstevel@tonic-gate %/* Returns the first entry that satisfies query by setting 'answer' to
2637c478bd9Sstevel@tonic-gate %   a copy of the entry_object.  Returns DB_SUCCESS if found;
2647c478bd9Sstevel@tonic-gate %   DB_NOTFOUND otherwise.  */
2657c478bd9Sstevel@tonic-gate %  db_status first( db_query *, db_next_index_desc **, entry_object ** );
2667c478bd9Sstevel@tonic-gate %
2677c478bd9Sstevel@tonic-gate % /* Delete the given list of results; used when no longer interested in
2687c478bd9Sstevel@tonic-gate %    the results of the first/next query that returned this list.     */
269d67944fbSScott Rotondo %  db_status reset_next( db_next_index_desc *orig );
2707c478bd9Sstevel@tonic-gate %
2717c478bd9Sstevel@tonic-gate %/* Return all entries within table.  Returns the answer by
2727c478bd9Sstevel@tonic-gate %   setting the pointer 'rp' to point to the list of answers.
2737c478bd9Sstevel@tonic-gate %   Note that the answers are pointers to copies of the entries.
2747c478bd9Sstevel@tonic-gate %   Returns the number of answers find in 'count'.
2757c478bd9Sstevel@tonic-gate %   Returns DB_SUCCESS if search found at least one answer;
2767c478bd9Sstevel@tonic-gate %   returns DB_NOTFOUND if none is found. */
2777c478bd9Sstevel@tonic-gate %  db_status all( long *, entry_object_p ** );
2787c478bd9Sstevel@tonic-gate %
2797c478bd9Sstevel@tonic-gate %  /* for debugging */
2807c478bd9Sstevel@tonic-gate %/* Prints statistics of the table.  This includes the size of the table,
2817c478bd9Sstevel@tonic-gate %   the number of entries, and the index sizes. */
2827c478bd9Sstevel@tonic-gate %  void print_stats();
2837c478bd9Sstevel@tonic-gate %
2847c478bd9Sstevel@tonic-gate %/* Prints statistics about all indices of table. */
2857c478bd9Sstevel@tonic-gate %  void print_all_indices();
2867c478bd9Sstevel@tonic-gate %
2877c478bd9Sstevel@tonic-gate %
2887c478bd9Sstevel@tonic-gate %/* Prints statistics about indices identified by 'n'. */
2897c478bd9Sstevel@tonic-gate %  void print_index( int n );
2907c478bd9Sstevel@tonic-gate %
2917c478bd9Sstevel@tonic-gate %/* Configure LDAP mapping */
2927c478bd9Sstevel@tonic-gate %  bool_t configure (char *objName);
2937c478bd9Sstevel@tonic-gate %
2947c478bd9Sstevel@tonic-gate %/* Mark this instance deferred */
2957c478bd9Sstevel@tonic-gate %  void markDeferred(void) {
2967c478bd9Sstevel@tonic-gate %	if (table != NULL) table->markDeferred();
2977c478bd9Sstevel@tonic-gate %  }
2987c478bd9Sstevel@tonic-gate %/* Remove deferred mark */
2997c478bd9Sstevel@tonic-gate %  void unmarkDeferred(void) {
3007c478bd9Sstevel@tonic-gate %	if (table != NULL) table->unmarkDeferred();
3017c478bd9Sstevel@tonic-gate %  }
3027c478bd9Sstevel@tonic-gate %
3037c478bd9Sstevel@tonic-gate %/* Retrieve, remove, or store data from/in/to LDAP */
3047c478bd9Sstevel@tonic-gate %  int queryLDAP(db_query *, char *, int);
3057c478bd9Sstevel@tonic-gate %  int entriesFromLDAP(__nis_table_mapping_t *, db_query *, db_query *,
3067c478bd9Sstevel@tonic-gate %			char *, nis_object *, int);
3077c478bd9Sstevel@tonic-gate %
3087c478bd9Sstevel@tonic-gate %  int removeLDAP(db_query *, nis_object *o);
3097c478bd9Sstevel@tonic-gate %
3107c478bd9Sstevel@tonic-gate %  int storeObjLDAP(__nis_table_mapping_t *t, nis_object *o);
3117c478bd9Sstevel@tonic-gate %  int storeLDAP(db_query *, entry_obj *, nis_object *, entry_obj *,
3127c478bd9Sstevel@tonic-gate %		char *dbId);
3137c478bd9Sstevel@tonic-gate %
3147c478bd9Sstevel@tonic-gate %/* Set/clear no-write-through flag */
3157c478bd9Sstevel@tonic-gate %  void setNoWriteThrough(void);
3167c478bd9Sstevel@tonic-gate %  void clearNoWriteThrough(void);
3177c478bd9Sstevel@tonic-gate %
3187c478bd9Sstevel@tonic-gate %/* Set/clear no-LDAP-query flag */
3197c478bd9Sstevel@tonic-gate %  void setNoLDAPquery(void);
3207c478bd9Sstevel@tonic-gate %  void clearNoLDAPquery(void);
3217c478bd9Sstevel@tonic-gate %
3227c478bd9Sstevel@tonic-gate %/* Set/clear initialLoad flag */
3237c478bd9Sstevel@tonic-gate %  void setInitialLoad(void);
3247c478bd9Sstevel@tonic-gate %  void clearInitialLoad(void);
3257c478bd9Sstevel@tonic-gate %
3267c478bd9Sstevel@tonic-gate %/* Store/retrieve pointer to parent 'db' class instance */
3277c478bd9Sstevel@tonic-gate %  void setDbPtr(void *ptr);
3287c478bd9Sstevel@tonic-gate %  void *getDbPtr(void);
3297c478bd9Sstevel@tonic-gate %
3307c478bd9Sstevel@tonic-gate %/* Get pointer to private 'table' field */
3317c478bd9Sstevel@tonic-gate %  db_table *getTable(void);
3327c478bd9Sstevel@tonic-gate %
3337c478bd9Sstevel@tonic-gate %/*
3347c478bd9Sstevel@tonic-gate % * Update table entry per the (entry_object *). If 'replace' is set,
3357c478bd9Sstevel@tonic-gate % * the entry is replaced or added; otherwise, it is removed.
3367c478bd9Sstevel@tonic-gate % */
3377c478bd9Sstevel@tonic-gate %  int updateTableEntry(entry_object *e, int replace, char *tableName,
3387c478bd9Sstevel@tonic-gate %			nis_object *obj, nis_object *tobj, uint32_t ttime,
3397c478bd9Sstevel@tonic-gate %			int *xid);
3407c478bd9Sstevel@tonic-gate %
3417c478bd9Sstevel@tonic-gate %/* Touch the indicated entry */
3427c478bd9Sstevel@tonic-gate %  bool_t touchEntry(entry_object *e);
3437c478bd9Sstevel@tonic-gate %  bool_t touchEntry(db_query *q);
3447c478bd9Sstevel@tonic-gate %
3457c478bd9Sstevel@tonic-gate %/* Return the 'scheme' pointer */
3467c478bd9Sstevel@tonic-gate %  db_scheme *getScheme(void) {return (scheme);}
3477c478bd9Sstevel@tonic-gate %
3487c478bd9Sstevel@tonic-gate %/* RW lock functions */
3497c478bd9Sstevel@tonic-gate %
3507c478bd9Sstevel@tonic-gate %  int tryacqexcl(void) {
3517c478bd9Sstevel@tonic-gate %	return (TRYWLOCK(mindex));
3527c478bd9Sstevel@tonic-gate %  }
3537c478bd9Sstevel@tonic-gate %
3547c478bd9Sstevel@tonic-gate %  int acqexcl(void) {
3557c478bd9Sstevel@tonic-gate %	return (WLOCK(mindex));
3567c478bd9Sstevel@tonic-gate %  }
3577c478bd9Sstevel@tonic-gate %
3587c478bd9Sstevel@tonic-gate %  int relexcl(void) {
3597c478bd9Sstevel@tonic-gate %	return (WULOCK(mindex));
3607c478bd9Sstevel@tonic-gate %  }
3617c478bd9Sstevel@tonic-gate %
3627c478bd9Sstevel@tonic-gate %  int acqnonexcl(void) {
3637c478bd9Sstevel@tonic-gate %	return (RLOCK(mindex));
3647c478bd9Sstevel@tonic-gate %  }
3657c478bd9Sstevel@tonic-gate %
3667c478bd9Sstevel@tonic-gate %  int relnonexcl(void) {
3677c478bd9Sstevel@tonic-gate %	return (RULOCK(mindex));
3687c478bd9Sstevel@tonic-gate %  }
3697c478bd9Sstevel@tonic-gate %};
3707c478bd9Sstevel@tonic-gate %#ifdef __cplusplus
3717c478bd9Sstevel@tonic-gate %extern "C" bool_t xdr_db_mindex(XDR*, db_mindex*);
3727c478bd9Sstevel@tonic-gate %#elif __STDC__
3737c478bd9Sstevel@tonic-gate %extern bool_t xdr_db_mindex(XDR*, db_mindex*);
3747c478bd9Sstevel@tonic-gate %#endif
3757c478bd9Sstevel@tonic-gate %typedef class db_mindex * db_mindex_p;
376a506a34cSth #endif /* RPC_HDR */
377a506a34cSth #endif /* USINGC */
3787c478bd9Sstevel@tonic-gate 
3797c478bd9Sstevel@tonic-gate #if RPC_HDR
380a506a34cSth %#endif /* _DB_MINDEX_H */
381a506a34cSth #endif /* RPC_HDR */
382