From Todd Sabin: allocate the buffer for the decrypted payload, rather
[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  *
5  * $Id: packet-ncp-int.h,v 1.12 2002/09/22 15:46:42 gerald Exp $
6  *
7  * Ethereal - Network traffic analyzer
8  * By Gerald Combs <gerald@ethereal.com>
9  * Copyright 2000 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_NCP_INT_H__
27 #define __PACKET_NCP_INT_H__
28
29 typedef struct _ptvc_record ptvc_record;
30 typedef struct _sub_ptvc_record sub_ptvc_record;
31
32 struct _ptvc_record {
33         int                     *hf_ptr;
34         gint                    length;
35         const sub_ptvc_record   *sub_ptvc_rec;
36         unsigned int    endianness      : 1; /* 0=BE, 1=LE */
37         unsigned int    var_index       : 2;
38         unsigned int    repeat_index    : 2;
39         unsigned int    req_cond_index  : 8;
40         unsigned int    special_fmt     : 2;
41 };
42
43 #define NCP_FMT_NONE                    0
44 #define NCP_FMT_NW_DATE                 1
45 #define NCP_FMT_NW_TIME                 2
46 #define NCP_FMT_UNICODE         3
47
48 struct _sub_ptvc_record {
49         gint                    *ett;
50         const char              *descr;
51         const ptvc_record       *ptvc_rec;
52 };
53
54 typedef struct {
55         const char              *dfilter_text;
56         dfilter_t               *dfilter;
57 } conditional_record;
58
59 typedef struct {
60         int                     *hf_ptr;
61         const char              *first_string;
62         const char              *repeat_string;
63 } info_string_t;
64
65 typedef struct {
66         guint8          error_in_packet;
67         gint            ncp_error_index;
68 } error_equivalency;
69
70 typedef struct {
71         guint8                  func;
72         guint8                  subfunc;
73         guint8                  has_subfunc;
74         gchar*                  name;
75         gint                    group;
76         const ptvc_record       *request_ptvc;
77         const ptvc_record       *reply_ptvc;
78         const error_equivalency *errors;
79         const int               *req_cond_indexes;
80         unsigned int            req_cond_size_type;
81         const info_string_t     *req_info_str;
82 } ncp_record;
83
84
85 void dissect_ncp_request(tvbuff_t*, packet_info*, guint16,
86                 guint8, guint16, proto_tree*);
87
88 void dissect_ncp_reply(tvbuff_t *, packet_info*, guint16, guint8,
89                 guint16, proto_tree*);
90
91 void dissect_ping_req(tvbuff_t *, packet_info*, guint16, guint8,
92                 guint16, proto_tree*);
93
94 void dissect_nds_request(tvbuff_t*, packet_info*, guint16,
95                 guint8, guint16, proto_tree*);
96
97 extern int proto_ncp;
98 extern gint ett_ncp;
99 extern gint ett_nds;
100
101 /*
102  * NCP packet types.
103  */
104 #define NCP_ALLOCATE_SLOT       0x1111
105 #define NCP_SERVICE_REQUEST     0x2222
106 #define NCP_SERVICE_REPLY       0x3333
107 #define NCP_WATCHDOG            0x3e3e
108 #define NCP_DEALLOCATE_SLOT     0x5555
109 #define NCP_BURST_MODE_XFER     0x7777
110 #define NCP_POSITIVE_ACK        0x9999
111 #define NCP_BROADCAST_SLOT  0xbbbb
112 #define NCP_LIP_ECHO        0x4c69
113
114 #endif