r18623: starting on eventlog IDL
[bbaumbach/samba-autobuild/.git] / source3 / include / rpc_eventlog.h
1 /* 
2  *  Unix SMB/CIFS implementation.
3  *  RPC Pipe client / server routines
4  *  Copyright (C) Marcin Krzysztof Porwit    2005.
5  *  
6  *  This program is free software; you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation; either version 2 of the License, or
9  *  (at your option) any later version.
10  *  
11  *  This program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *  GNU General Public License for more details.
15  *  
16  *  You should have received a copy of the GNU General Public License
17  *  along with this program; if not, write to the Free Software
18  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19  */
20  
21 #ifndef _RPC_EVENTLOG_H         /* _RPC_EVENTLOG_H */
22 #define _RPC_EVENTLOG_H
23
24 /* opcodes */
25
26 #define EVENTLOG_CLEAREVENTLOG          0x00
27 #define EVENTLOG_CLOSEEVENTLOG          0x02
28 #define EVENTLOG_GETNUMRECORDS          0x04
29 #define EVENTLOG_GETOLDESTENTRY         0x05
30 #define EVENTLOG_OPENEVENTLOG           0x07
31 #define EVENTLOG_READEVENTLOG           0x0a
32
33 /* Eventlog read flags */
34 /* defined in librpc/gen_ndr/eventlog.h */
35
36 /* Event types */
37 /* defined in librpc/gen_ndr/eventlog.h */
38
39 /* Defines for TDB keys */
40 #define  EVT_OLDEST_ENTRY  "INFO/oldest_entry"
41 #define  EVT_NEXT_RECORD   "INFO/next_record"
42 #define  EVT_VERSION       "INFO/version"
43 #define  EVT_MAXSIZE       "INFO/maxsize"
44 #define  EVT_RETENTION     "INFO/retention"
45
46 #define ELOG_APPL       "Application"
47 #define ELOG_SYS        "System"
48 #define ELOG_SEC        "Security"
49
50 typedef struct elog_tdb {
51         struct elog_tdb *prev, *next;
52         char *name;
53         TDB_CONTEXT *tdb;
54         int ref_count;
55 } ELOG_TDB;
56
57 #define ELOG_TDB_CTX(x) ((x)->tdb)
58
59
60 #define  EVENTLOG_DATABASE_VERSION_V1    1
61
62 /***********************************/
63
64 typedef struct {
65         uint16 unknown1;
66         uint16 unknown2;
67 } EVENTLOG_OPEN_UNKNOWN0;
68
69 typedef struct {
70         EVENTLOG_OPEN_UNKNOWN0 *unknown0;
71         UNISTR4 logname;
72         UNISTR4 servername;
73         uint32 unknown1;
74         uint32 unknown2;
75 } EVENTLOG_Q_OPEN_EVENTLOG;
76
77 typedef struct {
78         POLICY_HND handle;
79         NTSTATUS status;
80 } EVENTLOG_R_OPEN_EVENTLOG;
81
82
83 /***********************************/
84
85 typedef struct {
86         POLICY_HND handle;
87 } EVENTLOG_Q_CLOSE_EVENTLOG;
88
89 typedef struct {
90         POLICY_HND handle;
91         NTSTATUS status;
92 } EVENTLOG_R_CLOSE_EVENTLOG;
93
94
95 /***********************************/
96
97 typedef struct {
98         POLICY_HND handle;
99 } EVENTLOG_Q_GET_NUM_RECORDS;
100
101 typedef struct {
102         uint32 num_records;
103         NTSTATUS status;
104 } EVENTLOG_R_GET_NUM_RECORDS;
105
106
107 /***********************************/
108
109 typedef struct {
110         POLICY_HND handle;
111 } EVENTLOG_Q_GET_OLDEST_ENTRY;
112
113 typedef struct {
114         uint32 oldest_entry;
115         NTSTATUS status;
116 } EVENTLOG_R_GET_OLDEST_ENTRY;
117
118
119 /***********************************/
120
121 typedef struct 
122 {
123         POLICY_HND handle;
124         uint32 flags;
125         uint32 offset;
126         uint32 max_read_size;
127 } EVENTLOG_Q_READ_EVENTLOG;
128
129 typedef struct {
130         uint32 length;
131         uint32 reserved1;
132         uint32 record_number;
133         uint32 time_generated;
134         uint32 time_written;
135         uint32 event_id;
136         uint16 event_type;
137         uint16 num_strings;
138         uint16 event_category;
139         uint16 reserved2;
140         uint32 closing_record_number;
141         uint32 string_offset;
142         uint32 user_sid_length;
143         uint32 user_sid_offset;
144         uint32 data_length;
145         uint32 data_offset;
146 } Eventlog_record;
147
148 typedef struct {
149         uint32 source_name_len;
150         wpstring source_name;
151         uint32 computer_name_len;
152         wpstring computer_name;
153         uint32 sid_padding;
154         wpstring sid;
155         uint32 strings_len;
156         wpstring strings;
157         uint32 user_data_len;
158         pstring user_data;
159         uint32 data_padding;
160 } Eventlog_data_record;
161
162 typedef struct eventlog_entry {
163         Eventlog_record record;
164         Eventlog_data_record data_record;
165         uint8 *data;
166         uint8 *end_of_data_padding;
167         struct eventlog_entry *next;
168 } Eventlog_entry;
169  
170 typedef struct {
171         uint32 num_bytes_in_resp;
172         uint32 bytes_in_next_record;
173         uint32 num_records;
174         Eventlog_entry *entry;
175         uint8 *end_of_entries_padding;
176         uint32 sent_size;
177         uint32 real_size;
178         NTSTATUS status;
179 } EVENTLOG_R_READ_EVENTLOG;
180
181
182 /***********************************/
183
184 typedef struct {
185         POLICY_HND handle;
186         UNISTR4 backupfile;
187 } EVENTLOG_Q_CLEAR_EVENTLOG;
188
189 typedef struct {
190         NTSTATUS status;
191 } EVENTLOG_R_CLEAR_EVENTLOG;
192
193 #endif /* _RPC_EVENTLOG_H */