2 * Copyright 2001, Todd Sabin <tas@webspan.net>
4 * $Id: packet-dcerpc.h,v 1.16 2002/05/23 12:23:29 sahlberg Exp $
6 * Ethereal - Network traffic analyzer
7 * By Gerald Combs <gerald@ethereal.com>
8 * Copyright 1998 Gerald Combs
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25 #ifndef __PACKET_DCERPC_H__
26 #define __PACKET_DCERPC_H__
28 #include <epan/conversation.h>
30 typedef struct _e_uuid_t {
37 typedef struct _e_ctx_hnd {
42 typedef struct _e_dce_cn_common_hdr_t {
51 } e_dce_cn_common_hdr_t;
53 typedef struct _e_dce_dg_common_hdr_t {
73 } e_dce_dg_common_hdr_t;
87 #define PDU_BIND_ACK 12
88 #define PDU_BIND_NAK 13
90 #define PDU_ALTER_ACK 15
94 * helpers for packet-dcerpc.c and packet-dcerpc-ndr.c
95 * If you're writing a subdissector, you almost certainly want the
96 * NDR functions below.
98 guint16 dcerpc_tvb_get_ntohs (tvbuff_t *tvb, gint offset, char *drep);
99 guint32 dcerpc_tvb_get_ntohl (tvbuff_t *tvb, gint offset, char *drep);
100 void dcerpc_tvb_get_uuid (tvbuff_t *tvb, gint offset, char *drep, e_uuid_t *uuid);
101 int dissect_dcerpc_uint8 (tvbuff_t *tvb, gint offset, packet_info *pinfo,
102 proto_tree *tree, char *drep,
103 int hfindex, guint8 *pdata);
104 int dissect_dcerpc_uint16 (tvbuff_t *tvb, gint offset, packet_info *pinfo,
105 proto_tree *tree, char *drep,
106 int hfindex, guint16 *pdata);
107 int dissect_dcerpc_uint32 (tvbuff_t *tvb, gint offset, packet_info *pinfo,
108 proto_tree *tree, char *drep,
109 int hfindex, guint32 *pdata);
110 int dissect_dcerpc_uint64 (tvbuff_t *tvb, gint offset, packet_info *pinfo,
111 proto_tree *tree, char *drep,
112 int hfindex, unsigned char *pdata);
116 * NDR routines for subdissectors.
118 int dissect_ndr_uint8 (tvbuff_t *tvb, gint offset, packet_info *pinfo,
119 proto_tree *tree, char *drep,
120 int hfindex, guint8 *pdata);
121 int dissect_ndr_uint16 (tvbuff_t *tvb, gint offset, packet_info *pinfo,
122 proto_tree *tree, char *drep,
123 int hfindex, guint16 *pdata);
124 int dissect_ndr_uint32 (tvbuff_t *tvb, gint offset, packet_info *pinfo,
125 proto_tree *tree, char *drep,
126 int hfindex, guint32 *pdata);
127 int dissect_ndr_uint64 (tvbuff_t *tvb, gint offset, packet_info *pinfo,
128 proto_tree *tree, char *drep,
129 int hfindex, unsigned char *pdata);
130 int dissect_ndr_uuid_t (tvbuff_t *tvb, gint offset, packet_info *pinfo,
131 proto_tree *tree, char *drep,
132 int hfindex, e_uuid_t *pdata);
133 int dissect_ndr_ctx_hnd (tvbuff_t *tvb, gint offset, packet_info *pinfo,
134 proto_tree *tree, char *drep,
135 int hfindex, e_ctx_hnd *pdata);
138 typedef int (dcerpc_dissect_fnct_t)(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, char *drep);
140 #define NDR_POINTER_REF 1
141 #define NDR_POINTER_UNIQUE 2
142 #define NDR_POINTER_PTR 3
144 int dissect_ndr_pointer (tvbuff_t *tvb, gint offset, packet_info *pinfo,
145 proto_tree *tree, char *drep,
146 dcerpc_dissect_fnct_t *fnct, int type, char *text, int hf_index, int levels);
148 /* dissect a NDR unidimensional conformant array */
149 int dissect_ndr_ucarray(tvbuff_t *tvb, gint offset, packet_info *pinfo,
150 proto_tree *tree, char *drep,
151 dcerpc_dissect_fnct_t *fnct);
153 /* dissect a NDR unidimensional conformant and varying array */
154 int dissect_ndr_ucvarray(tvbuff_t *tvb, gint offset, packet_info *pinfo,
155 proto_tree *tree, char *drep,
156 dcerpc_dissect_fnct_t *fnct);
160 typedef struct _dcerpc_sub_dissector {
163 dcerpc_dissect_fnct_t *dissect_rqst;
164 dcerpc_dissect_fnct_t *dissect_resp;
165 } dcerpc_sub_dissector;
167 /* registration function for subdissectors */
168 void dcerpc_init_uuid (int proto, int ett, e_uuid_t *uuid, guint16 ver, dcerpc_sub_dissector *procs);
170 /* Private data structure to pass to DCERPC dissector. This is used to
171 pass transport specific information down to the dissector from the
172 dissector that parsed this encapsulated calls. */
174 #define DCERPC_TRANSPORT_SMB 1
176 typedef struct _dcerpc_private_info {
177 int transport_type; /* Tag */
180 struct { /* DCERPC_TRANSPORT_SMB */
184 } dcerpc_private_info;
186 /* Private data passed to subdissectors from the main DCERPC dissector. */
187 typedef struct _dcerpc_call_value {
197 typedef struct _dcerpc_info {
198 conversation_t *conv; /* Which TCP stream we are in */
199 guint32 call_id; /* Context id for this call */
200 guint16 smb_fid; /* FID for DCERPC over SMB */
202 gboolean conformant_run;
203 gint32 conformant_eaten; /* how many bytes did the conformant run eat?*/
204 guint32 array_max_count; /* max_count for conformant arrays */
205 guint32 array_max_count_offset;
206 guint32 array_offset;
207 guint32 array_offset_offset;
208 guint32 array_actual_count;
209 guint32 array_actual_count_offset;
211 int levels; /* number of levels upwards in the tree to append text*/
212 dcerpc_call_value *call_data;
216 #endif /* packet-dcerpc.h */