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