More conversions to NDR routines. This commit does most of the printerdata
[obnox/wireshark/wip.git] / packet-rpc.h
1 /* packet-rpc.h
2  *
3  * $Id: packet-rpc.h,v 1.40 2002/11/13 21:45:57 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
42 #define MSG_ACCEPTED 0
43 #define MSG_DENIED 1
44
45 #define SUCCESS 0
46 #define PROG_UNAVAIL 1
47 #define PROG_MISMATCH 2
48 #define PROC_UNAVAIL 3
49 #define GARBAGE_ARGS 4
50
51 #define RPC_MISMATCH 0
52 #define AUTH_ERROR 1
53
54 #define AUTH_BADCRED 1
55 #define AUTH_REJECTEDCRED 2
56 #define AUTH_BADVERF 3
57 #define AUTH_REJECTEDVERF 4
58 #define AUTH_TOOWEAK 5
59 #define RPCSEC_GSSCREDPROB 13
60 #define RPCSEC_GSSCTXPROB 14
61
62 #define RPCSEC_GSS_DATA 0
63 #define RPCSEC_GSS_INIT 1
64 #define RPCSEC_GSS_CONTINUE_INIT 2
65 #define RPCSEC_GSS_DESTROY 3
66
67 #define RPCSEC_GSS_SVC_NONE 1
68 #define RPCSEC_GSS_SVC_INTEGRITY 2
69 #define RPCSEC_GSS_SVC_PRIVACY 3
70
71 #define AUTHDES_NAMEKIND_FULLNAME 0
72 #define AUTHDES_NAMEKIND_NICKNAME 1
73
74 extern value_string rpc_authgss_svc[];
75 typedef enum {
76         FLAVOR_UNKNOWN,         /* authentication flavor unknown */
77         FLAVOR_NOT_GSSAPI,      /* flavor isn't GSSAPI */
78         FLAVOR_GSSAPI_NO_INFO,  /* flavor is GSSAPI, procedure & service unknown */
79         FLAVOR_GSSAPI           /* flavor is GSSAPI, procedure & service known */
80 } flavor_t;
81
82 typedef struct _rpc_call_info_value {
83         guint32 req_num;        /* frame number of first request seen */
84         guint32 rep_num;        /* frame number of first reply seen */
85         guint32 prog;
86         guint32 vers;
87         guint32 proc;
88         guint32 xid;
89         flavor_t flavor;
90         guint32 gss_proc;
91         guint32 gss_svc;
92         struct _rpc_proc_info_value*    proc_info;
93         gboolean request;       /* Is this a request or not ?*/
94         nstime_t req_time;
95         void *private_data;
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     int procedure_hf);
112 extern void rpc_init_prog(int proto, guint32 prog, int ett);
113 extern char *rpc_prog_name(guint32 prog);
114 extern char *rpc_proc_name(guint32 prog, guint32 vers, guint32 proc);
115
116 extern unsigned int rpc_roundup(unsigned int a);
117 extern int dissect_rpc_bool(tvbuff_t *tvb,
118         proto_tree *tree, int hfindex, int offset);
119 extern int dissect_rpc_string(tvbuff_t *tvb,
120         proto_tree *tree, int hfindex, int offset, char **string_buffer_ret);
121 extern int dissect_rpc_data(tvbuff_t *tvb,
122         proto_tree *tree, int hfindex, int offset);
123 extern int dissect_rpc_bytes(tvbuff_t *tvb,
124         proto_tree *tree, int hfindex, int offset, guint32 length,
125         gboolean string_data, char **string_buffer_ret);
126 extern int dissect_rpc_list(tvbuff_t *tvb, packet_info *pinfo,
127         proto_tree *tree, int offset, dissect_function_t *rpc_list_dissector);
128 extern int dissect_rpc_array(tvbuff_t *tvb, packet_info *pinfo,
129         proto_tree *tree, int offset, dissect_function_t *rpc_array_dissector,
130         int hfindex);
131 extern int dissect_rpc_uint32(tvbuff_t *tvb,
132         proto_tree *tree, int hfindex, int offset);
133 extern int dissect_rpc_uint64(tvbuff_t *tvb,
134         proto_tree *tree, int hfindex, int offset);
135
136 extern int dissect_rpc_indir_call(tvbuff_t *tvb, packet_info *pinfo,
137         proto_tree *tree, int offset, int args_id, guint32 prog, guint32 vers,
138         guint32 proc);
139 extern int dissect_rpc_indir_reply(tvbuff_t *tvb, packet_info *pinfo,
140         proto_tree *tree, int offset, int result_id, int prog_id, int vers_id,
141         int proc_id);
142
143
144 typedef struct _rpc_prog_info_key {
145         guint32 prog;
146 } rpc_prog_info_key;
147
148 typedef struct _rpc_prog_info_value {
149         int proto;
150         int ett;
151         char* progname;
152         GArray *procedure_hfs;
153 } rpc_prog_info_value;
154
155 extern GHashTable *rpc_progs;
156
157 typedef struct _rpc_proc_info_key {
158         guint32 prog;
159         guint32 vers;
160         guint32 proc;
161 } rpc_proc_info_key;
162
163 typedef struct _rpc_proc_info_value {
164         gchar           *name;
165         dissect_function_t *dissect_call;
166         dissect_function_t *dissect_reply;
167 } rpc_proc_info_value;
168
169 extern GHashTable *rpc_procs;
170
171 #endif /* packet-rpc.h */
172