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