xref: /titanic_52/usr/src/lib/libnisdb/db_log_entry_c.x (revision a506a34ceb0e9dcc6c61bf0560202f8538928650)
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
57c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
67c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
77c478bd9Sstevel@tonic-gate  * with the License.
87c478bd9Sstevel@tonic-gate  *
97c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate  * and limitations under the License.
137c478bd9Sstevel@tonic-gate  *
147c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate  *
207c478bd9Sstevel@tonic-gate  * CDDL HEADER END
217c478bd9Sstevel@tonic-gate  */
227c478bd9Sstevel@tonic-gate /*
237c478bd9Sstevel@tonic-gate  *	db_log_entry_c.x
247c478bd9Sstevel@tonic-gate  *
25*a506a34cSth160488  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
26*a506a34cSth160488  * Use is subject to license terms.
277c478bd9Sstevel@tonic-gate  */
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate %#pragma ident	"%Z%%M%	%I%	%E% SMI"
307c478bd9Sstevel@tonic-gate 
317c478bd9Sstevel@tonic-gate #if RPC_HDR
327c478bd9Sstevel@tonic-gate %#ifndef _DB_LOG_ENTRY_H
337c478bd9Sstevel@tonic-gate %#define _DB_LOG_ENTRY_H
347c478bd9Sstevel@tonic-gate 
357c478bd9Sstevel@tonic-gate %
367c478bd9Sstevel@tonic-gate %/* A log entry that describes an action to be performed and its parameters. */
377c478bd9Sstevel@tonic-gate %
38*a506a34cSth160488 #endif /* RPC_HDR */
397c478bd9Sstevel@tonic-gate 
407c478bd9Sstevel@tonic-gate #if RPC_HDR || RPC_XDR
417c478bd9Sstevel@tonic-gate #ifdef USINGC
427c478bd9Sstevel@tonic-gate %#include "db_vers_c.h"
437c478bd9Sstevel@tonic-gate %#include "db_query_c.h"
447c478bd9Sstevel@tonic-gate %#include "db_entry_c.h"
457c478bd9Sstevel@tonic-gate #else
467c478bd9Sstevel@tonic-gate %#include "db_vers.h"
477c478bd9Sstevel@tonic-gate %#include "db_query.h"
487c478bd9Sstevel@tonic-gate %#include "db_entry.h"
49*a506a34cSth160488 #endif /* USINGC */
50*a506a34cSth160488 #endif /* RPC_HDR */
517c478bd9Sstevel@tonic-gate 
527c478bd9Sstevel@tonic-gate #if RPC_HDR || RPC_XDR
537c478bd9Sstevel@tonic-gate #ifdef USINGC
547c478bd9Sstevel@tonic-gate struct db_log_entry {
557c478bd9Sstevel@tonic-gate   vers aversion;                    /* version of log entry */
567c478bd9Sstevel@tonic-gate   db_action action;                 /* action to be invoked */
577c478bd9Sstevel@tonic-gate   db_query *query;                  /* query supplied with action (if any) */
587c478bd9Sstevel@tonic-gate   entry_object *object;             /* object involved in action (if any) */
597c478bd9Sstevel@tonic-gate   struct db_log_entry *next;        /* Used in constructing list */
607c478bd9Sstevel@tonic-gate   vers bversion;                    /* sanity check */
617c478bd9Sstevel@tonic-gate };
627c478bd9Sstevel@tonic-gate typedef  struct db_log_entry* db_log_entry_p;
63*a506a34cSth160488 #endif /* USINGC */
64*a506a34cSth160488 #endif /* RPC_HDR */
657c478bd9Sstevel@tonic-gate 
667c478bd9Sstevel@tonic-gate #ifndef USINGC
677c478bd9Sstevel@tonic-gate #ifdef RPC_HDR
687c478bd9Sstevel@tonic-gate %class db_log_entry {
697c478bd9Sstevel@tonic-gate %  vers aversion;                     /* version of log entry */
707c478bd9Sstevel@tonic-gate %  db_action action;                  /* action to be invoked */
717c478bd9Sstevel@tonic-gate %  db_query *query;                   /* query supplied with action (if any) */
727c478bd9Sstevel@tonic-gate %  entry_object *object;              /* object involved in action (if any) */
737c478bd9Sstevel@tonic-gate %  db_log_entry *next;                /* Used in constructing list */
747c478bd9Sstevel@tonic-gate %  vers bversion;                     /* sanity check */
757c478bd9Sstevel@tonic-gate % public:
767c478bd9Sstevel@tonic-gate %
777c478bd9Sstevel@tonic-gate %/*Constructor:  Create an empty log entry, with no query and not object */
787c478bd9Sstevel@tonic-gate %  db_log_entry() { query = NULL, object = NULL; next = NULL; }
797c478bd9Sstevel@tonic-gate %
807c478bd9Sstevel@tonic-gate %/*Constructor:  Create a log entry using the given parameters.  Note that
817c478bd9Sstevel@tonic-gate %  pointers to db_query and entry_object are simply assigned, not copied. */
827c478bd9Sstevel@tonic-gate %  db_log_entry( db_action, vers *, db_query *, entry_object*);
837c478bd9Sstevel@tonic-gate %
847c478bd9Sstevel@tonic-gate %  ~db_log_entry();
857c478bd9Sstevel@tonic-gate %
867c478bd9Sstevel@tonic-gate %/* Print to stdout this log entry */
877c478bd9Sstevel@tonic-gate %  void print();
887c478bd9Sstevel@tonic-gate %
897c478bd9Sstevel@tonic-gate %/* Accessor: return version of log entry */
907c478bd9Sstevel@tonic-gate %  vers *get_version()  { return( &aversion ); }
917c478bd9Sstevel@tonic-gate %
927c478bd9Sstevel@tonic-gate %/* Accessor: return pointer to action of log entry */
937c478bd9Sstevel@tonic-gate %  db_action get_action()  { return( action ); }
947c478bd9Sstevel@tonic-gate %
957c478bd9Sstevel@tonic-gate %/* Accessor:  return pointer to query part of log entry */
967c478bd9Sstevel@tonic-gate %  db_query *get_query()  { return( query ); }
977c478bd9Sstevel@tonic-gate %
987c478bd9Sstevel@tonic-gate %/* Predicate:  return whether log entry is complete and not truncated */
997c478bd9Sstevel@tonic-gate %  bool_t sane() { return( aversion.equal( &bversion ) ); }
1007c478bd9Sstevel@tonic-gate %
1017c478bd9Sstevel@tonic-gate %/* Accessor:  return pointer to copy of object in log entry */
1027c478bd9Sstevel@tonic-gate %  entry_object *get_object()  { return( object ); }
1037c478bd9Sstevel@tonic-gate %
1047c478bd9Sstevel@tonic-gate %/* Accessor:  return pointer to copy of object in log entry */
1057c478bd9Sstevel@tonic-gate %  db_log_entry * getnextptr()  { return( next ); }
1067c478bd9Sstevel@tonic-gate %
1077c478bd9Sstevel@tonic-gate %/* Accessor:  return pointer to copy of object in log entry */
1087c478bd9Sstevel@tonic-gate %  void setnextptr( db_log_entry *p )  { next = p; }
1097c478bd9Sstevel@tonic-gate %};
1107c478bd9Sstevel@tonic-gate %#ifdef __cplusplus
1117c478bd9Sstevel@tonic-gate %extern "C" bool_t xdr_db_log_entry(XDR*, db_log_entry*);
1127c478bd9Sstevel@tonic-gate %#elif __STDC__
1137c478bd9Sstevel@tonic-gate %extern bool_t xdr_db_log_entry(XDR*, db_log_entry*);
1147c478bd9Sstevel@tonic-gate %#endif
1157c478bd9Sstevel@tonic-gate %typedef class db_log_entry * db_log_entry_p;
116*a506a34cSth160488 #endif /* RPC_HDR */
117*a506a34cSth160488 #endif /* USINGC */
1187c478bd9Sstevel@tonic-gate 
1197c478bd9Sstevel@tonic-gate struct db_log_list {
1207c478bd9Sstevel@tonic-gate   db_log_entry_p list<>;
1217c478bd9Sstevel@tonic-gate };
1227c478bd9Sstevel@tonic-gate 
1237c478bd9Sstevel@tonic-gate #if RPC_HDR
124*a506a34cSth160488 %#endif /* _DB_LOG_ENTRY_H */
125*a506a34cSth160488 #endif /* RPC_HDR */
126