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 * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
26 */
27
28#ifndef _MLSVC_LOGR_NDL_
29#define _MLSVC_LOGR_NDL_
30
31/*
32 ***********************************************************************
33 *
34 * Event log RPC (EVENTLOG) interface definition.
35 *
36 ***********************************************************************
37 */
38
39#include <libmlrpc/ndrtypes.ndl>
40
41#define LOGR_OPNUM_EventLogClose		0x02
42#define LOGR_OPNUM_EventLogQueryCount		0x04
43#define LOGR_OPNUM_EventLogGetOldestRec		0x05
44#define LOGR_OPNUM_EventLogOpen			0x07
45#define LOGR_OPNUM_EventLogRead			0x0A
46
47#define LOGR_MAXENTRYLEN			800
48
49
50CONTEXT_HANDLE(logr_handle) logr_handle_t;
51
52struct logr_string {
53	WORD	length;
54	WORD	allosize;
55	LPTSTR	str;
56};
57typedef struct logr_string logr_string_t;
58
59struct logr_record {
60	DWORD  Length1;
61	DWORD  Reserved;
62	DWORD  RecordNumber;
63	DWORD  TimeGenerated;
64	DWORD  TimeWritten;
65	DWORD  EventID;
66	WORD   EventType;
67	WORD   NumStrings;
68	WORD   EventCategory;
69	WORD   ReservedFlags;
70	DWORD  ClosingRecordNumber;
71	DWORD  StringOffset;
72	DWORD  UserSidLength;
73	DWORD  UserSidOffset;
74	DWORD  DataLength;
75	DWORD  DataOffset;
76	BYTE   info[LOGR_MAXENTRYLEN];
77	DWORD  Length2;
78};
79typedef struct logr_record logr_record_t;
80
81/*
82 ***********************************************************************
83 * LOGR_OPNUM_EventLogClose
84 ***********************************************************************
85 */
86OPERATION(LOGR_OPNUM_EventLogClose)
87struct logr_EventLogClose {
88	IN	logr_handle_t handle;
89	OUT	logr_handle_t result_handle;
90	OUT	DWORD status;
91};
92
93/*
94 ***********************************************************************
95 * LOGR_OPNUM_EventLogQueryCount
96 ***********************************************************************
97 */
98OPERATION(LOGR_OPNUM_EventLogQueryCount)
99struct logr_EventLogQueryCount {
100	IN	logr_handle_t handle;
101	OUT	DWORD rec_num;
102	OUT	DWORD status;
103};
104
105/*
106 ***********************************************************************
107 * LOGR_OPNUM_EventLogGetOldestRec
108 ***********************************************************************
109 */
110OPERATION(LOGR_OPNUM_EventLogGetOldestRec)
111struct logr_EventLogGetOldestRec {
112	IN	logr_handle_t handle;
113	OUT	DWORD oldest_rec;
114	OUT	DWORD status;
115};
116
117/*
118 ***********************************************************************
119 * LOGR_OPNUM_EventLogOpen
120 ***********************************************************************
121 */
122OPERATION(LOGR_OPNUM_EventLogOpen)
123struct logr_EventLogOpen {
124	IN	DWORD *server_name;
125	IN	logr_string_t log_name;
126	IN	DWORD reg_module_name;
127	IN	DWORD major_version;
128	IN	DWORD minor_version;
129	OUT	logr_handle_t handle;
130	OUT	DWORD status;
131};
132
133OPERATION(LOGR_OPNUM_EventLogRead)
134struct logr_EventLogRead {
135	IN	logr_handle_t handle;
136	IN	DWORD read_flags;
137	IN	DWORD rec_offset;
138	IN	DWORD nbytes_to_read;
139    SIZE_IS(nbytes_to_read)
140	OUT REFERENCE	LPBYTE buf;
141	OUT	DWORD sent_size;
142	OUT	DWORD min_bytes_needed;
143	OUT	DWORD status;
144};
145
146/*
147 ***********************************************************************
148 * The EVENTLOG interface definition.
149 ***********************************************************************
150 */
151INTERFACE(0)
152union logr_interface {
153	CASE(LOGR_OPNUM_EventLogClose)
154		struct logr_EventLogClose		EventLogClose;
155	CASE(LOGR_OPNUM_EventLogQueryCount)
156		struct logr_EventLogQueryCount		EventLogQueryCount;
157	CASE(LOGR_OPNUM_EventLogGetOldestRec)
158		struct logr_EventLogGetOldestRec	EventLogGetOldestRec;
159	CASE(LOGR_OPNUM_EventLogOpen)
160		struct logr_EventLogOpen		EventLogOpen;
161	CASE(LOGR_OPNUM_EventLogRead)
162		struct logr_EventLogRead		EventLogRead;
163};
164typedef union logr_interface	logr_interface_t;
165EXTERNTYPEINFO(logr_interface)
166
167#endif /* _MLSVC_LOGR_NDL_ */
168