Add HP Switch Protocol SAP value
[obnox/wireshark/wip.git] / epan / dissectors / packet-rpc.h
1 /* packet-rpc.h
2  *
3  * $Id$
4  *
5  * (c) 1999 Uwe Girlich
6  *
7  * Wireshark - Network traffic analyzer
8  * By Gerald Combs <gerald@wireshark.org>
9  * Copyright 1998 Gerald Combs
10  *
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.
15  *
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.
20  *
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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
24  */
25
26 #ifndef __PACKET_RPC_H__
27 #define __PACKET_RPC_H__
28
29 #include <glib.h>
30 #include <epan/packet.h>
31 #include <epan/conversation.h>
32
33 #define RPC_CALL 0
34 #define RPC_REPLY 1
35
36 #define AUTH_NULL 0
37 #define AUTH_UNIX 1
38 #define AUTH_SHORT 2
39 #define AUTH_DES 3
40 #define RPCSEC_GSS 6
41 #define AUTH_GSSAPI 300001
42
43 #define MSG_ACCEPTED 0
44 #define MSG_DENIED 1
45
46 #define SUCCESS 0
47 #define PROG_UNAVAIL 1
48 #define PROG_MISMATCH 2
49 #define PROC_UNAVAIL 3
50 #define GARBAGE_ARGS 4
51 #define SYSTEM_ERROR 5
52
53 #define RPC_MISMATCH 0
54 #define AUTH_ERROR 1
55
56 #define AUTH_BADCRED 1
57 #define AUTH_REJECTEDCRED 2
58 #define AUTH_BADVERF 3
59 #define AUTH_REJECTEDVERF 4
60 #define AUTH_TOOWEAK 5
61 #define RPCSEC_GSSCREDPROB 13
62 #define RPCSEC_GSSCTXPROB 14
63
64 #define RPCSEC_GSS_DATA 0
65 #define RPCSEC_GSS_INIT 1
66 #define RPCSEC_GSS_CONTINUE_INIT 2
67 #define RPCSEC_GSS_DESTROY 3
68
69 #define AUTH_GSSAPI_EXIT 0
70 #define AUTH_GSSAPI_INIT 1
71 #define AUTH_GSSAPI_CONTINUE_INIT 2
72 #define AUTH_GSSAPI_MSG 3
73 #define AUTH_GSSAPI_DESTROY 4
74
75 #define RPCSEC_GSS_SVC_NONE 1
76 #define RPCSEC_GSS_SVC_INTEGRITY 2
77 #define RPCSEC_GSS_SVC_PRIVACY 3
78
79 #define AUTHDES_NAMEKIND_FULLNAME 0
80 #define AUTHDES_NAMEKIND_NICKNAME 1
81
82 extern value_string rpc_authgss_svc[];
83 typedef enum {
84         FLAVOR_UNKNOWN,         /* authentication flavor unknown */
85         FLAVOR_NOT_GSSAPI,      /* flavor isn't GSSAPI */
86         FLAVOR_GSSAPI_NO_INFO,  /* flavor is GSSAPI, procedure & service unknown */
87         FLAVOR_GSSAPI,          /* flavor is GSSAPI, procedure & service known */
88         FLAVOR_AUTHGSSAPI,      /* AUTH_GSSAPI flavor */
89         FLAVOR_AUTHGSSAPI_MSG   /* AUTH_GSSAPI flavor, AUTH_GSSAPI message */
90 } flavor_t;
91
92 typedef struct _rpc_call_info_value {
93         guint32 req_num;        /* frame number of first request seen */
94         guint32 rep_num;        /* frame number of first reply seen */
95         guint32 prog;
96         guint32 vers;
97         guint32 proc;
98         guint32 xid;
99         flavor_t flavor;
100         guint32 gss_proc;
101         guint32 gss_svc;
102         struct _rpc_proc_info_value*    proc_info;
103         gboolean request;       /* Is this a request or not ?*/
104         nstime_t req_time;
105         void *private_data;
106 } rpc_call_info_value;
107
108
109 typedef int (dissect_function_t)(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree* tree);
110
111 typedef struct _vsff {
112         guint32 value;
113         const gchar   *strptr;
114         dissect_function_t *dissect_call;
115         dissect_function_t *dissect_reply;
116 } vsff;
117
118 extern const value_string rpc_auth_flavor[];
119
120 extern void rpc_init_proc_table(guint prog, guint vers, const vsff *proc_table,
121     int procedure_hf);
122 extern void rpc_init_prog(int proto, guint32 prog, int ett);
123 extern const char *rpc_prog_name(guint32 prog);
124 extern const char *rpc_proc_name(guint32 prog, guint32 vers, guint32 proc);
125 extern int rpc_prog_hf(guint32 prog, guint32 vers);
126
127 extern unsigned int rpc_roundup(unsigned int a);
128 extern int dissect_rpc_bool(tvbuff_t *tvb,
129         proto_tree *tree, int hfindex, int offset);
130 extern int dissect_rpc_string(tvbuff_t *tvb,
131         proto_tree *tree, int hfindex, int offset, char **string_buffer_ret);
132 int dissect_rpc_opaque_data(tvbuff_t *tvb, int offset,
133     proto_tree *tree,
134     packet_info *pinfo,
135     int hfindex,
136     gboolean fixed_length, guint32 length,
137     gboolean string_data, char **string_buffer_ret,
138     dissect_function_t *dissect_it);
139 extern int dissect_rpc_data(tvbuff_t *tvb,
140         proto_tree *tree, int hfindex, int offset);
141 extern int dissect_rpc_bytes(tvbuff_t *tvb,
142         proto_tree *tree, int hfindex, int offset, guint32 length,
143         gboolean string_data, char **string_buffer_ret);
144 extern int dissect_rpc_list(tvbuff_t *tvb, packet_info *pinfo,
145         proto_tree *tree, int offset, dissect_function_t *rpc_list_dissector);
146 extern int dissect_rpc_array(tvbuff_t *tvb, packet_info *pinfo,
147         proto_tree *tree, int offset, dissect_function_t *rpc_array_dissector,
148         int hfindex);
149 extern int dissect_rpc_uint32(tvbuff_t *tvb,
150         proto_tree *tree, int hfindex, int offset);
151 extern int dissect_rpc_uint64(tvbuff_t *tvb,
152         proto_tree *tree, int hfindex, int offset);
153
154 extern int dissect_rpc_indir_call(tvbuff_t *tvb, packet_info *pinfo,
155         proto_tree *tree, int offset, int args_id, guint32 prog, guint32 vers,
156         guint32 proc);
157 extern int dissect_rpc_indir_reply(tvbuff_t *tvb, packet_info *pinfo,
158         proto_tree *tree, int offset, int result_id, int prog_id, int vers_id,
159         int proc_id);
160
161
162 typedef struct _rpc_prog_info_key {
163         guint32 prog;
164 } rpc_prog_info_key;
165
166 typedef struct _rpc_prog_info_value {
167         protocol_t *proto;
168         int proto_id;
169         int ett;
170         const char* progname;
171         GArray *procedure_hfs;
172 } rpc_prog_info_value;
173
174 /* rpc_progs is also used in tap. With MSVC and a 
175  * libwireshark.dll, we need a special declaration.
176  */
177 WS_VAR_IMPORT GHashTable *rpc_progs;
178
179 typedef struct _rpc_proc_info_key {
180         guint32 prog;
181         guint32 vers;
182         guint32 proc;
183 } rpc_proc_info_key;
184
185 typedef struct _rpc_proc_info_value {
186         const gchar     *name;
187         dissect_function_t *dissect_call;
188         dissect_function_t *dissect_reply;
189 } rpc_proc_info_value;
190
191 /* rpc_procs is also used in tap. With MSVC and a 
192  * libwireshark.dll, we need a special declaration.
193  */
194 WS_VAR_IMPORT GHashTable *rpc_procs;
195
196 #endif /* packet-rpc.h */
197