Wireshark  4.3.0
The Wireshark network protocol analyzer
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  * Wireshark - Network traffic analyzer
10  * By Gerald Combs <gerald@wireshark.org>
11  * Copyright 2000 Gerald Combs
12  *
13  * SPDX-License-Identifier: GPL-2.0-or-later
14  */
15 
16 #ifndef __PACKET_NCP_INT_H__
17 #define __PACKET_NCP_INT_H__
18 
19 #include <epan/expert.h>
20 #include <epan/ptvcursor.h>
21 
22 typedef struct _ptvc_record ptvc_record;
23 typedef struct _sub_ptvc_record sub_ptvc_record;
24 
25 typedef struct {
26  int *hf_ptr;
27  const char *first_string;
28  const char *repeat_string;
30 
31 struct _ptvc_record {
32  int *hf_ptr;
33  int length;
34  const sub_ptvc_record *sub_ptvc_rec;
35  const info_string_t *req_info_str;
36  unsigned int endianness;
37  unsigned int var_index : 2;
38  unsigned int repeat_index : 2;
39  unsigned int req_cond_index : 8;
40 };
41 
42 /*
43  * Every NCP packet has this common header (except for burst packets).
44  */
46  uint16_t type;
47  uint8_t sequence;
48  uint8_t conn_low;
49  uint8_t task;
50  uint8_t conn_high; /* type=0x5555 doesn't have this */
51 };
52 
53 extern bool nds_defragment;
54 extern bool nds_echo_eid;
55 extern bool ncp_echo_err;
56 extern bool ncp_echo_conn;
57 extern bool ncp_echo_server;
58 extern bool ncp_echo_file;
59 extern bool ncp_newstyle;
60 
62  int *ett;
63  const char *descr;
64  const ptvc_record *ptvc_rec;
65 };
66 
67 typedef struct {
68  const char *dfilter_text;
69  struct epan_dfilter *dfilter;
71 
72 struct novell_tap {
73  int stat;
74  int hdr;
75 };
76 
77 typedef struct novell_tap _novell_tap;
78 
79 typedef struct {
80  uint8_t error_in_packet;
81  int ncp_error_index;
83 
84 struct _ncp_record;
85 typedef void (ncp_expert_handler)(ptvcursor_t *ptvc, packet_info *pinfo, const struct _ncp_record *ncp_rec, bool request);
86 
87 typedef struct _ncp_record {
88  uint8_t func;
89  uint8_t subfunc;
90  uint8_t has_subfunc;
91  const char* name;
92  int group;
93  const ptvc_record *request_ptvc;
94  const ptvc_record *reply_ptvc;
95  const error_equivalency *errors;
96  const int *req_cond_indexes;
97  unsigned int req_cond_size_type;
98  ncp_expert_handler *expert_handler_func;
99 } ncp_record;
100 
101 /*
102  * XXX - should the object_name be a pointer, initialized to null,
103  * and set to a wmem-allocated copy of the full string?
104  */
105 typedef struct {
106  const ncp_record *ncp_rec;
107  bool *req_cond_results;
108  uint32_t req_frame_num;
109  nstime_t req_frame_time;
110  uint16_t length;
111  uint32_t req_nds_flags;
112  uint32_t req_nds_prot_flags;
113  uint8_t nds_request_verb;
114  uint8_t nds_version;
115  char object_name[256];
116  bool nds_frag;
117  uint32_t nds_end_frag;
118  uint32_t nds_frag_num;
119  uint16_t req_mask;
120  uint16_t req_mask_ext;
121  uint32_t nds_frag_flags;
123 
124 WS_DLL_PUBLIC const value_string sss_verb_enum[];
125 WS_DLL_PUBLIC const value_string nmas_subverb_enum[];
126 WS_DLL_PUBLIC const value_string ncp_nds_verb_vals[];
127 
128 void dissect_ncp_request(tvbuff_t*, packet_info*, uint32_t,
129  uint8_t, uint16_t, bool, proto_tree *volatile);
130 
131 void dissect_ncp_reply(tvbuff_t *, packet_info*, uint32_t, uint8_t,
132  uint16_t, proto_tree*, struct novell_tap*);
133 
134 void dissect_ping_req(tvbuff_t *, packet_info*, uint32_t, uint8_t,
135  uint16_t, proto_tree*);
136 
137 void dissect_nds_request(tvbuff_t*, packet_info*, uint32_t,
138  uint8_t, uint16_t, proto_tree*);
139 
140 void nds_defrag(tvbuff_t*, packet_info*, uint32_t,
141  uint8_t, uint16_t, proto_tree*, struct novell_tap*);
142 
143 extern int proto_ncp;
144 extern int ett_ncp;
145 extern int ett_nds;
146 extern int ett_nds_segments;
147 extern int ett_nds_segment;
148 
149 /*extern dissector_handle_t nds_data_handle;*/
150 
151 /*
152  * NCP packet types.
153  */
154 #define NCP_ALLOCATE_SLOT 0x1111
155 #define NCP_SERVICE_REQUEST 0x2222
156 #define NCP_SERVICE_REPLY 0x3333
157 #define NCP_WATCHDOG 0x3e3e
158 #define NCP_DEALLOCATE_SLOT 0x5555
159 #define NCP_BURST_MODE_XFER 0x7777
160 #define NCP_POSITIVE_ACK 0x9999
161 #define NCP_BROADCAST_SLOT 0xbbbb
162 #define NCP_LIP_ECHO 0x4c69
163 
164 #endif
Definition: packet-ncp-int.h:87
Definition: packet_info.h:44
Definition: proto.h:904
Definition: packet-ncp-int.h:31
Definition: packet-ncp-int.h:61
Definition: value_string.h:26
Definition: packet-ncp-int.h:67
Definition: dfilter-int.h:35
Definition: packet-ncp-int.h:79
Definition: packet-ncp-int.h:25
Definition: packet-ncp-int.h:45
Definition: packet-ncp-int.h:105
Definition: packet-ncp-int.h:72
Definition: nstime.h:26
Definition: proto.c:67
Definition: tvbuff-int.h:35