c4d24b7a030c46f35727ec825fd6540aedddb956
[obnox/wireshark/wip.git] / packet-rpc.h
1 /* packet-rpc.h
2  *
3  * $Id: packet-rpc.h,v 1.34 2002/04/02 00:18:53 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  * 
12  * This program is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU General Public License
14  * as published by the Free Software Foundation; either version 2
15  * of the License, or (at your option) any later version.
16  * 
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20  * GNU General Public License for more details.
21  * 
22  * You should have received a copy of the GNU General Public License
23  * along with this program; if not, write to the Free Software
24  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
25  */
26
27 #ifndef __PACKET_RPC_H__
28 #define __PACKET_RPC_H__
29
30 #include <glib.h>
31 #include <epan/packet.h>
32 #include <epan/conversation.h>
33
34 #define RPC_CALL 0
35 #define RPC_REPLY 1
36
37 #define AUTH_NULL 0
38 #define AUTH_UNIX 1
39 #define AUTH_SHORT 2
40 #define AUTH_DES 3
41 #define RPCSEC_GSS 6
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 RPCSEC_GSS_SVC_NONE 1
69 #define RPCSEC_GSS_SVC_INTEGRITY 2
70 #define RPCSEC_GSS_SVC_PRIVACY 3
71
72 #define AUTHDES_NAMEKIND_FULLNAME 0
73 #define AUTHDES_NAMEKIND_NICKNAME 1
74
75 extern value_string rpc_authgss_svc[];
76 typedef enum {
77         FLAVOR_UNKNOWN,         /* authentication flavor unknown */
78         FLAVOR_NOT_GSSAPI,      /* flavor isn't GSSAPI */
79         FLAVOR_GSSAPI_NO_INFO,  /* flavor is GSSAPI, procedure & service unknown */
80         FLAVOR_GSSAPI           /* flavor is GSSAPI, procedure & service known */
81 } flavor_t;
82
83 typedef struct _rpc_call_info_value {
84         guint32 req_num;        /* frame number of first request seen */
85         guint32 rep_num;        /* frame number of first reply seen */
86         guint32 prog;
87         guint32 vers;
88         guint32 proc;
89         guint32 xid;
90         flavor_t flavor;
91         guint32 gss_proc;
92         guint32 gss_svc;
93         struct _rpc_proc_info_value*    proc_info;
94         gboolean request;       /* Is this a request or not ?*/
95         nstime_t req_time;
96 } rpc_call_info_value;
97
98
99 typedef int (dissect_function_t)(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree* tree);
100
101 typedef struct _vsff {
102         guint32 value;
103         gchar   *strptr;
104         dissect_function_t *dissect_call;
105         dissect_function_t *dissect_reply;
106 } vsff;
107
108 extern const value_string rpc_auth_flavor[];
109
110 extern void rpc_init_proc_table(guint prog, guint vers, const vsff *proc_table);
111 extern void rpc_init_prog(int proto, guint32 prog, int ett);
112 extern char *rpc_prog_name(guint32 prog);
113 extern char *rpc_proc_name(guint32 prog, guint32 vers, guint32 proc);
114
115 extern unsigned int rpc_roundup(unsigned int a);
116 extern int dissect_rpc_bool(tvbuff_t *tvb, packet_info *pinfo,
117         proto_tree *tree, int hfindex, int offset);
118 extern int dissect_rpc_string(tvbuff_t *tvb, packet_info *pinfo,
119         proto_tree *tree, int hfindex, int offset, char **string_buffer_ret);
120 extern int dissect_rpc_data(tvbuff_t *tvb, packet_info *pinfo,
121         proto_tree *tree, int hfindex, int offset);
122 extern int dissect_rpc_list(tvbuff_t *tvb, packet_info *pinfo,
123         proto_tree *tree, int offset, dissect_function_t *rpc_list_dissector);
124 extern int dissect_rpc_array(tvbuff_t *tvb, packet_info *pinfo,
125         proto_tree *tree, int offset, dissect_function_t *rpc_array_dissector,
126         int hfindex);
127 extern int dissect_rpc_uint32(tvbuff_t *tvb, packet_info *pinfo,
128         proto_tree *tree, int hfindex, int offset);
129 extern int dissect_rpc_uint64(tvbuff_t *tvb, packet_info *pinfo,
130         proto_tree *tree, int hfindex, int offset);
131
132 extern int dissect_rpc_indir_call(tvbuff_t *tvb, packet_info *pinfo,
133         proto_tree *tree, int offset, int args_id, guint32 prog, guint32 vers,
134         guint32 proc);
135 extern int dissect_rpc_indir_reply(tvbuff_t *tvb, packet_info *pinfo,
136         proto_tree *tree, int offset, int result_id, int prog_id, int vers_id,
137         int proc_id);
138
139 #endif /* packet-rpc.h */
140