bugfix to a bug reported by Ian Schorr:
[obnox/wireshark/wip.git] / 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: packet-ncp-int.h,v 1.18 2004/06/15 09:23:59 guy Exp $
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 typedef struct _ptvc_record ptvc_record;
34 typedef struct _sub_ptvc_record sub_ptvc_record;
35
36 struct _ptvc_record {
37         int                     *hf_ptr;
38         gint                    length;
39         const sub_ptvc_record   *sub_ptvc_rec;
40         unsigned int    endianness      : 1; /* 0=BE, 1=LE */
41         unsigned int    var_index       : 2;
42         unsigned int    repeat_index    : 2;
43         unsigned int    req_cond_index  : 8;
44         unsigned int    special_fmt     : 2;
45 };
46
47 #define NCP_FMT_NONE                    0
48 #define NCP_FMT_NW_DATE                 1
49 #define NCP_FMT_NW_TIME                 2
50 #define NCP_FMT_UNICODE         3
51
52 extern gboolean nds_defragment;
53
54 struct _sub_ptvc_record {
55         gint                    *ett;
56         const char              *descr;
57         const ptvc_record       *ptvc_rec;
58 };
59
60 typedef struct {
61         const char              *dfilter_text;
62         dfilter_t               *dfilter;
63 } conditional_record;
64
65 typedef struct {
66         int                     *hf_ptr;
67         const char              *first_string;
68         const char              *repeat_string;
69 } info_string_t;
70
71 typedef struct {
72         guint8          error_in_packet;
73         gint            ncp_error_index;
74 } error_equivalency;
75
76 typedef struct {
77         guint8                  func;
78         guint8                  subfunc;
79         guint8                  has_subfunc;
80         gchar*                  name;
81         gint                    group;
82         const ptvc_record       *request_ptvc;
83         const ptvc_record       *reply_ptvc;
84         const error_equivalency *errors;
85         const int               *req_cond_indexes;
86         unsigned int            req_cond_size_type;
87         const info_string_t     *req_info_str;
88 } ncp_record;
89
90 typedef struct {
91         const ncp_record        *ncp_rec;
92         gboolean                *req_cond_results;
93         guint32                 req_frame_num;
94         nstime_t                req_frame_time;
95         guint32                 req_nds_flags;
96         guint8                  nds_request_verb;
97         guint8                  nds_version;
98         char                    object_name[256];
99         gboolean                nds_frag;
100         guint32                 nds_end_frag;
101     guint32         nds_frag_num;
102 } ncp_req_hash_value;
103
104 void dissect_ncp_request(tvbuff_t*, packet_info*, guint16,
105                 guint8, guint16, proto_tree*);
106
107 void dissect_ncp_reply(tvbuff_t *, packet_info*, guint16, guint8,
108                 guint16, proto_tree*);
109
110 void dissect_ping_req(tvbuff_t *, packet_info*, guint16, guint8,
111                 guint16, proto_tree*);
112
113 void dissect_nds_request(tvbuff_t*, packet_info*, guint16,
114                 guint8, guint16, proto_tree*);
115
116 void nds_defrag(tvbuff_t*, packet_info*, guint16,
117                 guint8, guint16, proto_tree*);
118
119 extern int proto_ncp;
120 extern gint ett_ncp;
121 extern gint ett_nds;
122 extern gint ett_nds_segments;
123 extern gint ett_nds_segment;
124
125
126 extern GHashTable *nds_fragment_table;
127 extern GHashTable *nds_reassembled_table;
128 extern dissector_handle_t nds_data_handle;
129 /*
130  * NCP packet types.
131  */
132 #define NCP_ALLOCATE_SLOT       0x1111
133 #define NCP_SERVICE_REQUEST     0x2222
134 #define NCP_SERVICE_REPLY       0x3333
135 #define NCP_WATCHDOG            0x3e3e
136 #define NCP_DEALLOCATE_SLOT     0x5555
137 #define NCP_BURST_MODE_XFER     0x7777
138 #define NCP_POSITIVE_ACK        0x9999
139 #define NCP_BROADCAST_SLOT      0xbbbb
140 #define NCP_LIP_ECHO            0x4c69
141
142 #endif