Wireshark  4.3.0
The Wireshark network protocol analyzer
packet-rpc.h
1 /* packet-rpc.h
2  *
3  * (c) 1999 Uwe Girlich
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_RPC_H__
13 #define __PACKET_RPC_H__
14 
15 #include <glib.h>
16 #include <epan/packet.h>
17 #include "ws_symbol_export.h"
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif /* __cplusplus */
22 
23 #define RPC_CALL 0
24 #define RPC_REPLY 1
25 
26 #define AUTH_NULL 0
27 #define AUTH_UNIX 1
28 #define AUTH_SHORT 2
29 #define AUTH_DES 3
30 #define AUTH_KRB4 4
31 #define AUTH_RSA 5
32 #define RPCSEC_GSS 6
33 #define AUTH_TLS 7
34 #define AUTH_GSSAPI 300001
35 /* Pseudo-flavors used for security mechanisms while using
36  * RPCSEC_GSS
37  */
38 #define RPCSEC_GSS_KRB5 390003
39 #define RPCSEC_GSS_KRB5I 390004
40 #define RPCSEC_GSS_KRB5P 390005
41 #define RPCSEC_GSS_LIPKEY 390006
42 #define RPCSEC_GSS_LIPKEY_I 390007
43 #define RPCSEC_GSS_LIPKEY_P 390008
44 #define RPCSEC_GSS_SPKM3 390009
45 #define RPCSEC_GSS_SPKM3I 390010
46 #define RPCSEC_GSS_SPKM3P 390011
47 /* GlusterFS requested an RPC-AUTH number from IANA,
48  * until a number has been granted 390039 is used.
49  * See also: http://review.gluster.com/3230
50  */
51 #define AUTH_GLUSTERFS 390039
52 #define AUTH_GLUSTERFS_V3 390040
53 
54 #define MSG_ACCEPTED 0
55 #define MSG_DENIED 1
56 
57 #define SUCCESS 0
58 #define PROG_UNAVAIL 1
59 #define PROG_MISMATCH 2
60 #define PROC_UNAVAIL 3
61 #define GARBAGE_ARGS 4
62 #define SYSTEM_ERROR 5
63 
64 #define RPC_MISMATCH 0
65 #define AUTH_ERROR 1
66 
67 #define AUTH_BADCRED 1
68 #define AUTH_REJECTEDCRED 2
69 #define AUTH_BADVERF 3
70 #define AUTH_REJECTEDVERF 4
71 #define AUTH_TOOWEAK 5
72 #define RPCSEC_GSSCREDPROB 13
73 #define RPCSEC_GSSCTXPROB 14
74 
75 #define RPCSEC_GSS_DATA 0
76 #define RPCSEC_GSS_INIT 1
77 #define RPCSEC_GSS_CONTINUE_INIT 2
78 #define RPCSEC_GSS_DESTROY 3
79 
80 #define AUTH_GSSAPI_EXIT 0
81 #define AUTH_GSSAPI_INIT 1
82 #define AUTH_GSSAPI_CONTINUE_INIT 2
83 #define AUTH_GSSAPI_MSG 3
84 #define AUTH_GSSAPI_DESTROY 4
85 
86 #define RPCSEC_GSS_SVC_NONE 1
87 #define RPCSEC_GSS_SVC_INTEGRITY 2
88 #define RPCSEC_GSS_SVC_PRIVACY 3
89 
90 #define AUTHDES_NAMEKIND_FULLNAME 0
91 #define AUTHDES_NAMEKIND_NICKNAME 1
92 
93 #define RPC_STRING_EMPTY "<EMPTY>"
94 #define RPC_STRING_DATA "<DATA>"
95 #define RPC_STRING_TRUNCATED "<TRUNCATED>"
96 
97 #define RPC_RM_LASTFRAG 0x80000000U
98 #define RPC_RM_FRAGLEN 0x7fffffffU
99 
100 extern const value_string rpc_authgss_svc[];
101 typedef enum {
102  FLAVOR_UNKNOWN, /* authentication flavor unknown */
103  FLAVOR_NOT_GSSAPI, /* flavor isn't GSSAPI */
104  FLAVOR_GSSAPI_NO_INFO, /* flavor is GSSAPI, procedure & service unknown */
105  FLAVOR_GSSAPI, /* flavor is GSSAPI, procedure & service known */
106  FLAVOR_AUTHGSSAPI, /* AUTH_GSSAPI flavor */
107  FLAVOR_AUTHGSSAPI_MSG /* AUTH_GSSAPI flavor, AUTH_GSSAPI message */
108 } flavor_t;
109 
110 typedef struct _rpc_call_info_value {
111  guint32 req_num; /* frame number of first request seen */
112  guint32 rep_num; /* frame number of first reply seen */
113  guint32 prog;
114  guint32 vers;
115  guint32 proc;
116  guint32 xid;
117  flavor_t flavor;
118  guint32 gss_proc;
119  guint32 gss_svc;
120  gboolean request; /* Is this a request or not ?*/
121  nstime_t req_time;
122  void *private_data;
124 
125 
126 typedef int (dissect_function_t)(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree* tree, void* data);
127 
128 /*
129  * Information about a particular version of a program.
130  */
131 typedef struct _vsff {
132  guint32 value;
133  const gchar *strptr;
134  dissector_t dissect_call;
135  dissector_t dissect_reply;
136 } vsff;
137 
138 typedef struct _rpc_proc_list {
139  guint vers;
140  const vsff *proc_table;
141  int *procedure_hf;
143 
144 extern const value_string rpc_auth_flavor[];
145 
146 WS_DLL_PUBLIC void rpc_init_prog(int proto, guint32 prog, int ett, size_t nvers,
147  const rpc_prog_vers_info *versions);
148 WS_DLL_PUBLIC const char *rpc_prog_name(guint32 prog);
149 WS_DLL_PUBLIC const char *rpc_proc_name(guint32 prog, guint32 vers, guint32 proc);
150 WS_DLL_PUBLIC int rpc_prog_hf(guint32 prog, guint32 vers);
151 
152 WS_DLL_PUBLIC unsigned int rpc_roundup(unsigned int a);
153 WS_DLL_PUBLIC int dissect_rpc_void(tvbuff_t *tvb,
154  packet_info *pinfo, proto_tree *tree, void *data);
155 WS_DLL_PUBLIC int dissect_rpc_unknown(tvbuff_t *tvb,
156  packet_info *pinfo, proto_tree *tree, void *data);
157 WS_DLL_PUBLIC int dissect_rpc_bool(tvbuff_t *tvb,
158  proto_tree *tree, int hfindex, int offset);
159 WS_DLL_PUBLIC int dissect_rpc_string(tvbuff_t *tvb,
160  proto_tree *tree, int hfindex, int offset, const char **string_buffer_ret);
161 WS_DLL_PUBLIC
162 int dissect_rpc_opaque_data(tvbuff_t *tvb, int offset,
163  proto_tree *tree,
164  packet_info *pinfo,
165  int hfindex,
166  gboolean fixed_length, guint32 length,
167  gboolean string_data, const char **string_buffer_ret,
168  dissect_function_t *dissect_it);
169 WS_DLL_PUBLIC int dissect_rpc_data(tvbuff_t *tvb,
170  proto_tree *tree, int hfindex, int offset);
171 WS_DLL_PUBLIC int dissect_rpc_bytes(tvbuff_t *tvb,
172  proto_tree *tree, int hfindex, int offset, guint32 length,
173  gboolean string_data, const char **string_buffer_ret);
174 WS_DLL_PUBLIC int dissect_rpc_list(tvbuff_t *tvb, packet_info *pinfo,
175  proto_tree *tree, int offset, dissect_function_t *rpc_list_dissector,
176  void *data);
177 WS_DLL_PUBLIC int dissect_rpc_array(tvbuff_t *tvb, packet_info *pinfo,
178  proto_tree *tree, int offset, dissect_function_t *rpc_array_dissector,
179  int hfindex);
180 WS_DLL_PUBLIC int dissect_rpc_uint32(tvbuff_t *tvb,
181  proto_tree *tree, int hfindex, int offset);
182 WS_DLL_PUBLIC int dissect_rpc_uint64(tvbuff_t *tvb,
183  proto_tree *tree, int hfindex, int offset);
184 
185 WS_DLL_PUBLIC int dissect_rpc_indir_call(tvbuff_t *tvb, packet_info *pinfo,
186  proto_tree *tree, int offset, int args_id, guint32 prog, guint32 vers,
187  guint32 proc);
188 WS_DLL_PUBLIC int dissect_rpc_indir_reply(tvbuff_t *tvb, packet_info *pinfo,
189  proto_tree *tree, int offset, int result_id, int prog_id, int vers_id,
190  int proc_id);
191 WS_DLL_PUBLIC int dissect_rpc_opaque_auth(tvbuff_t* tvb, proto_tree* tree,
192  int offset, packet_info *pinfo);
193 
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; /* int */
201 
202 /* rpc_progs is also used in tap. With MSVC and a
203  * libwireshark.dll, we need a special declaration.
204  */
205 /* Key: Program number (guint32)
206  * Value: rpc_prog_info_value *
207  */
208 WS_DLL_PUBLIC GHashTable *rpc_progs;
209 
210 typedef struct _rpc_proc_info_key {
211  guint32 prog;
212  guint32 vers;
213  guint32 proc;
215 
216 typedef struct rpcstat_tap_data
217 {
218  const char *prog;
219  guint32 program;
220  guint32 version;
221  int num_procedures;
223 
224 #ifdef __cplusplus
225 }
226 #endif /* __cplusplus */
227 
228 #endif /* packet-rpc.h */
Definition: packet_info.h:44
Definition: proto.h:904
Definition: proto.c:372
Definition: packet-rpc.h:110
Definition: packet-rpc.h:210
Definition: packet-rpc.h:138
Definition: packet-rpc.h:194
Definition: value_string.h:26
Definition: packet-rpc.h:131
Definition: nstime.h:26
Definition: packet-rpc.h:217
Definition: tvbuff-int.h:35