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  *
25a506a34cSth  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
26a506a34cSth  * Use is subject to license terms.
277c478bd9Sstevel@tonic-gate  */
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate #if RPC_HDR
307c478bd9Sstevel@tonic-gate %#ifndef _DB_LOG_ENTRY_H
317c478bd9Sstevel@tonic-gate %#define _DB_LOG_ENTRY_H
327c478bd9Sstevel@tonic-gate 
337c478bd9Sstevel@tonic-gate %
347c478bd9Sstevel@tonic-gate %/* A log entry that describes an action to be performed and its parameters. */
357c478bd9Sstevel@tonic-gate %
36a506a34cSth #endif /* RPC_HDR */
377c478bd9Sstevel@tonic-gate 
387c478bd9Sstevel@tonic-gate #if RPC_HDR || RPC_XDR
397c478bd9Sstevel@tonic-gate #ifdef USINGC
407c478bd9Sstevel@tonic-gate %#include "db_vers_c.h"
417c478bd9Sstevel@tonic-gate %#include "db_query_c.h"
427c478bd9Sstevel@tonic-gate %#include "db_entry_c.h"
437c478bd9Sstevel@tonic-gate #else
447c478bd9Sstevel@tonic-gate %#include "db_vers.h"
457c478bd9Sstevel@tonic-gate %#include "db_query.h"
467c478bd9Sstevel@tonic-gate %#include "db_entry.h"
47a506a34cSth #endif /* USINGC */
48a506a34cSth #endif /* RPC_HDR */
497c478bd9Sstevel@tonic-gate 
507c478bd9Sstevel@tonic-gate #if RPC_HDR || RPC_XDR
517c478bd9Sstevel@tonic-gate #ifdef USINGC
527c478bd9Sstevel@tonic-gate struct db_log_entry {
537c478bd9Sstevel@tonic-gate   vers aversion;                    /* version of log entry */
547c478bd9Sstevel@tonic-gate   db_action action;                 /* action to be invoked */
557c478bd9Sstevel@tonic-gate   db_query *query;                  /* query supplied with action (if any) */
567c478bd9Sstevel@tonic-gate   entry_object *object;             /* object involved in action (if any) */
577c478bd9Sstevel@tonic-gate   struct db_log_entry *next;        /* Used in constructing list */
587c478bd9Sstevel@tonic-gate   vers bversion;                    /* sanity check */
597c478bd9Sstevel@tonic-gate };
607c478bd9Sstevel@tonic-gate typedef  struct db_log_entry* db_log_entry_p;
61a506a34cSth #endif /* USINGC */
62a506a34cSth #endif /* RPC_HDR */
637c478bd9Sstevel@tonic-gate 
647c478bd9Sstevel@tonic-gate #ifndef USINGC
657c478bd9Sstevel@tonic-gate #ifdef RPC_HDR
667c478bd9Sstevel@tonic-gate %class db_log_entry {
677c478bd9Sstevel@tonic-gate %  vers aversion;                     /* version of log entry */
687c478bd9Sstevel@tonic-gate %  db_action action;                  /* action to be invoked */
697c478bd9Sstevel@tonic-gate %  db_query *query;                   /* query supplied with action (if any) */
707c478bd9Sstevel@tonic-gate %  entry_object *object;              /* object involved in action (if any) */
717c478bd9Sstevel@tonic-gate %  db_log_entry *next;                /* Used in constructing list */
727c478bd9Sstevel@tonic-gate %  vers bversion;                     /* sanity check */
737c478bd9Sstevel@tonic-gate % public:
747c478bd9Sstevel@tonic-gate %
757c478bd9Sstevel@tonic-gate %/*Constructor:  Create an empty log entry, with no query and not object */
767c478bd9Sstevel@tonic-gate %  db_log_entry() { query = NULL, object = NULL; next = NULL; }
777c478bd9Sstevel@tonic-gate %
787c478bd9Sstevel@tonic-gate %/*Constructor:  Create a log entry using the given parameters.  Note that
797c478bd9Sstevel@tonic-gate %  pointers to db_query and entry_object are simply assigned, not copied. */
807c478bd9Sstevel@tonic-gate %  db_log_entry( db_action, vers *, db_query *, entry_object*);
817c478bd9Sstevel@tonic-gate %
827c478bd9Sstevel@tonic-gate %  ~db_log_entry();
837c478bd9Sstevel@tonic-gate %
847c478bd9Sstevel@tonic-gate %/* Print to stdout this log entry */
857c478bd9Sstevel@tonic-gate %  void print();
867c478bd9Sstevel@tonic-gate %
877c478bd9Sstevel@tonic-gate %/* Accessor: return version of log entry */
887c478bd9Sstevel@tonic-gate %  vers *get_version()  { return( &aversion ); }
897c478bd9Sstevel@tonic-gate %
907c478bd9Sstevel@tonic-gate %/* Accessor: return pointer to action of log entry */
917c478bd9Sstevel@tonic-gate %  db_action get_action()  { return( action ); }
927c478bd9Sstevel@tonic-gate %
937c478bd9Sstevel@tonic-gate %/* Accessor:  return pointer to query part of log entry */
947c478bd9Sstevel@tonic-gate %  db_query *get_query()  { return( query ); }
957c478bd9Sstevel@tonic-gate %
967c478bd9Sstevel@tonic-gate %/* Predicate:  return whether log entry is complete and not truncated */
977c478bd9Sstevel@tonic-gate %  bool_t sane() { return( aversion.equal( &bversion ) ); }
987c478bd9Sstevel@tonic-gate %
997c478bd9Sstevel@tonic-gate %/* Accessor:  return pointer to copy of object in log entry */
1007c478bd9Sstevel@tonic-gate %  entry_object *get_object()  { return( object ); }
1017c478bd9Sstevel@tonic-gate %
1027c478bd9Sstevel@tonic-gate %/* Accessor:  return pointer to copy of object in log entry */
1037c478bd9Sstevel@tonic-gate %  db_log_entry * getnextptr()  { return( next ); }
1047c478bd9Sstevel@tonic-gate %
1057c478bd9Sstevel@tonic-gate %/* Accessor:  return pointer to copy of object in log entry */
1067c478bd9Sstevel@tonic-gate %  void setnextptr( db_log_entry *p )  { next = p; }
1077c478bd9Sstevel@tonic-gate %};
1087c478bd9Sstevel@tonic-gate %#ifdef __cplusplus
1097c478bd9Sstevel@tonic-gate %extern "C" bool_t xdr_db_log_entry(XDR*, db_log_entry*);
1107c478bd9Sstevel@tonic-gate %#elif __STDC__
1117c478bd9Sstevel@tonic-gate %extern bool_t xdr_db_log_entry(XDR*, db_log_entry*);
1127c478bd9Sstevel@tonic-gate %#endif
1137c478bd9Sstevel@tonic-gate %typedef class db_log_entry * db_log_entry_p;
114a506a34cSth #endif /* RPC_HDR */
115a506a34cSth #endif /* USINGC */
1167c478bd9Sstevel@tonic-gate 
1177c478bd9Sstevel@tonic-gate struct db_log_list {
1187c478bd9Sstevel@tonic-gate   db_log_entry_p list<>;
1197c478bd9Sstevel@tonic-gate };
120*1da57d55SToomas Soome 
1217c478bd9Sstevel@tonic-gate #if RPC_HDR
122a506a34cSth %#endif /* _DB_LOG_ENTRY_H */
123a506a34cSth #endif /* RPC_HDR */
124