| Wireshark 4.7.0 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
packet-dcerpc.h
1/* packet-dcerpc.h
2 * Copyright 2001, Todd Sabin <tas@webspan.net>
3 * Copyright 2003, Tim Potter <tpot@samba.org>
4 *
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
8 *
9 * SPDX-License-Identifier: GPL-2.0-or-later
10 */
11
12#ifndef __PACKET_DCERPC_H__
13#define __PACKET_DCERPC_H__
14
15#include <epan/conversation.h>
16#include "ws_symbol_export.h"
17
18#ifdef __cplusplus
19 extern "C" {
20#endif /* __cplusplus */
21
22#define DCERPC_TABLE_NAME "dcerpc.uuid"
23/*
24 * Data representation.
25 */
26#define DREP_LITTLE_ENDIAN 0x10
27
28#define DREP_EBCDIC 0x01
29
30/*
31 * Data representation to integer byte order.
32 */
33#define DREP_ENC_INTEGER(drep) \
34 (((drep)[0] & DREP_LITTLE_ENDIAN) ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN)
35
36/*
37 * Data representation to (octet-string) character encoding.
38 */
39#define DREP_ENC_CHAR(drep) \
40 (((drep)[0] & DREP_EBCDIC) ? ENC_EBCDIC|ENC_NA : ENC_ASCII|ENC_NA)
41
42#ifdef PT_R4
43/* now glib always includes signal.h and on linux PPC
44 * signal.h defines PT_R4
45*/
46#undef PT_R4
47#endif
48
49#define DCERPC_UUID_NULL { 0,0,0, {0,0,0,0,0,0,0,0} }
50
51/* %08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x */
52#define DCERPC_UUID_STR_LEN 36+1
53
54 typedef struct _e_ctx_hnd {
55 uint32_t attributes;
56 e_guid_t uuid;
57} e_ctx_hnd;
58
59 typedef struct _e_dce_cn_common_hdr_t {
60 uint8_t rpc_ver;
61 uint8_t rpc_ver_minor;
62 uint8_t ptype;
63 uint8_t flags;
64 uint8_t drep[4];
65 uint16_t frag_len;
66 uint16_t auth_len;
67 uint32_t call_id;
68} e_dce_cn_common_hdr_t;
69
70 typedef struct _e_dce_dg_common_hdr_t {
71 uint8_t rpc_ver;
72 uint8_t ptype;
73 uint8_t flags1;
74 uint8_t flags2;
75 uint8_t drep[3];
76 uint8_t serial_hi;
77 e_guid_t obj_id;
78 e_guid_t if_id;
79 e_guid_t act_id;
80 uint32_t server_boot;
81 uint32_t if_ver;
82 uint32_t seqnum;
83 uint16_t opnum;
84 uint16_t ihint;
85 uint16_t ahint;
86 uint16_t frag_len;
87 uint16_t frag_num;
88 uint8_t auth_proto;
89 uint8_t serial_lo;
90} e_dce_dg_common_hdr_t;
91
92 struct _dcerpc_auth_subdissector_fns;
93
94 typedef struct _dcerpc_auth_info {
95 bool hdr_signing;
96 uint8_t auth_type;
97 uint8_t auth_level;
98 uint32_t auth_context_id;
99 uint8_t auth_pad_len;
100 uint32_t auth_size;
101 struct _dcerpc_auth_subdissector_fns *auth_fns;
102 tvbuff_t *auth_hdr_tvb;
103 tvbuff_t *auth_tvb;
104 proto_item *auth_item;
105 proto_tree *auth_tree;
106} dcerpc_auth_info;
107
108 typedef struct dcerpcstat_tap_data
109{
110 const char *prog;
111 e_guid_t uuid;
112 uint16_t ver;
113 int num_procedures;
114} dcerpcstat_tap_data_t;
115
116/* Private data passed to subdissectors from the main DCERPC dissector.
117 * One unique instance of this structure is created for each
118 * DCERPC request/response transaction when we see the initial request
119 * of the transaction.
120 * These instances are persistent and will remain available until the
121 * capture file is closed and a new one is read.
122 *
123 * For transactions where we never saw the request (missing from the trace)
124 * the dcerpc runtime will create a temporary "fake" such structure to pass
125 * to the response dissector. These fake structures are not persistent
126 * and can not be used to keep data hanging around.
127 */
128 typedef struct _dcerpc_call_value {
129 e_guid_t uuid; /* interface UUID */
130 uint16_t ver; /* interface version */
131 e_guid_t object_uuid; /* optional object UUID (or DCERPC_UUID_NULL) */
132 uint16_t opnum;
133 uint32_t req_frame;
134 nstime_t req_time;
135 uint32_t rep_frame;
136 uint32_t max_ptr;
137 void *se_data; /* This holds any data with se allocation scope
138 * that we might want to keep
139 * for this request/response transaction.
140 * The pointer is initialized to NULL and must be
141 * checked before being dereferenced.
142 * This is useful for such things as when we
143 * need to pass persistent data from the request
144 * to the reply, such as LSA/OpenPolicy2() that
145 * uses this to pass the domain name from the
146 * request to the reply.
147 */
148 void *private_data; /* XXX This will later be renamed as ep_data */
149 e_ctx_hnd *pol; /* policy handle tracked between request/response*/
150#define DCERPC_IS_NDR64 0x00000001
151 uint32_t flags; /* flags for this transaction */
152} dcerpc_call_value;
153
154 typedef struct _dcerpc_info {
155 conversation_t *conv; /* Which TCP stream we are in */
156 uint32_t call_id; /* Call ID for this call */
157 uint64_t transport_salt; /* e.g. FID for DCERPC over SMB */
158 uint8_t ptype; /* packet type: PDU_REQ, PDU_RESP, ... */
159 bool conformant_run;
160 bool no_align; /* are data aligned? (default yes) */
161 uint32_t conformant_eaten; /* how many bytes did the conformant run eat?*/
162 uint32_t array_max_count; /* max_count for conformant arrays */
163 uint32_t array_max_count_offset;
164 uint32_t array_offset;
165 uint32_t array_offset_offset;
166 uint32_t array_actual_count;
167 uint32_t array_actual_count_offset;
168 int hf_index;
169 dcerpc_call_value *call_data;
170 const char *dcerpc_procedure_name; /* Used by PIDL to store the name of the current dcerpc procedure */
171 struct _dcerpc_auth_info *auth_info;
172 void *private_data;
173
174 /* ndr pointer handling */
175 struct {
176 /* Should we re-read the size of the list ?
177 * Instead of re-calculating the size every time, use the stored value unless this
178 * flag is set which means: re-read the size of the list
179 */
180 bool must_check_size;
181 /*
182 * List of pointers encountered so far in the current level. Points to an
183 * element of list_ndr_pointer_list.
184 */
185 GSList *list;
186 GHashTable *hash;
187 /*
188 * List of pointer list, in order to avoid huge performance penalty
189 * when dealing with list bigger than 100 elements due to the way we
190 * try to insert in the list.
191 * We instead maintain a stack of pointer list
192 * To make it easier to manage we just use a list to materialize the stack
193 */
194 GSList *list_list;
195
196 /* Boolean controlling whether pointers are top-level or embedded */
197 bool are_top_level;
198 } pointers;
199} dcerpc_info;
200
201#define PDU_REQ 0
202#define PDU_PING 1
203#define PDU_RESP 2
204#define PDU_FAULT 3
205#define PDU_WORKING 4
206#define PDU_NOCALL 5
207#define PDU_REJECT 6
208#define PDU_ACK 7
209#define PDU_CL_CANCEL 8
210#define PDU_FACK 9
211#define PDU_CANCEL_ACK 10
212#define PDU_BIND 11
213#define PDU_BIND_ACK 12
214#define PDU_BIND_NAK 13
215#define PDU_ALTER 14
216#define PDU_ALTER_ACK 15
217#define PDU_AUTH3 16
218#define PDU_SHUTDOWN 17
219#define PDU_CO_CANCEL 18
220#define PDU_ORPHANED 19
221#define PDU_RTS 20
222
223/*
224 * helpers for packet-dcerpc.c and packet-dcerpc-ndr.c
225 * If you're writing a subdissector, you almost certainly want the
226 * NDR functions below.
227 */
228uint16_t dcerpc_tvb_get_ntohs (tvbuff_t *tvb, unsigned offset, uint8_t *drep);
229uint32_t dcerpc_tvb_get_ntohl (tvbuff_t *tvb, unsigned offset, uint8_t *drep);
230 void dcerpc_tvb_get_uuid (tvbuff_t *tvb, unsigned offset, uint8_t *drep, e_guid_t *uuid);
231WS_DLL_PUBLIC
232 unsigned dissect_dcerpc_char (tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
233 proto_tree *tree, uint8_t *drep,
234 int hfindex, uint8_t *pdata);
235WS_DLL_PUBLIC
236 unsigned dissect_dcerpc_uint8 (tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
237 proto_tree *tree, uint8_t *drep,
238 int hfindex, uint8_t *pdata);
239WS_DLL_PUBLIC
240 unsigned dissect_dcerpc_uint16 (tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
241 proto_tree *tree, uint8_t *drep,
242 int hfindex, uint16_t *pdata);
243WS_DLL_PUBLIC
244 unsigned dissect_dcerpc_uint32 (tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
245 proto_tree *tree, uint8_t *drep,
246 int hfindex, uint32_t *pdata);
247WS_DLL_PUBLIC
248 unsigned dissect_dcerpc_uint64 (tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
249 proto_tree *tree, dcerpc_info *di, uint8_t *drep,
250 int hfindex, uint64_t *pdata);
251 unsigned dissect_dcerpc_float (tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
252 proto_tree *tree, uint8_t *drep,
253 int hfindex, float *pdata);
254 unsigned dissect_dcerpc_double (tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
255 proto_tree *tree, uint8_t *drep,
256 int hfindex, double *pdata);
257 unsigned dissect_dcerpc_time_t (tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
258 proto_tree *tree, uint8_t *drep,
259 int hfindex, uint32_t *pdata);
260WS_DLL_PUBLIC
261 unsigned dissect_dcerpc_uuid_t (tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
262 proto_tree *tree, uint8_t *drep,
263 int hfindex, e_guid_t *pdata);
264
265/*
266 * NDR routines for subdissectors.
267 */
268WS_DLL_PUBLIC
269 unsigned dissect_ndr_uint8 (tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
270 proto_tree *tree, dcerpc_info *di, uint8_t *drep,
271 int hfindex, uint8_t *pdata);
272 unsigned PIDL_dissect_uint8 (tvbuff_t *tvb, unsigned offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, uint8_t *drep, int hfindex, uint32_t param);
273 unsigned PIDL_dissect_uint8_val (tvbuff_t *tvb, unsigned offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, uint8_t *drep, int hfindex, uint32_t param, uint8_t *pval);
274WS_DLL_PUBLIC
275 unsigned dissect_ndr_uint16 (tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
276 proto_tree *tree, dcerpc_info *di, uint8_t *drep,
277 int hfindex, uint16_t *pdata);
278 unsigned PIDL_dissect_uint16 (tvbuff_t *tvb, unsigned offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, uint8_t *drep, int hfindex, uint32_t param);
279 unsigned PIDL_dissect_uint16_val (tvbuff_t *tvb, unsigned offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, uint8_t *drep, int hfindex, uint32_t param, uint16_t *pval);
280WS_DLL_PUBLIC
281 unsigned dissect_ndr_uint32 (tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
282 proto_tree *tree, dcerpc_info *di, uint8_t *drep,
283 int hfindex, uint32_t *pdata);
284 unsigned PIDL_dissect_uint32 (tvbuff_t *tvb, unsigned offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, uint8_t *drep, int hfindex, uint32_t param);
285 unsigned PIDL_dissect_uint32_val (tvbuff_t *tvb, unsigned offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, uint8_t *drep, int hfindex, uint32_t param, uint32_t *rval);
286WS_DLL_PUBLIC
287 unsigned dissect_ndr_duint32 (tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
288 proto_tree *tree, dcerpc_info *di, uint8_t *drep,
289 int hfindex, uint64_t *pdata);
290WS_DLL_PUBLIC
291 unsigned dissect_ndr_uint64 (tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
292 proto_tree *tree, dcerpc_info *di, uint8_t *drep,
293 int hfindex, uint64_t *pdata);
294 unsigned PIDL_dissect_uint64 (tvbuff_t *tvb, unsigned offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, uint8_t *drep, int hfindex, uint32_t param);
295 unsigned PIDL_dissect_uint64_val (tvbuff_t *tvb, unsigned offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, uint8_t *drep, int hfindex, uint32_t param, uint64_t *pval);
296WS_DLL_PUBLIC
297 unsigned dissect_ndr_float (tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
298 proto_tree *tree, dcerpc_info *di, uint8_t *drep,
299 int hfindex, float *pdata);
300WS_DLL_PUBLIC
301 unsigned dissect_ndr_double (tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
302 proto_tree *tree, dcerpc_info *di, uint8_t *drep,
303 int hfindex, double *pdata);
304
305WS_DLL_PUBLIC
306 unsigned dissect_ndr_time_t (tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
307 proto_tree *tree, dcerpc_info *di, uint8_t *drep,
308 int hfindex, uint32_t *pdata);
309WS_DLL_PUBLIC
310 unsigned dissect_ndr_uuid_t (tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
311 proto_tree *tree, dcerpc_info *di, uint8_t *drep,
312 int hfindex, e_guid_t *pdata);
313 unsigned dissect_ndr_ctx_hnd (tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
314 proto_tree *tree, dcerpc_info *di, uint8_t *drep,
315 int hfindex, e_ctx_hnd *pdata);
316
317#define FT_UINT1632 FT_UINT32
318 typedef uint32_t uint1632_t;
319
320WS_DLL_PUBLIC
321 unsigned dissect_ndr_uint1632 (tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
322 proto_tree *tree, dcerpc_info *di, uint8_t *drep,
323 int hfindex, uint1632_t *pdata);
324
325 typedef uint64_t uint3264_t;
326
327WS_DLL_PUBLIC
328 unsigned dissect_ndr_uint3264 (tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
329 proto_tree *tree, dcerpc_info *di, uint8_t *drep,
330 int hfindex, uint3264_t *pdata);
331
332 typedef unsigned (dcerpc_dissect_fnct_t)(tvbuff_t *tvb, unsigned offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, uint8_t *drep);
333 typedef unsigned (dcerpc_dissect_fnct_blk_t)(tvbuff_t *tvb, unsigned offset, unsigned length, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, uint8_t *drep);
334
335 typedef void (dcerpc_callback_fnct_t)(packet_info *pinfo, proto_tree *tree, proto_item *item, dcerpc_info *di, tvbuff_t *tvb, unsigned start_offset, unsigned end_offset, void *callback_args);
336
337#define NDR_POINTER_REF 1
338#define NDR_POINTER_UNIQUE 2
339#define NDR_POINTER_PTR 3
340
341 unsigned dissect_ndr_pointer_cb(tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
342 proto_tree *tree, dcerpc_info *di, uint8_t *drep,
343 dcerpc_dissect_fnct_t *fnct, int type, const char *text,
344 int hf_index, dcerpc_callback_fnct_t *callback,
345 void *callback_args);
346
347 unsigned dissect_ndr_pointer(tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
348 proto_tree *tree, dcerpc_info *di, uint8_t *drep,
349 dcerpc_dissect_fnct_t *fnct, int type, const char *text,
350 int hf_index);
351 unsigned dissect_deferred_pointers(packet_info *pinfo, tvbuff_t *tvb, unsigned offset, dcerpc_info *di, uint8_t *drep);
352 unsigned dissect_ndr_embedded_pointer(tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
353 proto_tree *tree, dcerpc_info *di, uint8_t *drep,
354 dcerpc_dissect_fnct_t *fnct, int type, const char *text,
355 int hf_index);
356 unsigned dissect_ndr_toplevel_pointer(tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
357 proto_tree *tree, dcerpc_info *di, uint8_t *drep,
358 dcerpc_dissect_fnct_t *fnct, int type, const char *text,
359 int hf_index);
360
361/* dissect a NDR unidimensional conformant array */
362 unsigned dissect_ndr_ucarray(tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
363 proto_tree *tree, dcerpc_info *di, uint8_t *drep,
364 dcerpc_dissect_fnct_t *fnct);
365
366 unsigned dissect_ndr_ucarray_block(tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
367 proto_tree *tree, dcerpc_info *di, uint8_t *drep,
368 dcerpc_dissect_fnct_blk_t *fnct);
369
370/* dissect a NDR unidimensional conformant and varying array
371 * each byte in the array is processed separately
372 */
373 unsigned dissect_ndr_ucvarray(tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
374 proto_tree *tree, dcerpc_info *di, uint8_t *drep,
375 dcerpc_dissect_fnct_t *fnct);
376
377 unsigned dissect_ndr_ucvarray_block(tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
378 proto_tree *tree, dcerpc_info *di, uint8_t *drep,
379 dcerpc_dissect_fnct_blk_t *fnct);
380
381/* dissect a NDR unidimensional varying array */
382 unsigned dissect_ndr_uvarray(tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
383 proto_tree *tree, dcerpc_info *di, uint8_t *drep,
384 dcerpc_dissect_fnct_t *fnct);
385
386 unsigned dissect_ndr_byte_array(tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
387 proto_tree *tree, dcerpc_info *di, uint8_t *drep);
388
389 unsigned dissect_ndr_cvstring(tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
390 proto_tree *tree, dcerpc_info *di, uint8_t *drep, int size_is,
391 int hfinfo, bool add_subtree,
392 char **data);
393 unsigned dissect_ndr_char_cvstring(tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
394 proto_tree *tree, dcerpc_info *di, uint8_t *drep);
395 unsigned dissect_ndr_wchar_cvstring(tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
396 proto_tree *tree, dcerpc_info *di, uint8_t *drep);
397 unsigned PIDL_dissect_cvstring(tvbuff_t *tvb, unsigned offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, uint8_t *drep, int chsize, int hfindex, uint32_t param);
398
399 unsigned dissect_ndr_cstring(tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
400 proto_tree *tree, dcerpc_info *di, uint8_t *drep, int size_is,
401 int hfindex, bool add_subtree, char **data);
402 unsigned dissect_ndr_vstring(tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
403 proto_tree *tree, dcerpc_info *di, uint8_t *drep, int size_is,
404 int hfinfo, bool add_subtree,
405 char **data);
406 unsigned dissect_ndr_char_vstring(tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
407 proto_tree *tree, dcerpc_info *di, uint8_t *drep);
408 unsigned dissect_ndr_wchar_vstring(tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
409 proto_tree *tree, dcerpc_info *di, uint8_t *drep);
410
411 typedef struct _dcerpc_sub_dissector {
412 uint16_t num;
413 const char *name;
414 dcerpc_dissect_fnct_t *dissect_rqst;
415 dcerpc_dissect_fnct_t *dissect_resp;
416} dcerpc_sub_dissector;
417
418/* registration function for subdissectors */
419WS_DLL_PUBLIC
420 void dcerpc_init_uuid (int proto, int ett, e_guid_t *uuid, uint16_t ver, const dcerpc_sub_dissector *procs, int opnum_hf);
421WS_DLL_PUBLIC
422 const char *dcerpc_get_proto_name(e_guid_t *uuid, uint16_t ver);
423WS_DLL_PUBLIC
424 int dcerpc_get_proto_hf_opnum(e_guid_t *uuid, uint16_t ver);
425WS_DLL_PUBLIC
426 const dcerpc_sub_dissector *dcerpc_get_proto_sub_dissector(e_guid_t *uuid, uint16_t ver);
427
428/* Create a opnum, name value_string from a subdissector list */
429
430 value_string *value_string_from_subdissectors(const dcerpc_sub_dissector *sd);
431
432 typedef struct _dcerpc_uuid_value {
433 protocol_t *proto;
434 int proto_id;
435 int ett;
436 const char *name;
437 const dcerpc_sub_dissector *procs;
438 int opnum_hf;
439} dcerpc_uuid_value;
440
441/* Authenticated pipe registration functions and miscellanea */
442
443 typedef tvbuff_t *(dcerpc_decode_data_fnct_t)(tvbuff_t *header_tvb,
444 tvbuff_t *payload_tvb,
445 tvbuff_t *trailer_tvb,
446 tvbuff_t *auth_tvb,
447 packet_info *pinfo,
448 dcerpc_auth_info *auth_info);
449
450 typedef struct _dcerpc_auth_subdissector_fns {
451
452 /* Dissect credentials and verifiers */
453
454 dcerpc_dissect_fnct_t *bind_fn;
455 dcerpc_dissect_fnct_t *bind_ack_fn;
456 dcerpc_dissect_fnct_t *auth3_fn;
457 dcerpc_dissect_fnct_t *req_verf_fn;
458 dcerpc_dissect_fnct_t *resp_verf_fn;
459
460 /* Decrypt encrypted requests/response PDUs */
461
462 dcerpc_decode_data_fnct_t *req_data_fn;
463 dcerpc_decode_data_fnct_t *resp_data_fn;
464
465} dcerpc_auth_subdissector_fns;
466
467 void register_dcerpc_auth_subdissector(uint8_t auth_level, uint8_t auth_type,
468 dcerpc_auth_subdissector_fns *fns);
469
470/* all values needed to (re-)build a dcerpc binding */
471 typedef struct decode_dcerpc_bind_values_s {
472 /* values of a typical conversation */
473 address addr_a;
474 address addr_b;
475 port_type ptype;
476 uint32_t port_a;
477 uint32_t port_b;
478 /* dcerpc conversation specific */
479 uint16_t ctx_id;
480 uint64_t transport_salt;
481 /* corresponding "interface" */
482 GString *ifname;
483 e_guid_t uuid;
484 uint16_t ver;
485} decode_dcerpc_bind_values_t;
486
487WS_DLL_PUBLIC uint64_t dcerpc_get_transport_salt(packet_info *pinfo);
488WS_DLL_PUBLIC void dcerpc_set_transport_salt(uint64_t dcetransportsalt, packet_info *pinfo);
489
490/* Authentication services */
491
492/*
493 * For MS-specific SSPs (Security Service Provider), see
494 *
495 * https://docs.microsoft.com/en-us/windows/win32/rpc/authentication-level-constants
496 */
497
498#define DCE_C_RPC_AUTHN_PROTOCOL_NONE 0
499#define DCE_C_RPC_AUTHN_PROTOCOL_KRB5 1
500#define DCE_C_RPC_AUTHN_PROTOCOL_SPNEGO 9
501#define DCE_C_RPC_AUTHN_PROTOCOL_NTLMSSP 10
502#define DCE_C_RPC_AUTHN_PROTOCOL_GSS_SCHANNEL 14
503#define DCE_C_RPC_AUTHN_PROTOCOL_GSS_KERBEROS 16
504#define DCE_C_RPC_AUTHN_PROTOCOL_DPA 17
505#define DCE_C_RPC_AUTHN_PROTOCOL_MSN 18
506#define DCE_C_RPC_AUTHN_PROTOCOL_DIGEST 21
507#define DCE_C_RPC_AUTHN_PROTOCOL_SEC_CHAN 68
508#define DCE_C_RPC_AUTHN_PROTOCOL_MQ 100
509
510/* Protection levels */
511
512#define DCE_C_AUTHN_LEVEL_NONE 1
513#define DCE_C_AUTHN_LEVEL_CONNECT 2
514#define DCE_C_AUTHN_LEVEL_CALL 3
515#define DCE_C_AUTHN_LEVEL_PKT 4
516#define DCE_C_AUTHN_LEVEL_PKT_INTEGRITY 5
517#define DCE_C_AUTHN_LEVEL_PKT_PRIVACY 6
518
519 void
520free_ndr_pointer_list(dcerpc_info *di);
521 void
522init_ndr_pointer_list(dcerpc_info *di);
523
524
525
526/* These defines are used in the PIDL conformance files when using
527 * the PARAM_VALUE directive.
528 */
529/* Policy handle tracking. Describes in which function a handle is
530 * opened/closed. See "winreg.cnf" for example.
531 *
532 * The uint32_t param is divided up into multiple fields
533 *
534 * +--------+--------+--------+--------+
535 * | Flags | Type | | |
536 * +--------+--------+--------+--------+
537 */
538/* Flags : */
539#define PIDL_POLHND_OPEN 0x80000000
540#define PIDL_POLHND_CLOSE 0x40000000
541#define PIDL_POLHND_USE 0x00000000 /* just use, not open or cose */
542/* To "save" a pointer to the string in dcv->private_data */
543#define PIDL_STR_SAVE 0x20000000
544/* To make this value appear on the summary line for the packet */
545#define PIDL_SET_COL_INFO 0x10000000
546
547/* Type */
548#define PIDL_POLHND_TYPE_MASK 0x00ff0000
549#define PIDL_POLHND_TYPE_SAMR_USER 0x00010000
550#define PIDL_POLHND_TYPE_SAMR_CONNECT 0x00020000
551#define PIDL_POLHND_TYPE_SAMR_DOMAIN 0x00030000
552#define PIDL_POLHND_TYPE_SAMR_GROUP 0x00040000
553#define PIDL_POLHND_TYPE_SAMR_ALIAS 0x00050000
554
555#define PIDL_POLHND_TYPE_LSA_POLICY 0x00060000
556#define PIDL_POLHND_TYPE_LSA_ACCOUNT 0x00070000
557#define PIDL_POLHND_TYPE_LSA_SECRET 0x00080000
558#define PIDL_POLHND_TYPE_LSA_DOMAIN 0x00090000
559
560/* a structure we store for all policy handles we track */
561 typedef struct pol_value {
562 struct pol_value *next; /* Next entry in hash bucket */
563 uint32_t open_frame, close_frame; /* Frame numbers for open/close */
564 uint32_t first_frame; /* First frame in which this instance was seen */
565 uint32_t last_frame; /* Last frame in which this instance was seen */
566 char *name; /* Name of policy handle */
567 uint32_t type; /* policy handle type */
568} pol_value;
569
570
571 extern int hf_dcerpc_drep_byteorder;
572 extern int hf_dcerpc_ndr_padding;
573
574#define FAKE_DCERPC_INFO_STRUCTURE \
575 /* Fake dcerpc_info structure */ \
576 dcerpc_info di; \
577 dcerpc_call_value call_data; \
578 \
579 di.conformant_run = false; \
580 di.no_align = true; \
581 \
582 /* we need di->call_data->flags.NDR64 == 0 */ \
583 call_data.flags = 0; \
584 di.call_data = &call_data;
585
586#ifdef __cplusplus
587}
588#endif /* __cplusplus */
589
590#endif /* packet-dcerpc.h */
conversation.h
_address
Definition address.h:58
_dcerpc_auth_info
Definition packet-dcerpc.h:94
_dcerpc_auth_subdissector_fns
Definition packet-dcerpc.h:450
_dcerpc_call_value
Definition packet-dcerpc.h:128
_dcerpc_info
Definition packet-dcerpc.h:154
_dcerpc_sub_dissector
Definition packet-dcerpc.h:411
_dcerpc_uuid_value
Definition packet-dcerpc.h:432
_e_ctx_hnd
Definition packet-dcerpc.h:54
_e_dce_cn_common_hdr_t
Definition packet-dcerpc.h:59
_e_dce_dg_common_hdr_t
Definition packet-dcerpc.h:70
_e_guid_t
Definition guid-utils.h:23
_packet_info
Definition packet_info.h:43
_proto_node
Definition proto.h:907
_protocol
Definition proto.c:385
_value_string
Mapping between a 32-bit integer value and its string representation.
Definition value_string.h:33
conversation
Definition conversation.h:230
dcerpcstat_tap_data
Definition packet-dcerpc.h:109
decode_dcerpc_bind_values_s
Definition packet-dcerpc.h:471
nstime_t
Definition nstime.h:26
pol_value
Definition packet-dcerpc.h:561
tvbuff
Definition tvbuff-int.h:36