Got rid of dissect_rpc_string routine, renamed dissect_rpc_string_item to
[metze/wireshark/wip.git] / packet-rpc.h
1 /* packet-rpc.h (c) 1999 Uwe Girlich */
2 /* $Id: packet-rpc.h,v 1.6 1999/11/15 17:16:51 nneul Exp $ */
3
4 #ifndef __PACKET_RPC_H__
5 #define __PACKET_RPC_H__
6
7 #include <glib.h>
8 #include "packet.h"
9 #include "conversation.h"
10
11 #define EXTRACT_UINT(p,o)    pntohl(&p[o])
12
13 #define RPC_CALL 0
14 #define RPC_REPLY 1
15
16 #define AUTH_NULL 0
17 #define AUTH_UNIX 1
18 #define AUTH_SHORT 2
19 #define AUTH_DES 3
20
21 #define MSG_ACCEPTED 0
22 #define MSG_DENIED 1
23
24 #define AUTH_NULL 0
25 #define AUTH_UNIX 1
26 #define AUTH_SHORT 2
27 #define AUTH_DES 3
28
29 #define SUCCESS 0
30 #define PROG_UNAVAIL 1
31 #define PROG_MISMATCH 2
32 #define PROC_UNAVAIL 3
33 #define GARBAGE_ARGS 4
34
35 #define RPC_MISMATCH 0
36 #define AUTH_ERROR 1
37
38 #define AUTH_BADCRED 1
39 #define AUTH_REJECTEDCRED 2
40 #define AUTH_BADVERF 3
41 #define AUTH_REJECTEDVERF 4
42 #define AUTH_TOOWEAK 5
43
44 typedef int (dissect_function_t)(const u_char* pd, int offset, frame_data* fd, proto_tree* tree);
45
46 extern GHashTable *rpc_progs;
47
48 typedef struct _vsff {
49         guint32 value;
50         gchar   *strptr;
51         dissect_function_t *dissect_call;
52         dissect_function_t *dissect_reply;
53 } vsff;
54
55 typedef struct _rpc_proc_info_key {
56         guint32 prog;
57         guint32 vers;
58         guint32 proc;
59 } rpc_proc_info_key;
60
61 typedef struct _rpc_proc_info_value {
62         gchar           *name;
63         dissect_function_t      *dissect_call;
64         dissect_function_t      *dissect_reply;
65 } rpc_proc_info_value;
66
67 typedef struct _rpc_prog_info_key {
68         guint32 prog;
69 } rpc_prog_info_key;
70
71 typedef struct _rpc_prog_info_value {
72         int proto;
73         int ett;
74         char* progname;
75 } rpc_prog_info_value;
76
77 typedef struct _rpc_call_info {
78         guint32 xid;
79         conversation_t *conversation;
80         guint32 replies;
81         guint32 prog;
82         guint32 vers;
83         guint32 proc;
84         rpc_proc_info_value*    proc_info;
85 } rpc_call_info;
86
87 #define RPC_CALL_TABLE_LENGTH 1000
88
89 extern void rpc_call_insert(rpc_call_info *call);
90 extern rpc_call_info* rpc_call_lookup(rpc_call_info *call);
91
92 extern void rpc_init_proc_table(guint prog, guint vers, const vsff *proc_table);
93 extern void rpc_init_prog(int proto, guint32 prog, int ett);
94 extern char *rpc_prog_name(guint32 prog);
95
96 extern void init_dissect_rpc();
97 extern void cleanup_dissect_rpc();
98
99 extern unsigned int rpc_roundup(unsigned int a);
100 extern int dissect_rpc_string(const u_char *pd, int offset, frame_data *fd,
101         proto_tree *tree, int hfindex);
102 extern int dissect_rpc_uint32(const u_char *pd, int offset, frame_data *fd,
103         proto_tree *tree, char* name, char* type);
104 extern int dissect_rpc_uint64(const u_char *pd, int offset, frame_data *fd,
105         proto_tree *tree, char* name, char* type);
106
107
108 #endif /* packet-rpc.h */
109