27b58665dca4caae4e9a981e53142f68f51d0fb6
[metze/samba/wip.git] / bin / default / librpc / gen_ndr / packet-dcerpc-named_pipe_auth.c
1 /* DO NOT EDIT
2         This filter was automatically generated
3         from /home/metze/devel/samba/4.0/master4-franky/librpc/idl/named_pipe_auth.idl and /home/metze/devel/samba/4.0/master4-franky/librpc/idl/named_pipe_auth.cnf.
4         
5         Pidl is a perl based IDL compiler for DCE/RPC idl files.
6         It is maintained by the Samba team, not the Wireshark team.
7         Instructions on how to download and install Pidl can be
8         found at http://wiki.wireshark.org/Pidl
9
10         $Id$
11 */
12
13
14 #include "config.h"
15 #ifdef _MSC_VER
16 #pragma warning(disable:4005)
17 #pragma warning(disable:4013)
18 #pragma warning(disable:4018)
19 #pragma warning(disable:4101)
20 #endif
21
22 #include <glib.h>
23 #include <string.h>
24 #include <epan/packet.h>
25
26 #include "packet-dcerpc.h"
27 #include "packet-dcerpc-nt.h"
28 #include "packet-windows-common.h"
29 #include "packet-dcerpc-named_pipe_auth.h"
30
31 /* Ett declarations */
32 static gint ett_dcerpc_named_pipe_auth = -1;
33 static gint ett_named_pipe_auth_named_pipe_auth_req_info4 = -1;
34 static gint ett_named_pipe_auth_named_pipe_auth_req_info = -1;
35 static gint ett_named_pipe_auth_named_pipe_auth_req = -1;
36 static gint ett_named_pipe_auth_named_pipe_auth_rep_info4 = -1;
37 static gint ett_named_pipe_auth_named_pipe_auth_rep_info = -1;
38 static gint ett_named_pipe_auth_named_pipe_auth_rep = -1;
39
40
41 /* Header field declarations */
42 static gint hf_named_pipe_auth_named_pipe_auth_req_info4_client_name = -1;
43 static gint hf_named_pipe_auth_named_pipe_auth_req_length = -1;
44 static gint hf_named_pipe_auth_opnum = -1;
45 static gint hf_named_pipe_auth_named_pipe_auth_rep_status = -1;
46 static gint hf_named_pipe_auth_named_pipe_auth_rep_info_val4_info4 = -1;
47 static gint hf_named_pipe_auth_named_pipe_auth_rep_info4_allocation_size = -1;
48 static gint hf_named_pipe_auth_named_pipe_auth_req_info4_client_addr = -1;
49 static gint hf_named_pipe_auth_named_pipe_auth_rep_info = -1;
50 static gint hf_named_pipe_auth_named_pipe_auth_req_info = -1;
51 static gint hf_named_pipe_auth_named_pipe_auth_req_info4_session_info = -1;
52 static gint hf_named_pipe_auth_named_pipe_auth_rep_magic = -1;
53 static gint hf_named_pipe_auth_named_pipe_auth_req_magic = -1;
54 static gint hf_named_pipe_auth_named_pipe_auth_req_info_val4_info4 = -1;
55 static gint hf_named_pipe_auth_named_pipe_auth_rep_level = -1;
56 static gint hf_named_pipe_auth_named_pipe_auth_req_info4_server_port = -1;
57 static gint hf_named_pipe_auth_named_pipe_auth_rep_info4_file_type = -1;
58 static gint hf_named_pipe_auth_named_pipe_auth_req_level = -1;
59 static gint hf_named_pipe_auth_named_pipe_auth_req_info4_client_port = -1;
60 static gint hf_named_pipe_auth_named_pipe_auth_rep_info4_device_state = -1;
61 static gint hf_named_pipe_auth_named_pipe_auth_req_info4_server_addr = -1;
62 static gint hf_named_pipe_auth_named_pipe_auth_rep_length = -1;
63 static gint hf_named_pipe_auth_named_pipe_auth_req_info4_server_name = -1;
64
65 static gint proto_dcerpc_named_pipe_auth = -1;
66 /* Version information */
67
68
69 static e_uuid_t uuid_dcerpc_named_pipe_auth = {
70         0x, 0x, 0x,
71         { 0x, 0x, 0x, 0x, 0x, 0x, 0x, 0x }
72 };
73 static guint16 ver_dcerpc_named_pipe_auth = 0;
74
75 static int named_pipe_auth_dissect_element_req_info4_client_name(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_);
76 static int named_pipe_auth_dissect_element_req_info4_client_name_(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_);
77 static int named_pipe_auth_dissect_element_req_info4_client_addr(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_);
78 static int named_pipe_auth_dissect_element_req_info4_client_addr_(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_);
79 static int named_pipe_auth_dissect_element_req_info4_client_port(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_);
80 static int named_pipe_auth_dissect_element_req_info4_server_name(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_);
81 static int named_pipe_auth_dissect_element_req_info4_server_name_(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_);
82 static int named_pipe_auth_dissect_element_req_info4_server_addr(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_);
83 static int named_pipe_auth_dissect_element_req_info4_server_addr_(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_);
84 static int named_pipe_auth_dissect_element_req_info4_server_port(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_);
85 static int named_pipe_auth_dissect_element_req_info4_session_info(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_);
86 static int named_pipe_auth_dissect_element_req_info4_session_info_(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_);
87 static int named_pipe_auth_dissect_element_req_info_val4_info4(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_);
88 static int named_pipe_auth_dissect_element_req_length(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_);
89 static int named_pipe_auth_dissect_element_req_magic(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_);
90 static int named_pipe_auth_dissect_element_req_magic_(tvbuff_t *tvb _U_, int offset _U_,int length _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_);
91 static int named_pipe_auth_dissect_element_req_level(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_, guint32 *level);
92 static int named_pipe_auth_dissect_element_req_info(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_, guint32 *level);
93 static int named_pipe_auth_dissect_element_rep_info4_file_type(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_);
94 static int named_pipe_auth_dissect_element_rep_info4_device_state(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_);
95 static int named_pipe_auth_dissect_element_rep_info4_allocation_size(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_);
96 static int named_pipe_auth_dissect_element_rep_info_val4_info4(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_);
97 static int named_pipe_auth_dissect_element_rep_length(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_);
98 static int named_pipe_auth_dissect_element_rep_magic(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_);
99 static int named_pipe_auth_dissect_element_rep_magic_(tvbuff_t *tvb _U_, int offset _U_,int length _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_);
100 static int named_pipe_auth_dissect_element_rep_level(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_, guint32 *level);
101 static int named_pipe_auth_dissect_element_rep_info(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_, guint32 *level);
102 static int named_pipe_auth_dissect_element_rep_status(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_);
103
104
105 /* IDL: struct { */
106 /* IDL:         [unique(1)] [charset(UTF8)] uint8 *client_name; */
107 /* IDL:         [unique(1)] [charset(DOS)] uint8 *client_addr; */
108 /* IDL:         uint16 client_port; */
109 /* IDL:         [unique(1)] [charset(UTF8)] uint8 *server_name; */
110 /* IDL:         [unique(1)] [charset(DOS)] uint8 *server_addr; */
111 /* IDL:         uint16 server_port; */
112 /* IDL:         [unique(1)] auth_session_info_transport *session_info; */
113 /* IDL: } */
114
115 static int
116 named_pipe_auth_dissect_element_req_info4_client_name(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
117 {
118         offset = dissect_ndr_embedded_pointer(tvb, offset, pinfo, tree, drep, named_pipe_auth_dissect_element_req_info4_client_name_, NDR_POINTER_UNIQUE, "Pointer to Client Name (uint8)",hf_named_pipe_auth_named_pipe_auth_req_info4_client_name);
119
120         return offset;
121 }
122
123 static int
124 named_pipe_auth_dissect_element_req_info4_client_name_(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
125 {
126         char *data;
127
128         offset = dissect_ndr_cvstring(tvb, offset, pinfo, tree, drep, sizeof(guint8), hf_named_pipe_auth_named_pipe_auth_req_info4_client_name, FALSE, &data);
129         proto_item_append_text(tree, ": %s", data);
130
131         return offset;
132 }
133
134 static int
135 named_pipe_auth_dissect_element_req_info4_client_addr(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
136 {
137         offset = dissect_ndr_embedded_pointer(tvb, offset, pinfo, tree, drep, named_pipe_auth_dissect_element_req_info4_client_addr_, NDR_POINTER_UNIQUE, "Pointer to Client Addr (uint8)",hf_named_pipe_auth_named_pipe_auth_req_info4_client_addr);
138
139         return offset;
140 }
141
142 static int
143 named_pipe_auth_dissect_element_req_info4_client_addr_(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
144 {
145         char *data;
146
147         offset = dissect_ndr_cvstring(tvb, offset, pinfo, tree, drep, sizeof(guint8), hf_named_pipe_auth_named_pipe_auth_req_info4_client_addr, FALSE, &data);
148         proto_item_append_text(tree, ": %s", data);
149
150         return offset;
151 }
152
153 static int
154 named_pipe_auth_dissect_element_req_info4_client_port(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
155 {
156         offset = PIDL_dissect_uint16(tvb, offset, pinfo, tree, drep, hf_named_pipe_auth_named_pipe_auth_req_info4_client_port, 0);
157
158         return offset;
159 }
160
161 static int
162 named_pipe_auth_dissect_element_req_info4_server_name(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
163 {
164         offset = dissect_ndr_embedded_pointer(tvb, offset, pinfo, tree, drep, named_pipe_auth_dissect_element_req_info4_server_name_, NDR_POINTER_UNIQUE, "Pointer to Server Name (uint8)",hf_named_pipe_auth_named_pipe_auth_req_info4_server_name);
165
166         return offset;
167 }
168
169 static int
170 named_pipe_auth_dissect_element_req_info4_server_name_(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
171 {
172         char *data;
173
174         offset = dissect_ndr_cvstring(tvb, offset, pinfo, tree, drep, sizeof(guint8), hf_named_pipe_auth_named_pipe_auth_req_info4_server_name, FALSE, &data);
175         proto_item_append_text(tree, ": %s", data);
176
177         return offset;
178 }
179
180 static int
181 named_pipe_auth_dissect_element_req_info4_server_addr(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
182 {
183         offset = dissect_ndr_embedded_pointer(tvb, offset, pinfo, tree, drep, named_pipe_auth_dissect_element_req_info4_server_addr_, NDR_POINTER_UNIQUE, "Pointer to Server Addr (uint8)",hf_named_pipe_auth_named_pipe_auth_req_info4_server_addr);
184
185         return offset;
186 }
187
188 static int
189 named_pipe_auth_dissect_element_req_info4_server_addr_(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
190 {
191         char *data;
192
193         offset = dissect_ndr_cvstring(tvb, offset, pinfo, tree, drep, sizeof(guint8), hf_named_pipe_auth_named_pipe_auth_req_info4_server_addr, FALSE, &data);
194         proto_item_append_text(tree, ": %s", data);
195
196         return offset;
197 }
198
199 static int
200 named_pipe_auth_dissect_element_req_info4_server_port(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
201 {
202         offset = PIDL_dissect_uint16(tvb, offset, pinfo, tree, drep, hf_named_pipe_auth_named_pipe_auth_req_info4_server_port, 0);
203
204         return offset;
205 }
206
207 static int
208 named_pipe_auth_dissect_element_req_info4_session_info(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
209 {
210         offset = dissect_ndr_embedded_pointer(tvb, offset, pinfo, tree, drep, named_pipe_auth_dissect_element_req_info4_session_info_, NDR_POINTER_UNIQUE, "Pointer to Session Info (auth_session_info_transport)",hf_named_pipe_auth_named_pipe_auth_req_info4_session_info);
211
212         return offset;
213 }
214
215 static int
216 named_pipe_auth_dissect_element_req_info4_session_info_(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
217 {
218         offset = named_pipe_auth_dissect_struct_auth_session_info_transport(tvb,offset,pinfo,tree,drep,hf_named_pipe_auth_named_pipe_auth_req_info4_session_info,0);
219
220         return offset;
221 }
222
223 int
224 named_pipe_auth_dissect_struct_req_info4(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *parent_tree _U_, guint8 *drep _U_, int hf_index _U_, guint32 param _U_)
225 {
226         proto_item *item = NULL;
227         proto_tree *tree = NULL;
228         dcerpc_info *di = (dcerpc_info *)pinfo->private_data;
229         int old_offset;
230
231         ALIGN_TO_5_BYTES;
232
233         old_offset = offset;
234
235         if (parent_tree) {
236                 item = proto_tree_add_item(parent_tree, hf_index, tvb, offset, -1, ENC_NA);
237                 tree = proto_item_add_subtree(item, ett_named_pipe_auth_named_pipe_auth_req_info4);
238         }
239         
240         offset = named_pipe_auth_dissect_element_req_info4_client_name(tvb, offset, pinfo, tree, drep);
241
242         offset = named_pipe_auth_dissect_element_req_info4_client_addr(tvb, offset, pinfo, tree, drep);
243
244         offset = named_pipe_auth_dissect_element_req_info4_client_port(tvb, offset, pinfo, tree, drep);
245
246         offset = named_pipe_auth_dissect_element_req_info4_server_name(tvb, offset, pinfo, tree, drep);
247
248         offset = named_pipe_auth_dissect_element_req_info4_server_addr(tvb, offset, pinfo, tree, drep);
249
250         offset = named_pipe_auth_dissect_element_req_info4_server_port(tvb, offset, pinfo, tree, drep);
251
252         offset = named_pipe_auth_dissect_element_req_info4_session_info(tvb, offset, pinfo, tree, drep);
253
254
255         proto_item_set_len(item, offset-old_offset);
256
257
258         if (di->call_data->flags & DCERPC_IS_NDR64) {
259                 ALIGN_TO_5_BYTES;
260         }
261
262         return offset;
263 }
264
265
266 /* IDL: [switch_type(uint32)] union { */
267 /* IDL: [case(4)] [case(4)] named_pipe_auth_req_info4 info4; */
268 /* IDL: } */
269
270 static int
271 named_pipe_auth_dissect_element_req_info_val4_info4(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
272 {
273         offset = named_pipe_auth_dissect_struct_req_info4(tvb,offset,pinfo,tree,drep,hf_named_pipe_auth_named_pipe_auth_req_info_val4_info4,0);
274
275         return offset;
276 }
277
278 static int
279 named_pipe_auth_dissect_req_info(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *parent_tree _U_, guint8 *drep _U_, int hf_index _U_, guint32 param _U_)
280 {
281         proto_item *item = NULL;
282         proto_tree *tree = NULL;
283         int old_offset;
284         guint32 level;
285
286         old_offset = offset;
287         if (parent_tree) {
288                 item = proto_tree_add_text(parent_tree, tvb, offset, -1, "named_pipe_auth_req_info");
289                 tree = proto_item_add_subtree(item, ett_named_pipe_auth_named_pipe_auth_req_info);
290         }
291
292         offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, drep, hf_index, &level);
293         ALIGN_TO_5_BYTES;
294
295         switch(level) {
296                 case 4:
297                         offset = named_pipe_auth_dissect_element_req_info_val4_info4(tvb, offset, pinfo, tree, drep);
298                 break;
299         }
300         proto_item_set_len(item, offset-old_offset);
301
302
303         return offset;
304 }
305
306 /* IDL: struct { */
307 /* IDL:         [value(ndr_size_named_pipe_auth_req(r,ndr->flags)-4)] [flag(LIBNDR_FLAG_BIGENDIAN)] uint32 length; */
308 /* IDL:         [value(NAMED_PIPE_AUTH_MAGIC)] [charset(DOS)] uint8 magic[4]; */
309 /* IDL:         uint32 level; */
310 /* IDL:         [switch_is(level)] named_pipe_auth_req_info info; */
311 /* IDL: } */
312
313 static int
314 named_pipe_auth_dissect_element_req_length(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
315 {
316         offset = PIDL_dissect_uint32(tvb, offset, pinfo, tree, drep, hf_named_pipe_auth_named_pipe_auth_req_length, 0);
317
318         return offset;
319 }
320
321 static int
322 named_pipe_auth_dissect_element_req_magic(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
323 {
324         dcerpc_info *di = (dcerpc_info*)pinfo->private_data;
325         int conformant = di->conformant_run;
326         if (!conformant) {
327                 offset = named_pipe_auth_dissect_element_req_magic_(tvb, offset, 4, pinfo, tree, drep);
328         }
329
330         return offset;
331 }
332
333 static int
334 named_pipe_auth_dissect_element_req_magic_(tvbuff_t *tvb _U_, int offset _U_,int length _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
335 {
336         proto_tree_add_bytes(tree, hf_named_pipe_auth_named_pipe_auth_req_magic, tvb, offset, length, tvb_get_ptr(tvb, offset,length)); offset += length;
337
338         return offset;
339 }
340
341 static int
342 named_pipe_auth_dissect_element_req_level(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_, guint32 *level)
343 {
344         offset = PIDL_dissect_uint32(tvb, offset, pinfo, tree, drep, hf_named_pipe_auth_named_pipe_auth_req_level, level);
345
346         return offset;
347 }
348
349 static int
350 named_pipe_auth_dissect_element_req_info(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_, guint32 *level)
351 {
352         offset = named_pipe_auth_dissect_req_info(tvb, offset, pinfo, tree, drep, hf_named_pipe_auth_named_pipe_auth_req_info, *level);
353
354         return offset;
355 }
356
357 int
358 named_pipe_auth_dissect_struct_req(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *parent_tree _U_, guint8 *drep _U_, int hf_index _U_, guint32 param _U_)
359 {
360         guint32 level;
361         proto_item *item = NULL;
362         proto_tree *tree = NULL;
363         dcerpc_info *di = (dcerpc_info *)pinfo->private_data;
364         int old_offset;
365
366         ALIGN_TO_5_BYTES;
367
368         old_offset = offset;
369
370         if (parent_tree) {
371                 item = proto_tree_add_item(parent_tree, hf_index, tvb, offset, -1, ENC_NA);
372                 tree = proto_item_add_subtree(item, ett_named_pipe_auth_named_pipe_auth_req);
373         }
374         
375         offset = named_pipe_auth_dissect_element_req_length(tvb, offset, pinfo, tree, drep);
376
377         offset = named_pipe_auth_dissect_element_req_magic(tvb, offset, pinfo, tree, drep);
378
379         offset = named_pipe_auth_dissect_element_req_level(tvb, offset, pinfo, tree, drep, &level);
380
381         offset = named_pipe_auth_dissect_element_req_info(tvb, offset, pinfo, tree, drep, &level);
382
383
384         proto_item_set_len(item, offset-old_offset);
385
386
387         if (di->call_data->flags & DCERPC_IS_NDR64) {
388                 ALIGN_TO_5_BYTES;
389         }
390
391         return offset;
392 }
393
394
395 /* IDL: struct { */
396 /* IDL:         uint16 file_type; */
397 /* IDL:         uint16 device_state; */
398 /* IDL:         hyper allocation_size; */
399 /* IDL: } */
400
401 static int
402 named_pipe_auth_dissect_element_rep_info4_file_type(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
403 {
404         offset = PIDL_dissect_uint16(tvb, offset, pinfo, tree, drep, hf_named_pipe_auth_named_pipe_auth_rep_info4_file_type, 0);
405
406         return offset;
407 }
408
409 static int
410 named_pipe_auth_dissect_element_rep_info4_device_state(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
411 {
412         offset = PIDL_dissect_uint16(tvb, offset, pinfo, tree, drep, hf_named_pipe_auth_named_pipe_auth_rep_info4_device_state, 0);
413
414         return offset;
415 }
416
417 static int
418 named_pipe_auth_dissect_element_rep_info4_allocation_size(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
419 {
420         offset = dissect_ndr_uint64(tvb, offset, pinfo, tree, drep, hf_named_pipe_auth_named_pipe_auth_rep_info4_allocation_size, NULL);
421
422         return offset;
423 }
424
425 int
426 named_pipe_auth_dissect_struct_rep_info4(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *parent_tree _U_, guint8 *drep _U_, int hf_index _U_, guint32 param _U_)
427 {
428         proto_item *item = NULL;
429         proto_tree *tree = NULL;
430         dcerpc_info *di = (dcerpc_info *)pinfo->private_data;
431         int old_offset;
432
433         ALIGN_TO_8_BYTES;
434
435         old_offset = offset;
436
437         if (parent_tree) {
438                 item = proto_tree_add_item(parent_tree, hf_index, tvb, offset, -1, ENC_NA);
439                 tree = proto_item_add_subtree(item, ett_named_pipe_auth_named_pipe_auth_rep_info4);
440         }
441         
442         offset = named_pipe_auth_dissect_element_rep_info4_file_type(tvb, offset, pinfo, tree, drep);
443
444         offset = named_pipe_auth_dissect_element_rep_info4_device_state(tvb, offset, pinfo, tree, drep);
445
446         offset = named_pipe_auth_dissect_element_rep_info4_allocation_size(tvb, offset, pinfo, tree, drep);
447
448
449         proto_item_set_len(item, offset-old_offset);
450
451
452         if (di->call_data->flags & DCERPC_IS_NDR64) {
453                 ALIGN_TO_8_BYTES;
454         }
455
456         return offset;
457 }
458
459
460 /* IDL: [switch_type(uint32)] union { */
461 /* IDL: [case(4)] [case(4)] named_pipe_auth_rep_info4 info4; */
462 /* IDL: } */
463
464 static int
465 named_pipe_auth_dissect_element_rep_info_val4_info4(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
466 {
467         offset = named_pipe_auth_dissect_struct_rep_info4(tvb,offset,pinfo,tree,drep,hf_named_pipe_auth_named_pipe_auth_rep_info_val4_info4,0);
468
469         return offset;
470 }
471
472 static int
473 named_pipe_auth_dissect_rep_info(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *parent_tree _U_, guint8 *drep _U_, int hf_index _U_, guint32 param _U_)
474 {
475         proto_item *item = NULL;
476         proto_tree *tree = NULL;
477         int old_offset;
478         guint32 level;
479
480         old_offset = offset;
481         if (parent_tree) {
482                 item = proto_tree_add_text(parent_tree, tvb, offset, -1, "named_pipe_auth_rep_info");
483                 tree = proto_item_add_subtree(item, ett_named_pipe_auth_named_pipe_auth_rep_info);
484         }
485
486         offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, drep, hf_index, &level);
487         ALIGN_TO_8_BYTES;
488
489         switch(level) {
490                 case 4:
491                         offset = named_pipe_auth_dissect_element_rep_info_val4_info4(tvb, offset, pinfo, tree, drep);
492                 break;
493         }
494         proto_item_set_len(item, offset-old_offset);
495
496
497         return offset;
498 }
499
500 /* IDL: struct { */
501 /* IDL:         [value(ndr_size_named_pipe_auth_rep(r,ndr->flags)-4)] [flag(LIBNDR_FLAG_BIGENDIAN)] uint32 length; */
502 /* IDL:         [value(NAMED_PIPE_AUTH_MAGIC)] [charset(DOS)] uint8 magic[4]; */
503 /* IDL:         uint32 level; */
504 /* IDL:         [switch_is(level)] named_pipe_auth_rep_info info; */
505 /* IDL:         NTSTATUS status; */
506 /* IDL: } */
507
508 static int
509 named_pipe_auth_dissect_element_rep_length(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
510 {
511         offset = PIDL_dissect_uint32(tvb, offset, pinfo, tree, drep, hf_named_pipe_auth_named_pipe_auth_rep_length, 0);
512
513         return offset;
514 }
515
516 static int
517 named_pipe_auth_dissect_element_rep_magic(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
518 {
519         dcerpc_info *di = (dcerpc_info*)pinfo->private_data;
520         int conformant = di->conformant_run;
521         if (!conformant) {
522                 offset = named_pipe_auth_dissect_element_rep_magic_(tvb, offset, 4, pinfo, tree, drep);
523         }
524
525         return offset;
526 }
527
528 static int
529 named_pipe_auth_dissect_element_rep_magic_(tvbuff_t *tvb _U_, int offset _U_,int length _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
530 {
531         proto_tree_add_bytes(tree, hf_named_pipe_auth_named_pipe_auth_rep_magic, tvb, offset, length, tvb_get_ptr(tvb, offset,length)); offset += length;
532
533         return offset;
534 }
535
536 static int
537 named_pipe_auth_dissect_element_rep_level(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_, guint32 *level)
538 {
539         offset = PIDL_dissect_uint32(tvb, offset, pinfo, tree, drep, hf_named_pipe_auth_named_pipe_auth_rep_level, level);
540
541         return offset;
542 }
543
544 static int
545 named_pipe_auth_dissect_element_rep_info(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_, guint32 *level)
546 {
547         offset = named_pipe_auth_dissect_rep_info(tvb, offset, pinfo, tree, drep, hf_named_pipe_auth_named_pipe_auth_rep_info, *level);
548
549         return offset;
550 }
551
552 static int
553 named_pipe_auth_dissect_element_rep_status(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
554 {
555         offset = PIDL_dissect_uint32(tvb, offset, pinfo, tree, drep, hf_named_pipe_auth_named_pipe_auth_rep_status, 0);
556
557         return offset;
558 }
559
560 int
561 named_pipe_auth_dissect_struct_rep(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *parent_tree _U_, guint8 *drep _U_, int hf_index _U_, guint32 param _U_)
562 {
563         guint32 level;
564         proto_item *item = NULL;
565         proto_tree *tree = NULL;
566         dcerpc_info *di = (dcerpc_info *)pinfo->private_data;
567         int old_offset;
568
569         ALIGN_TO_8_BYTES;
570
571         old_offset = offset;
572
573         if (parent_tree) {
574                 item = proto_tree_add_item(parent_tree, hf_index, tvb, offset, -1, ENC_NA);
575                 tree = proto_item_add_subtree(item, ett_named_pipe_auth_named_pipe_auth_rep);
576         }
577         
578         offset = named_pipe_auth_dissect_element_rep_length(tvb, offset, pinfo, tree, drep);
579
580         offset = named_pipe_auth_dissect_element_rep_magic(tvb, offset, pinfo, tree, drep);
581
582         offset = named_pipe_auth_dissect_element_rep_level(tvb, offset, pinfo, tree, drep, &level);
583
584         offset = named_pipe_auth_dissect_element_rep_info(tvb, offset, pinfo, tree, drep, &level);
585
586         offset = named_pipe_auth_dissect_element_rep_status(tvb, offset, pinfo, tree, drep);
587
588
589         proto_item_set_len(item, offset-old_offset);
590
591
592         if (di->call_data->flags & DCERPC_IS_NDR64) {
593                 ALIGN_TO_8_BYTES;
594         }
595
596         return offset;
597 }
598
599
600 static dcerpc_sub_dissector named_pipe_auth_dissectors[] = {
601         { 0, NULL, NULL, NULL }
602 };
603
604 void proto_register_dcerpc_named_pipe_auth(void)
605 {
606         static hf_register_info hf[] = {
607         { &hf_named_pipe_auth_named_pipe_auth_req_info4_client_name,
608           { "Client Name", "named_pipe_auth.named_pipe_auth_req_info4.client_name", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }},
609         { &hf_named_pipe_auth_named_pipe_auth_req_length,
610           { "Length", "named_pipe_auth.named_pipe_auth_req.length", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
611         { &hf_named_pipe_auth_opnum,
612           { "Operation", "named_pipe_auth.opnum", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
613         { &hf_named_pipe_auth_named_pipe_auth_rep_status,
614           { "Status", "named_pipe_auth.named_pipe_auth_rep.status", FT_UINT32, BASE_DEC, VALS(NT_errors), 0, NULL, HFILL }},
615         { &hf_named_pipe_auth_named_pipe_auth_rep_info_val4_info4,
616           { "Info4", "named_pipe_auth.named_pipe_auth_rep_info_val4.info4", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }},
617         { &hf_named_pipe_auth_named_pipe_auth_rep_info4_allocation_size,
618           { "Allocation Size", "named_pipe_auth.named_pipe_auth_rep_info4.allocation_size", FT_UINT64, BASE_DEC, NULL, 0, NULL, HFILL }},
619         { &hf_named_pipe_auth_named_pipe_auth_req_info4_client_addr,
620           { "Client Addr", "named_pipe_auth.named_pipe_auth_req_info4.client_addr", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }},
621         { &hf_named_pipe_auth_named_pipe_auth_rep_info,
622           { "Info", "named_pipe_auth.named_pipe_auth_rep.info", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }},
623         { &hf_named_pipe_auth_named_pipe_auth_req_info,
624           { "Info", "named_pipe_auth.named_pipe_auth_req.info", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }},
625         { &hf_named_pipe_auth_named_pipe_auth_req_info4_session_info,
626           { "Session Info", "named_pipe_auth.named_pipe_auth_req_info4.session_info", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }},
627         { &hf_named_pipe_auth_named_pipe_auth_rep_magic,
628           { "Magic", "named_pipe_auth.named_pipe_auth_rep.magic", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
629         { &hf_named_pipe_auth_named_pipe_auth_req_magic,
630           { "Magic", "named_pipe_auth.named_pipe_auth_req.magic", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
631         { &hf_named_pipe_auth_named_pipe_auth_req_info_val4_info4,
632           { "Info4", "named_pipe_auth.named_pipe_auth_req_info_val4.info4", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }},
633         { &hf_named_pipe_auth_named_pipe_auth_rep_level,
634           { "Level", "named_pipe_auth.named_pipe_auth_rep.level", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
635         { &hf_named_pipe_auth_named_pipe_auth_req_info4_server_port,
636           { "Server Port", "named_pipe_auth.named_pipe_auth_req_info4.server_port", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
637         { &hf_named_pipe_auth_named_pipe_auth_rep_info4_file_type,
638           { "File Type", "named_pipe_auth.named_pipe_auth_rep_info4.file_type", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
639         { &hf_named_pipe_auth_named_pipe_auth_req_level,
640           { "Level", "named_pipe_auth.named_pipe_auth_req.level", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
641         { &hf_named_pipe_auth_named_pipe_auth_req_info4_client_port,
642           { "Client Port", "named_pipe_auth.named_pipe_auth_req_info4.client_port", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
643         { &hf_named_pipe_auth_named_pipe_auth_rep_info4_device_state,
644           { "Device State", "named_pipe_auth.named_pipe_auth_rep_info4.device_state", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
645         { &hf_named_pipe_auth_named_pipe_auth_req_info4_server_addr,
646           { "Server Addr", "named_pipe_auth.named_pipe_auth_req_info4.server_addr", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }},
647         { &hf_named_pipe_auth_named_pipe_auth_rep_length,
648           { "Length", "named_pipe_auth.named_pipe_auth_rep.length", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
649         { &hf_named_pipe_auth_named_pipe_auth_req_info4_server_name,
650           { "Server Name", "named_pipe_auth.named_pipe_auth_req_info4.server_name", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }},
651         };
652
653
654         static gint *ett[] = {
655                 &ett_dcerpc_named_pipe_auth,
656                 &ett_named_pipe_auth_named_pipe_auth_req_info4,
657                 &ett_named_pipe_auth_named_pipe_auth_req_info,
658                 &ett_named_pipe_auth_named_pipe_auth_req,
659                 &ett_named_pipe_auth_named_pipe_auth_rep_info4,
660                 &ett_named_pipe_auth_named_pipe_auth_rep_info,
661                 &ett_named_pipe_auth_named_pipe_auth_rep,
662         };
663
664         proto_dcerpc_named_pipe_auth = proto_register_protocol("NAMED_PIPE_AUTH (pidl)", "NAMED_PIPE_AUTH", "named_pipe_auth");
665         proto_register_field_array(proto_dcerpc_named_pipe_auth, hf, array_length (hf));
666         proto_register_subtree_array(ett, array_length(ett));
667 }
668
669 void proto_reg_handoff_dcerpc_named_pipe_auth(void)
670 {
671         dcerpc_init_uuid(proto_dcerpc_named_pipe_auth, ett_dcerpc_named_pipe_auth,
672                 &uuid_dcerpc_named_pipe_auth, ver_dcerpc_named_pipe_auth,
673                 named_pipe_auth_dissectors, hf_named_pipe_auth_opnum);
674 }