0f3914064b4e8bd8d25bdc005e6751e468defc40
[metze/wireshark/wip.git] / epan / dissectors / packet-dcom.h
1 /* packet-dcom.h
2  * Routines for DCOM generics
3  *
4  * $Id$
5  *
6  * Wireshark - Network traffic analyzer
7  * By Gerald Combs <gerald@wireshark.org>
8  * Copyright 1998 Gerald Combs
9  * 
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.
14  * 
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.
19  * 
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.
23  */
24
25 #ifndef __PACKET_DCERPC_DCOM_H
26 #define __PACKET_DCERPC_DCOM_H
27
28
29 extern const value_string dcom_hresult_vals[];
30 extern const value_string dcom_variant_type_vals[];
31 extern const value_string dcom_protseq_vals[];
32
33 extern int hf_dcom_iid;
34 extern int hf_dcom_clsid;
35 extern int hf_dcom_oxid;
36 extern int hf_dcom_oid;
37 extern int hf_dcom_ipid;
38
39 /* preferences */
40 extern int dcom_prefs_display_unmarshalling_details;
41
42
43 typedef struct dcom_machine_s {
44     GList           *objects;
45     gint            first_packet;
46
47     const guint8    ip[4];
48 } dcom_machine_t;
49
50 typedef struct dcom_object_s {
51     dcom_machine_t  *parent;
52     GList           *interfaces;
53     void            *private_data;
54     gint            first_packet;
55
56     guint64         oid;
57     guint64         oxid;
58 } dcom_object_t;
59
60 typedef struct dcom_interface_s {
61     dcom_object_t   *parent;
62     void            *private_data;
63     gint            first_packet;
64
65     e_uuid_t        iid;
66     e_uuid_t        ipid;   /* the DCE/RPC Object UUID */
67 } dcom_interface_t;
68
69
70 extern dcom_interface_t *dcom_interface_new(packet_info *pinfo, const guint8 *ip, e_uuid_t *iid, guint64 oxid, guint64 oid, e_uuid_t *ipid);
71 extern dcom_interface_t *dcom_interface_find(packet_info *pinfo, const guint8 *ip, e_uuid_t *ipid);
72 extern void dcom_interface_dump(void);
73
74
75 /* the essential DCOM this and that, starting every call */
76 extern int
77 dissect_dcom_this(tvbuff_t *tvb, int offset,
78         packet_info *pinfo, proto_tree *tree, guint8 *drep);
79 extern int
80 dissect_dcom_that(tvbuff_t *tvb, int offset,
81         packet_info *pinfo, proto_tree *tree, guint8 *drep);
82
83
84 /* dissection of somewhat more simple data types */
85 #define dissect_dcom_BOOLEAN            dissect_ndr_uint8
86 #define dissect_dcom_BYTE                       dissect_ndr_uint8
87 #define dissect_dcom_WORD                       dissect_ndr_uint16
88 #define dissect_dcom_DWORD                      dissect_ndr_uint32
89 #define dissect_dcom_I8                 dissect_ndr_uint64
90 #define dissect_dcom_ID                         dissect_ndr_duint32
91 #define dissect_dcom_UUID                       dissect_ndr_uuid_t
92 #define dissect_dcom_FILETIME           dissect_ndr_duint32 /* ToBeDone */
93 #define dissect_dcom_VARIANT_BOOL       dissect_ndr_uint16
94 #define dissect_dcom_FLOAT                      dissect_ndr_float
95 #define dissect_dcom_DOUBLE                     dissect_ndr_double
96 #define dissect_dcom_DATE                       dissect_ndr_double
97
98 extern int
99 dissect_dcom_append_UUID(tvbuff_t *tvb, int offset,
100         packet_info *pinfo, proto_tree *tree, guint8 *drep,
101         int hfindex, const gchar *field_name, int field_index, e_uuid_t *uuid);
102 extern const gchar* dcom_uuid_to_str(e_uuid_t *uuid);
103
104 extern int
105 dissect_dcom_indexed_WORD(tvbuff_t *tvb, int offset,    packet_info *pinfo,
106                                          proto_tree *tree, guint8 *drep, 
107                                          int hfindex, guint16 * pu16WORD, int field_index);
108
109 extern int
110 dissect_dcom_indexed_DWORD(tvbuff_t *tvb, int offset,   packet_info *pinfo,
111                                          proto_tree *tree, guint8 *drep, 
112                                          int hfindex, guint32 * pu32DWORD, int field_index);
113
114 extern int
115 dissect_dcom_HRESULT(tvbuff_t *tvb, int offset,
116         packet_info *pinfo, proto_tree *tree, guint8 *drep, guint32 * pu32hresult);
117
118 extern int
119 dissect_dcom_indexed_HRESULT(tvbuff_t *tvb, int offset, packet_info *pinfo,
120                                          proto_tree *tree, guint8 *drep, 
121                                          guint32 * pu32hresult, int field_index);
122
123 extern int
124 dissect_dcom_COMVERSION(tvbuff_t *tvb, int offset,
125         packet_info *pinfo, proto_tree *tree, guint8 *drep,
126         guint16 * pu16version_major, guint16 * pu16version_minor);
127
128 extern int
129 dissect_dcom_LPWSTR(tvbuff_t *tvb, gint offset, packet_info *pinfo,
130                        proto_tree *tree, guint8 *drep, int hfindex,
131                                            gchar *psz_buffer, guint32 u32max_buffer);
132
133 extern int
134 dissect_dcom_indexed_LPWSTR(tvbuff_t *tvb, gint offset, packet_info *pinfo,
135                        proto_tree *tree, guint8 *drep, int hfindex,
136                                            gchar *pszStr, guint32 u32MaxStr, int field_index);
137
138 extern int
139 dissect_dcom_BSTR(tvbuff_t *tvb, gint offset, packet_info *pinfo,
140                        proto_tree *tree, guint8 *drep, int hfindex,
141                                            gchar *psz_buffer, guint32 u32max_buffer);
142
143 extern int
144 dissect_dcom_DUALSTRINGARRAY(tvbuff_t *tvb, gint offset, packet_info *pinfo,
145                        proto_tree *tree, guint8 *drep, int hfindex, gchar *ip);
146
147 extern int
148 dissect_dcom_STDOBJREF(tvbuff_t *tvb, gint offset, packet_info *pinfo,
149                        proto_tree *tree, guint8 *drep, int hfindex,
150                        guint64 *oxid, guint64 *oid, e_uuid_t *ipid);
151 extern int
152 dissect_dcom_OBJREF(tvbuff_t *tvb, gint offset, packet_info *pinfo,
153                        proto_tree *tree, guint8 *drep, int hfindex, dcom_interface_t **interf);
154
155 extern int
156 dissect_dcom_MInterfacePointer(tvbuff_t *tvb, gint offset, packet_info *pinfo,
157                        proto_tree *tree, guint8 *drep, int hfindex, dcom_interface_t **interf);
158 extern int
159 dissect_dcom_PMInterfacePointer(tvbuff_t *tvb, gint offset, packet_info *pinfo,
160                        proto_tree *tree, guint8 *drep, int hfindex, dcom_interface_t **interf);
161
162 extern int
163 dissect_dcom_VARTYPE(tvbuff_t *tvb, int offset,
164         packet_info *pinfo, proto_tree *tree, guint8 *drep,
165         guint16 *pu16Vartype);
166
167 extern int
168 dissect_dcom_VARIANT(tvbuff_t *tvb, int offset, packet_info *pinfo, 
169                                          proto_tree *tree, guint8 *drep, int hfindex);
170
171 /* dcom "dcerpc internal" unmarshalling */
172 extern int
173 dissect_dcom_dcerpc_array_size(tvbuff_t *tvb, gint offset, packet_info *pinfo,
174                        proto_tree *tree, guint8 *drep, guint32 *pu32array_size);
175
176 extern int
177 dissect_dcom_dcerpc_pointer(tvbuff_t *tvb, gint offset, packet_info *pinfo,
178                        proto_tree *tree, guint8 *drep, guint32 *pu32pointer);
179
180 /* mark things to be done */
181 extern int
182 dissect_dcom_tobedone_data(tvbuff_t *tvb, int offset,
183         packet_info *pinfo, proto_tree *tree, guint8 *drep, int length);
184
185 /* very simple parameter-profiles dissectors (for very simple requests ;-) */
186 /* request: no parameters */
187 extern int 
188 dissect_dcom_simple_rqst(tvbuff_t *tvb, int offset,
189         packet_info *pinfo, proto_tree *tree, guint8 *drep);
190 /* response: only HRESULT */
191 extern int 
192 dissect_dcom_simple_resp(tvbuff_t *tvb, int offset,
193         packet_info *pinfo, proto_tree *tree, guint8 *drep);
194
195 void dcom_register_server_coclass(int proto, int ett,
196         e_uuid_t *uuid, guint16 ver, 
197         dcerpc_sub_dissector *sub_dissectors, int opnum_hf);
198
199 #endif /* packet-dcerpc-dcom.h */