xref: /titanic_44/usr/src/lib/libnisdb/db_log_entry_c.x (revision 4bff34e37def8a90f9194d81bc345c52ba20086a)
1 /*
2  * CDDL HEADER START
3  *
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
7  * with the License.
8  *
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.
13  *
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]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  *	db_log_entry_c.x
24  *
25  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
26  * Use is subject to license terms.
27  */
28 
29 %#pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 #if RPC_HDR
32 %#ifndef _DB_LOG_ENTRY_H
33 %#define _DB_LOG_ENTRY_H
34 
35 %
36 %/* A log entry that describes an action to be performed and its parameters. */
37 %
38 #endif /* RPC_HDR */
39 
40 #if RPC_HDR || RPC_XDR
41 #ifdef USINGC
42 %#include "db_vers_c.h"
43 %#include "db_query_c.h"
44 %#include "db_entry_c.h"
45 #else
46 %#include "db_vers.h"
47 %#include "db_query.h"
48 %#include "db_entry.h"
49 #endif /* USINGC */
50 #endif /* RPC_HDR */
51 
52 #if RPC_HDR || RPC_XDR
53 #ifdef USINGC
54 struct db_log_entry {
55   vers aversion;                    /* version of log entry */
56   db_action action;                 /* action to be invoked */
57   db_query *query;                  /* query supplied with action (if any) */
58   entry_object *object;             /* object involved in action (if any) */
59   struct db_log_entry *next;        /* Used in constructing list */
60   vers bversion;                    /* sanity check */
61 };
62 typedef  struct db_log_entry* db_log_entry_p;
63 #endif /* USINGC */
64 #endif /* RPC_HDR */
65 
66 #ifndef USINGC
67 #ifdef RPC_HDR
68 %class db_log_entry {
69 %  vers aversion;                     /* version of log entry */
70 %  db_action action;                  /* action to be invoked */
71 %  db_query *query;                   /* query supplied with action (if any) */
72 %  entry_object *object;              /* object involved in action (if any) */
73 %  db_log_entry *next;                /* Used in constructing list */
74 %  vers bversion;                     /* sanity check */
75 % public:
76 %
77 %/*Constructor:  Create an empty log entry, with no query and not object */
78 %  db_log_entry() { query = NULL, object = NULL; next = NULL; }
79 %
80 %/*Constructor:  Create a log entry using the given parameters.  Note that
81 %  pointers to db_query and entry_object are simply assigned, not copied. */
82 %  db_log_entry( db_action, vers *, db_query *, entry_object*);
83 %
84 %  ~db_log_entry();
85 %
86 %/* Print to stdout this log entry */
87 %  void print();
88 %
89 %/* Accessor: return version of log entry */
90 %  vers *get_version()  { return( &aversion ); }
91 %
92 %/* Accessor: return pointer to action of log entry */
93 %  db_action get_action()  { return( action ); }
94 %
95 %/* Accessor:  return pointer to query part of log entry */
96 %  db_query *get_query()  { return( query ); }
97 %
98 %/* Predicate:  return whether log entry is complete and not truncated */
99 %  bool_t sane() { return( aversion.equal( &bversion ) ); }
100 %
101 %/* Accessor:  return pointer to copy of object in log entry */
102 %  entry_object *get_object()  { return( object ); }
103 %
104 %/* Accessor:  return pointer to copy of object in log entry */
105 %  db_log_entry * getnextptr()  { return( next ); }
106 %
107 %/* Accessor:  return pointer to copy of object in log entry */
108 %  void setnextptr( db_log_entry *p )  { next = p; }
109 %};
110 %#ifdef __cplusplus
111 %extern "C" bool_t xdr_db_log_entry(XDR*, db_log_entry*);
112 %#elif __STDC__
113 %extern bool_t xdr_db_log_entry(XDR*, db_log_entry*);
114 %#endif
115 %typedef class db_log_entry * db_log_entry_p;
116 #endif /* RPC_HDR */
117 #endif /* USINGC */
118 
119 struct db_log_list {
120   db_log_entry_p list<>;
121 };
122 
123 #if RPC_HDR
124 %#endif /* _DB_LOG_ENTRY_H */
125 #endif /* RPC_HDR */
126