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 (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  */
  25 
  26 #ifndef _MLSVC_LOGR_NDL_
  27 #define _MLSVC_LOGR_NDL_
  28 
  29 /*
  30  ***********************************************************************
  31  *
  32  * Event log RPC (EVENTLOG) interface definition.
  33  *
  34  ***********************************************************************
  35  */
  36 
  37 #include "ndrtypes.ndl"
  38 
  39 #define LOGR_OPNUM_EventLogClose                0x02
  40 #define LOGR_OPNUM_EventLogQueryCount           0x04
  41 #define LOGR_OPNUM_EventLogGetOldestRec         0x05
  42 #define LOGR_OPNUM_EventLogOpen                 0x07
  43 #define LOGR_OPNUM_EventLogRead                 0x0A
  44 
  45 #define LOGR_MAXENTRYLEN                        800
  46 
  47 
  48 CONTEXT_HANDLE(logr_handle) logr_handle_t;
  49 
  50 struct logr_string {
  51         WORD    length;
  52         WORD    allosize;
  53         LPTSTR  str;
  54 };
  55 typedef struct logr_string logr_string_t;
  56 
  57 struct logr_record {
  58         DWORD  Length1;
  59         DWORD  Reserved;
  60         DWORD  RecordNumber;
  61         DWORD  TimeGenerated;
  62         DWORD  TimeWritten;
  63         DWORD  EventID;
  64         WORD   EventType;
  65         WORD   NumStrings;
  66         WORD   EventCategory;
  67         WORD   ReservedFlags;
  68         DWORD  ClosingRecordNumber;
  69         DWORD  StringOffset;
  70         DWORD  UserSidLength;
  71         DWORD  UserSidOffset;
  72         DWORD  DataLength;
  73         DWORD  DataOffset;
  74         BYTE   info[LOGR_MAXENTRYLEN];
  75         DWORD  Length2;
  76 };
  77 typedef struct logr_record logr_record_t;
  78 
  79 /*
  80  ***********************************************************************
  81  * LOGR_OPNUM_EventLogClose
  82  ***********************************************************************
  83  */
  84 OPERATION(LOGR_OPNUM_EventLogClose)
  85 struct logr_EventLogClose {
  86         IN      logr_handle_t handle;
  87         OUT     logr_handle_t result_handle;
  88         OUT     DWORD status;
  89 };
  90 
  91 /*
  92  ***********************************************************************
  93  * LOGR_OPNUM_EventLogQueryCount
  94  ***********************************************************************
  95  */
  96 OPERATION(LOGR_OPNUM_EventLogQueryCount)
  97 struct logr_EventLogQueryCount {
  98         IN      logr_handle_t handle;
  99         OUT     DWORD rec_num;
 100         OUT     DWORD status;
 101 };
 102 
 103 /*
 104  ***********************************************************************
 105  * LOGR_OPNUM_EventLogGetOldestRec
 106  ***********************************************************************
 107  */
 108 OPERATION(LOGR_OPNUM_EventLogGetOldestRec)
 109 struct logr_EventLogGetOldestRec {
 110         IN      logr_handle_t handle;
 111         OUT     DWORD oldest_rec;
 112         OUT     DWORD status;
 113 };
 114 
 115 /*
 116  ***********************************************************************
 117  * LOGR_OPNUM_EventLogOpen
 118  ***********************************************************************
 119  */
 120 OPERATION(LOGR_OPNUM_EventLogOpen)
 121 struct logr_EventLogOpen {
 122         IN      DWORD *server_name;
 123         IN      logr_string_t log_name;
 124         IN      DWORD reg_module_name;
 125         IN      DWORD major_version;
 126         IN      DWORD minor_version;
 127         OUT     logr_handle_t handle;
 128         OUT     DWORD status;
 129 };
 130 
 131 OPERATION(LOGR_OPNUM_EventLogRead)
 132 struct logr_EventLogRead {
 133         IN      logr_handle_t handle;
 134         IN      DWORD read_flags;
 135         IN      DWORD rec_offset;
 136         IN      DWORD nbytes_to_read;
 137     SIZE_IS(nbytes_to_read)
 138         OUT REFERENCE   LPBYTE buf;
 139         OUT     DWORD sent_size;
 140         OUT     DWORD min_bytes_needed;
 141         OUT     DWORD status;
 142 };
 143 
 144 /*
 145  ***********************************************************************
 146  * The EVENTLOG interface definition.
 147  ***********************************************************************
 148  */
 149 INTERFACE(0)
 150 union logr_interface {
 151         CASE(LOGR_OPNUM_EventLogClose)
 152                 struct logr_EventLogClose               EventLogClose;
 153         CASE(LOGR_OPNUM_EventLogQueryCount)
 154                 struct logr_EventLogQueryCount          EventLogQueryCount;
 155         CASE(LOGR_OPNUM_EventLogGetOldestRec)
 156                 struct logr_EventLogGetOldestRec        EventLogGetOldestRec;
 157         CASE(LOGR_OPNUM_EventLogOpen)
 158                 struct logr_EventLogOpen                EventLogOpen;
 159         CASE(LOGR_OPNUM_EventLogRead)
 160                 struct logr_EventLogRead                EventLogRead;
 161 };
 162 typedef union logr_interface    logr_interface_t;
 163 EXTERNTYPEINFO(logr_interface)
 164 
 165 #endif /* _MLSVC_LOGR_NDL_ */