- Decode some more annex C fields
[obnox/wireshark/wip.git] / epan / dissectors / packet-ncp-int.h
1 /* packet-ncp-int.h
2  * Structures and functions for NetWare Core Protocol.
3  * Gilbert Ramirez <gram@alumni.rice.edu>
4  * Modified for NDS support by Greg Morris (gmorris@novell.com)
5  *
6  * Portions Copyright (c) Gilbert Ramirez 2000-2002
7  * Portions Copyright (c) Novell, Inc. 2000-2003
8  *
9  * $Id$
10  *
11  * Ethereal - Network traffic analyzer
12  * By Gerald Combs <gerald@ethereal.com>
13  * Copyright 2000 Gerald Combs
14  *
15  * This program is free software; you can redistribute it and/or
16  * modify it under the terms of the GNU General Public License
17  * as published by the Free Software Foundation; either version 2
18  * of the License, or (at your option) any later version.
19  *
20  * This program is distributed in the hope that it will be useful,
21  * but WITHOUT ANY WARRANTY; without even the implied warranty of
22  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23  * GNU General Public License for more details.
24  *
25  * You should have received a copy of the GNU General Public License
26  * along with this program; if not, write to the Free Software
27  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
28  */
29
30 #ifndef __PACKET_NCP_INT_H__
31 #define __PACKET_NCP_INT_H__
32
33 #include <epan/expert.h>
34
35 typedef struct _ptvc_record ptvc_record;
36 typedef struct _sub_ptvc_record sub_ptvc_record;
37
38 struct _ptvc_record {
39         int                     *hf_ptr;
40         gint                    length;
41         const sub_ptvc_record   *sub_ptvc_rec;
42         unsigned int    endianness      : 1; /* 0=BE, 1=LE */
43         unsigned int    var_index       : 2;
44         unsigned int    repeat_index    : 2;
45         unsigned int    req_cond_index  : 8;
46         unsigned int    special_fmt     : 2;
47 };
48
49 /*
50  * Every NCP packet has this common header (except for burst packets).
51  */
52 struct ncp_common_header {
53         guint16 type;
54         guint8  sequence;
55         guint8  conn_low;
56         guint8  task;
57         guint8  conn_high; /* type=0x5555 doesn't have this */
58 };
59
60 #define NCP_FMT_NONE                    0
61 #define NCP_FMT_NW_DATE                 1
62 #define NCP_FMT_NW_TIME                 2
63 #define NCP_FMT_UNICODE         3
64
65 extern gboolean nds_defragment;
66 extern gboolean nds_echo_eid;
67 extern gboolean ncp_echo_err;
68 extern gboolean ncp_echo_conn;
69 extern gboolean ncp_echo_server;
70
71 struct _sub_ptvc_record {
72         gint                    *ett;
73         const char              *descr;
74         const ptvc_record       *ptvc_rec;
75 };
76
77 typedef struct {
78         const char              *dfilter_text;
79         dfilter_t               *dfilter;
80 } conditional_record;
81
82 typedef struct {
83         int                     *hf_ptr;
84         const char              *first_string;
85         const char              *repeat_string;
86 } info_string_t;
87
88
89 struct novell_tap {
90     int stat;
91     int hdr;
92 };
93
94 typedef struct novell_tap _novell_tap;
95
96 typedef struct {
97         guint8          error_in_packet;
98         gint            ncp_error_index;
99 } error_equivalency;
100
101 typedef struct {
102         guint8                  func;
103         guint8                  subfunc;
104         guint8                  has_subfunc;
105         const gchar*            name;
106         gint                    group;
107         const ptvc_record       *request_ptvc;
108         const ptvc_record       *reply_ptvc;
109         const error_equivalency *errors;
110         const int               *req_cond_indexes;
111         unsigned int            req_cond_size_type;
112         const info_string_t     *req_info_str;
113 } ncp_record;
114
115 typedef struct {
116         const ncp_record        *ncp_rec;
117         gboolean                *req_cond_results;
118         guint32                 req_frame_num;
119         nstime_t                req_frame_time;
120         guint32                 req_nds_flags;
121         guint8                  nds_request_verb;
122         guint8                  nds_version;
123         char                    object_name[256];
124         gboolean                nds_frag;
125         guint32                 nds_end_frag;
126     guint32         nds_frag_num;
127 } ncp_req_hash_value;
128
129 void dissect_ncp_request(tvbuff_t*, packet_info*, guint32,
130                 guint8, guint16, proto_tree *volatile);
131
132 void dissect_ncp_reply(tvbuff_t *, packet_info*, guint32, guint8,
133                 guint16, proto_tree*, struct novell_tap*);
134
135 void dissect_ping_req(tvbuff_t *, packet_info*, guint32, guint8,
136                 guint16, proto_tree*);
137
138 void dissect_nds_request(tvbuff_t*, packet_info*, guint32,
139                 guint8, guint16, proto_tree*);
140
141 void nds_defrag(tvbuff_t*, packet_info*, guint32,
142                 guint8, guint16, proto_tree*, struct novell_tap*);
143
144 extern int proto_ncp;
145 extern gint ett_ncp;
146 extern gint ett_nds;
147 extern gint ett_nds_segments;
148 extern gint ett_nds_segment;
149
150 /*extern dissector_handle_t nds_data_handle;*/
151 extern GHashTable *nds_fragment_table;
152 extern GHashTable *nds_reassembled_table;
153
154 /*
155  * NCP packet types.
156  */
157 #define NCP_ALLOCATE_SLOT       0x1111
158 #define NCP_SERVICE_REQUEST     0x2222
159 #define NCP_SERVICE_REPLY       0x3333
160 #define NCP_WATCHDOG            0x3e3e
161 #define NCP_DEALLOCATE_SLOT     0x5555
162 #define NCP_BURST_MODE_XFER     0x7777
163 #define NCP_POSITIVE_ACK        0x9999
164 #define NCP_BROADCAST_SLOT      0xbbbb
165 #define NCP_LIP_ECHO            0x4c69
166
167 #endif