Add support for Exif decoding (initial framework).
[obnox/wireshark/wip.git] / packet-rpc.h
1 /* packet-rpc.h
2  *
3  * $Id: packet-rpc.h,v 1.45 2004/05/09 10:03:37 guy Exp $
4  *
5  * (c) 1999 Uwe Girlich
6  *
7  * Ethereal - Network traffic analyzer
8  * By Gerald Combs <gerald@ethereal.com>
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
52 #define RPC_MISMATCH 0
53 #define AUTH_ERROR 1
54
55 #define AUTH_BADCRED 1
56 #define AUTH_REJECTEDCRED 2
57 #define AUTH_BADVERF 3
58 #define AUTH_REJECTEDVERF 4
59 #define AUTH_TOOWEAK 5
60 #define RPCSEC_GSSCREDPROB 13
61 #define RPCSEC_GSSCTXPROB 14
62
63 #define RPCSEC_GSS_DATA 0
64 #define RPCSEC_GSS_INIT 1
65 #define RPCSEC_GSS_CONTINUE_INIT 2
66 #define RPCSEC_GSS_DESTROY 3
67
68 #define AUTH_GSSAPI_EXIT 0
69 #define AUTH_GSSAPI_INIT 1
70 #define AUTH_GSSAPI_CONTINUE_INIT 2
71 #define AUTH_GSSAPI_MSG 3
72 #define AUTH_GSSAPI_DESTROY 4
73
74 #define RPCSEC_GSS_SVC_NONE 1
75 #define RPCSEC_GSS_SVC_INTEGRITY 2
76 #define RPCSEC_GSS_SVC_PRIVACY 3
77
78 #define AUTHDES_NAMEKIND_FULLNAME 0
79 #define AUTHDES_NAMEKIND_NICKNAME 1
80
81 extern value_string rpc_authgss_svc[];
82 typedef enum {
83         FLAVOR_UNKNOWN,         /* authentication flavor unknown */
84         FLAVOR_NOT_GSSAPI,      /* flavor isn't GSSAPI */
85         FLAVOR_GSSAPI_NO_INFO,  /* flavor is GSSAPI, procedure & service unknown */
86         FLAVOR_GSSAPI,          /* flavor is GSSAPI, procedure & service known */
87         FLAVOR_AUTHGSSAPI,      /* AUTH_GSSAPI flavor */
88         FLAVOR_AUTHGSSAPI_MSG   /* AUTH_GSSAPI flavor, AUTH_GSSAPI message */
89 } flavor_t;
90
91 typedef struct _rpc_call_info_value {
92         guint32 req_num;        /* frame number of first request seen */
93         guint32 rep_num;        /* frame number of first reply seen */
94         guint32 prog;
95         guint32 vers;
96         guint32 proc;
97         guint32 xid;
98         flavor_t flavor;
99         guint32 gss_proc;
100         guint32 gss_svc;
101         struct _rpc_proc_info_value*    proc_info;
102         gboolean request;       /* Is this a request or not ?*/
103         nstime_t req_time;
104         void *private_data;
105 } rpc_call_info_value;
106
107
108 typedef int (dissect_function_t)(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree* tree);
109
110 typedef struct _vsff {
111         guint32 value;
112         gchar   *strptr;
113         dissect_function_t *dissect_call;
114         dissect_function_t *dissect_reply;
115 } vsff;
116
117 extern const value_string rpc_auth_flavor[];
118
119 extern void rpc_init_proc_table(guint prog, guint vers, const vsff *proc_table,
120     int procedure_hf);
121 extern void rpc_init_prog(int proto, guint32 prog, int ett);
122 extern char *rpc_prog_name(guint32 prog);
123 extern char *rpc_proc_name(guint32 prog, guint32 vers, guint32 proc);
124 extern int rpc_prog_hf(guint32 prog, guint32 vers);
125
126 extern unsigned int rpc_roundup(unsigned int a);
127 extern int dissect_rpc_bool(tvbuff_t *tvb,
128         proto_tree *tree, int hfindex, int offset);
129 extern int dissect_rpc_string(tvbuff_t *tvb,
130         proto_tree *tree, int hfindex, int offset, char **string_buffer_ret);
131 int dissect_rpc_opaque_data(tvbuff_t *tvb, int offset,
132     proto_tree *tree,
133     packet_info *pinfo,
134     int hfindex,
135     gboolean fixed_length, guint32 length,
136     gboolean string_data, char **string_buffer_ret,
137     dissect_function_t *dissect_it);
138 extern int dissect_rpc_data(tvbuff_t *tvb,
139         proto_tree *tree, int hfindex, int offset);
140 extern int dissect_rpc_bytes(tvbuff_t *tvb,
141         proto_tree *tree, int hfindex, int offset, guint32 length,
142         gboolean string_data, char **string_buffer_ret);
143 extern int dissect_rpc_list(tvbuff_t *tvb, packet_info *pinfo,
144         proto_tree *tree, int offset, dissect_function_t *rpc_list_dissector);
145 extern int dissect_rpc_array(tvbuff_t *tvb, packet_info *pinfo,
146         proto_tree *tree, int offset, dissect_function_t *rpc_array_dissector,
147         int hfindex);
148 extern int dissect_rpc_uint32(tvbuff_t *tvb,
149         proto_tree *tree, int hfindex, int offset);
150 extern int dissect_rpc_uint64(tvbuff_t *tvb,
151         proto_tree *tree, int hfindex, int offset);
152
153 extern int dissect_rpc_indir_call(tvbuff_t *tvb, packet_info *pinfo,
154         proto_tree *tree, int offset, int args_id, guint32 prog, guint32 vers,
155         guint32 proc);
156 extern int dissect_rpc_indir_reply(tvbuff_t *tvb, packet_info *pinfo,
157         proto_tree *tree, int offset, int result_id, int prog_id, int vers_id,
158         int proc_id);
159
160
161 typedef struct _rpc_prog_info_key {
162         guint32 prog;
163 } rpc_prog_info_key;
164
165 typedef struct _rpc_prog_info_value {
166         protocol_t *proto;
167         int proto_id;
168         int ett;
169         char* progname;
170         GArray *procedure_hfs;
171 } rpc_prog_info_value;
172
173 /* rpc_progs is also used in tap. With MSVC and a 
174  * libethereal.dll, we need a special declaration.
175  */
176 ETH_VAR_IMPORT GHashTable *rpc_progs;
177
178 typedef struct _rpc_proc_info_key {
179         guint32 prog;
180         guint32 vers;
181         guint32 proc;
182 } rpc_proc_info_key;
183
184 typedef struct _rpc_proc_info_value {
185         gchar           *name;
186         dissect_function_t *dissect_call;
187         dissect_function_t *dissect_reply;
188 } rpc_proc_info_value;
189
190 /* rpc_procs is also used in tap. With MSVC and a 
191  * libethereal.dll, we need a special declaration.
192  */
193 ETH_VAR_IMPORT GHashTable *rpc_procs;
194
195 #endif /* packet-rpc.h */
196