MSWSP: fix dissect_mswsp_smb()
[wireshark-wip.git] / epan / dissectors / packet-rpc.h
blob9ee7fc2fe7a1eba9b8f92ff7cd88391a158ec404
1 /* packet-rpc.h
3 * $Id$
5 * (c) 1999 Uwe Girlich
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@wireshark.org>
9 * Copyright 1998 Gerald Combs
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 #ifndef __PACKET_RPC_H__
27 #define __PACKET_RPC_H__
29 #include <glib.h>
30 #include <epan/packet.h>
31 #include <epan/conversation.h>
32 #include "ws_symbol_export.h"
34 #define RPC_CALL 0
35 #define RPC_REPLY 1
37 #define AUTH_NULL 0
38 #define AUTH_UNIX 1
39 #define AUTH_SHORT 2
40 #define AUTH_DES 3
41 #define AUTH_KRB4 4
42 #define AUTH_RSA 5
43 #define RPCSEC_GSS 6
44 #define AUTH_GSSAPI 300001
45 /* Pseudo-flavors used for security mechanisms while using
46 * RPCSEC_GSS
48 #define RPCSEC_GSS_KRB5 390003
49 #define RPCSEC_GSS_KRB5I 390004
50 #define RPCSEC_GSS_KRB5P 390005
51 #define RPCSEC_GSS_LIPKEY 390006
52 #define RPCSEC_GSS_LIPKEY_I 390007
53 #define RPCSEC_GSS_LIPKEY_P 390008
54 #define RPCSEC_GSS_SPKM3 390009
55 #define RPCSEC_GSS_SPKM3I 390010
56 #define RPCSEC_GSS_SPKM3P 390011
57 /* GlusterFS requested an RPC-AUTH number from IANA,
58 * until a number has been granted 390039 is used.
59 * See also: http://review.gluster.com/3230
61 #define AUTH_GLUSTERFS 390039
63 #define MSG_ACCEPTED 0
64 #define MSG_DENIED 1
66 #define SUCCESS 0
67 #define PROG_UNAVAIL 1
68 #define PROG_MISMATCH 2
69 #define PROC_UNAVAIL 3
70 #define GARBAGE_ARGS 4
71 #define SYSTEM_ERROR 5
73 #define RPC_MISMATCH 0
74 #define AUTH_ERROR 1
76 #define AUTH_BADCRED 1
77 #define AUTH_REJECTEDCRED 2
78 #define AUTH_BADVERF 3
79 #define AUTH_REJECTEDVERF 4
80 #define AUTH_TOOWEAK 5
81 #define RPCSEC_GSSCREDPROB 13
82 #define RPCSEC_GSSCTXPROB 14
84 #define RPCSEC_GSS_DATA 0
85 #define RPCSEC_GSS_INIT 1
86 #define RPCSEC_GSS_CONTINUE_INIT 2
87 #define RPCSEC_GSS_DESTROY 3
89 #define AUTH_GSSAPI_EXIT 0
90 #define AUTH_GSSAPI_INIT 1
91 #define AUTH_GSSAPI_CONTINUE_INIT 2
92 #define AUTH_GSSAPI_MSG 3
93 #define AUTH_GSSAPI_DESTROY 4
95 #define RPCSEC_GSS_SVC_NONE 1
96 #define RPCSEC_GSS_SVC_INTEGRITY 2
97 #define RPCSEC_GSS_SVC_PRIVACY 3
99 #define AUTHDES_NAMEKIND_FULLNAME 0
100 #define AUTHDES_NAMEKIND_NICKNAME 1
102 #define RPC_STRING_EMPTY "<EMPTY>"
103 #define RPC_STRING_DATA "<DATA>"
104 #define RPC_STRING_TRUNCATED "<TRUNCATED>"
106 #define RPC_RM_LASTFRAG 0x80000000U
107 #define RPC_RM_FRAGLEN 0x7fffffffU
109 extern const value_string rpc_authgss_svc[];
110 typedef enum {
111 FLAVOR_UNKNOWN, /* authentication flavor unknown */
112 FLAVOR_NOT_GSSAPI, /* flavor isn't GSSAPI */
113 FLAVOR_GSSAPI_NO_INFO, /* flavor is GSSAPI, procedure & service unknown */
114 FLAVOR_GSSAPI, /* flavor is GSSAPI, procedure & service known */
115 FLAVOR_AUTHGSSAPI, /* AUTH_GSSAPI flavor */
116 FLAVOR_AUTHGSSAPI_MSG /* AUTH_GSSAPI flavor, AUTH_GSSAPI message */
117 } flavor_t;
119 typedef struct _rpc_call_info_value {
120 guint32 req_num; /* frame number of first request seen */
121 guint32 rep_num; /* frame number of first reply seen */
122 guint32 prog;
123 guint32 vers;
124 guint32 proc;
125 guint32 xid;
126 flavor_t flavor;
127 guint32 gss_proc;
128 guint32 gss_svc;
129 struct _rpc_proc_info_value* proc_info;
130 gboolean request; /* Is this a request or not ?*/
131 nstime_t req_time;
132 void *private_data;
133 } rpc_call_info_value;
136 typedef int (dissect_function_t)(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree* tree, void* data);
138 typedef struct _vsff {
139 guint32 value;
140 const gchar *strptr;
141 dissect_function_t *dissect_call;
142 dissect_function_t *dissect_reply;
143 } vsff;
145 extern const value_string rpc_auth_flavor[];
147 WS_DLL_PUBLIC void rpc_init_proc_table(guint prog, guint vers, const vsff *proc_table,
148 int procedure_hf);
149 WS_DLL_PUBLIC void rpc_init_prog(int proto, guint32 prog, int ett);
150 WS_DLL_PUBLIC const char *rpc_prog_name(guint32 prog);
151 WS_DLL_PUBLIC const char *rpc_proc_name(guint32 prog, guint32 vers, guint32 proc);
152 WS_DLL_PUBLIC int rpc_prog_hf(guint32 prog, guint32 vers);
154 WS_DLL_PUBLIC unsigned int rpc_roundup(unsigned int a);
155 WS_DLL_PUBLIC int dissect_rpc_bool(tvbuff_t *tvb,
156 proto_tree *tree, int hfindex, int offset);
157 WS_DLL_PUBLIC int dissect_rpc_string(tvbuff_t *tvb,
158 proto_tree *tree, int hfindex, int offset, const char **string_buffer_ret);
159 WS_DLL_PUBLIC
160 int dissect_rpc_opaque_data(tvbuff_t *tvb, int offset,
161 proto_tree *tree,
162 packet_info *pinfo,
163 int hfindex,
164 gboolean fixed_length, guint32 length,
165 gboolean string_data, const char **string_buffer_ret,
166 dissect_function_t *dissect_it);
167 WS_DLL_PUBLIC int dissect_rpc_data(tvbuff_t *tvb,
168 proto_tree *tree, int hfindex, int offset);
169 WS_DLL_PUBLIC int dissect_rpc_bytes(tvbuff_t *tvb,
170 proto_tree *tree, int hfindex, int offset, guint32 length,
171 gboolean string_data, const char **string_buffer_ret);
172 WS_DLL_PUBLIC int dissect_rpc_list(tvbuff_t *tvb, packet_info *pinfo,
173 proto_tree *tree, int offset, dissect_function_t *rpc_list_dissector);
174 WS_DLL_PUBLIC int dissect_rpc_array(tvbuff_t *tvb, packet_info *pinfo,
175 proto_tree *tree, int offset, dissect_function_t *rpc_array_dissector,
176 int hfindex);
177 WS_DLL_PUBLIC int dissect_rpc_uint32(tvbuff_t *tvb,
178 proto_tree *tree, int hfindex, int offset);
179 WS_DLL_PUBLIC int dissect_rpc_uint64(tvbuff_t *tvb,
180 proto_tree *tree, int hfindex, int offset);
182 WS_DLL_PUBLIC int dissect_rpc_indir_call(tvbuff_t *tvb, packet_info *pinfo,
183 proto_tree *tree, int offset, int args_id, guint32 prog, guint32 vers,
184 guint32 proc);
185 WS_DLL_PUBLIC int dissect_rpc_indir_reply(tvbuff_t *tvb, packet_info *pinfo,
186 proto_tree *tree, int offset, int result_id, int prog_id, int vers_id,
187 int proc_id);
190 typedef struct _rpc_prog_info_key {
191 guint32 prog;
192 } rpc_prog_info_key;
194 typedef struct _rpc_prog_info_value {
195 protocol_t *proto;
196 int proto_id;
197 int ett;
198 const char* progname;
199 GArray *procedure_hfs;
200 } rpc_prog_info_value;
202 /* rpc_progs is also used in tap. With MSVC and a
203 * libwireshark.dll, we need a special declaration.
205 WS_DLL_PUBLIC GHashTable *rpc_progs;
207 typedef struct _rpc_proc_info_key {
208 guint32 prog;
209 guint32 vers;
210 guint32 proc;
211 } rpc_proc_info_key;
213 typedef struct _rpc_proc_info_value {
214 const gchar *name;
215 dissect_function_t *dissect_call;
216 dissect_function_t *dissect_reply;
217 } rpc_proc_info_value;
219 /* rpc_procs is also used in tap. With MSVC and a
220 * libwireshark.dll, we need a special declaration.
222 WS_DLL_PUBLIC GHashTable *rpc_procs;
224 #endif /* packet-rpc.h */