/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* db_dictionary_c.x
*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
%#pragma ident "%Z%%M% %I% %E% SMI"
#if RPC_HDR
%#ifndef _DB_DICTIONARY_H
%#define _DB_DICTIONARY_H
#ifdef USINGC
%#include "nisdb_rw.h"
%#include "nisdb_ldap.h"
%#include "db_entry_c.h"
%#include "db_scheme_c.h"
%#include "db_vers_c.h"
%#include "ldap_xdr.h"
%typedef void *nullptr;
%typedef u_int db_dict_version;
#else
%#include "nisdb_rw.h"
%#include "nisdb_ldap.h"
%#include "db_entry.h"
%#include "db_scheme.h"
%#include "db.h"
%#include "db_vers.h"
%#include "db_dictlog.h"
%#include "ldap_xdr.h"
#endif /* USINGC */
#endif /* RPC_HDR */
struct db_table_desc {
#ifdef USINGC
#else
#endif /* USINGC */
};
typedef struct db_table_desc * db_table_desc_p;
/* Defining own version of xdr_db_dict_version */
#if RPC_HDR
#ifndef USINGC
typedef u_int db_dict_version;
#endif /* USINGC */
typedef char * db_table_namep;
typedef db_table_namep db_table_names<>;
/* Defining own version of xdr_db_dict_desc */
#ifndef USINGC
struct db_dict_desc {
int count;
};
#else
%struct db_dict_desc {
% struct {
% u_int tables_len;
% } tables;
% int count;
%};
%typedef struct db_dict_desc db_dict_desc;
#endif /* USINGC */
#endif
typedef struct db_dict_desc * db_dict_desc_p;
#if RPC_HDR
struct __nisdb_dictionary_defer_struct {
};
typedef struct __nisdb_dictionary_defer_struct __nisdb_dictionary_defer_t;
#ifdef USINGC
#endif /* USINGC */
#endif
#ifndef USINGC
#ifdef RPC_HDR
% char* filename;
% char* tmpfilename;
% char* logfilename;
% db_dictlog *logfile;
% STRUCTRWLOCK(dict);
%
%/* Dump contents of this dictionary (minus the database representation)
% to its file. Returns 0 if operation succeeds, -1 otherwise. */
% int dump();
%
%/* Delete old log file and descriptor */
% int reset_log();
%
%/* Open log file (and creates descriptor) if it has not been opened */
% int open_log();
%
%/* Incorporate updates in log to dictionary already loaded.
% Does not affect "logfile" */
% int incorporate_log( char * );
%
% /* closes log file if opened */
% int close_log();
%
%/* Log the given action and execute it.
% The minor version of the dictionary is updated after the action has
% been executed and the dictionary is flagged as being changed.
% Return the structure db_result, or NULL if the loggin failed or the
% action is unknown. */
%
% db_table_desc**);
%
% db_dict_desc_p db_copy_dictionary(void);
%
% public:
%/* Constructor: creates an empty, uninitialized dictionary. */
% db_dictionary();
%
%/* Destructor: noop. Use db_shutdown if you really want to clean up. */
% ~db_dictionary() {}
%
%
% db_status massage_dict (char *, char *, char *);
% int change_table_name (db_table_desc *, char *, char *);
%
%/* Real destructor: deletes filename and table descriptors */
% db_status db_shutdown();
%
%/* Initialize dictionary from contents in 'file'.
% If there is already information in this dictionary, it is removed.
% Therefore, regardless of whether the load from the file succeeds,
% the contents of this dictionary will be altered. Returns
% whether table has been initialized successfully. */
%
%/* closes any open log files for all tables in dictionary or 'tab'.
% "tab" is an optional argument.
% */
%
%/* Write out in-memory copy of dictionary to file.
% 1. Update major version.
% 2. Dump contents to temporary file.
% 3. Rename temporary file to real dictionary file.
% 4. Remove log file.
% A checkpoint is done only if it has changed since the previous checkpoint.
% Returns TRUE if checkpoint was successful; FALSE otherwise. */
% db_status checkpoint();
%
%/* Checkpoints table specified by 'tab', or all tables if 'tab' is 0. */
%/* Add table with given name 'tab' and description 'zdesc' to dictionary.
% Returns error code if table already exists, or if no memory can be found
% to store the descriptor, or if dictionary has not been intialized.
% Dictionary is updated to stable store before addition.
% Fatal error occurs if dictionary cannot be saved.
% Returns DB_SUCCESS if dictionary has been updated successfully. */
%
%/* Delete table with given name 'tab' from dictionary.
% Returns error code if table does not exist or if dictionary has not been
% initialized. Dictionary is updated to stable store if deletion is
% successful. Fatal error occurs if dictionary cannot be saved.
% Returns DB_SUCCESS if dictionary has been updated successfully.
% Note that the files associated with the table are also removed. */
%
%
%
%/* Return database structure of table named by 'table_name'.
% If 'where' is set, set it to the table_desc of 'table_name.'
% The database is loaded in from stable store if it has not been loaded.
% If it cannot be loaded, it is initialized using the scheme stored in
% the table_desc. NULL is returned if the initialization fails. */
%
% bool_t searchDeferred);
%
%
%/* Returns db_table_desc of table name 'tab'.
% Use this if you do not want table to be loaded. */
%
%
%/* Translate given nis attribute list to a db_query structure.
% Return FALSE if dictionary has not been initialized, or
% table does not have a scheme (which should be a fatal error?). */
%
%/* Return an array of strings of table names of all tables in dictionary. */
% db_table_names * get_table_names();
%
% void setNoWriteThrough(void);
% void clearNoWriteThrough(void);
%
%/* Locking */
% int acqexcl(void) {
% }
%
% int relexcl(void) {
% }
%
% int acqnonexcl(void) {
% }
%
% int relnonexcl(void) {
% }
%
%/* Set deferred commit mode; intended for replica resync */
%
%/* Commit deferred changes; intended for replica resync */
%
%/* Roll back deferred changes; intended for replica resync */
%};
%#ifdef __STDC__
%#endif
#endif /* RPC_HDR */
#endif /* USINGC */
#if RPC_HDR
%#endif /* _DB_DICTIONARY_H */
#endif /* RPC_HDR */