/src/wireshark/epan/dissectors/packet-dlsw.c
Line | Count | Source |
1 | | /* packet-dlsw.c |
2 | | * Routines for DLSw packet dissection (Data Link Switching) |
3 | | * Copyright 2001, Paul Ionescu <paul@acorp.ro> |
4 | | * |
5 | | * Wireshark - Network traffic analyzer |
6 | | * By Gerald Combs <gerald@wireshark.org> |
7 | | * Copyright 1998 Gerald Combs |
8 | | * |
9 | | * SPDX-License-Identifier: GPL-2.0-or-later |
10 | | */ |
11 | | |
12 | | /* DLSw dissector ( RFC 1434, RFC 1795, RFC 2166) */ |
13 | | |
14 | | #include "config.h" |
15 | | |
16 | | #include <epan/packet.h> |
17 | | #include <epan/expert.h> |
18 | | #include <epan/tfs.h> |
19 | | |
20 | | #include "packet-tcp.h" |
21 | | |
22 | | void proto_register_dlsw(void); |
23 | | void proto_reg_handoff_dlsw(void); |
24 | | |
25 | | static dissector_handle_t dlsw_udp_handle; |
26 | | static dissector_handle_t dlsw_tcp_handle; |
27 | | |
28 | | static int proto_dlsw; |
29 | | static int hf_dlsw_flow_control_indication; |
30 | | static int hf_dlsw_flow_control_ack; |
31 | | static int hf_dlsw_flow_control_operator; |
32 | | static int hf_dlsw_flags_explorer_msg; |
33 | | /* Generated from convert_proto_tree_add_text.pl */ |
34 | | static int hf_dlsw_vector_length; |
35 | | static int hf_dlsw_dlc_header_sa; |
36 | | static int hf_dlsw_dlc_header_fc_byte; |
37 | | static int hf_dlsw_target_transport_id; |
38 | | static int hf_dlsw_error_pointer; |
39 | | static int hf_dlsw_capabilities_length; |
40 | | static int hf_dlsw_multicast_version_number; |
41 | | static int hf_dlsw_frame_direction; |
42 | | static int hf_dlsw_circuit_priority; |
43 | | static int hf_dlsw_origin_dlc_port_id; |
44 | | static int hf_dlsw_protocol_id; |
45 | | static int hf_dlsw_mac_address_list; |
46 | | static int hf_dlsw_origin_link_sap; |
47 | | static int hf_dlsw_header_length; |
48 | | static int hf_dlsw_dlc_header_ctrl; |
49 | | static int hf_dlsw_target_dlc_port_id; |
50 | | static int hf_dlsw_vector_type; |
51 | | static int hf_dlsw_largest_frame_size; |
52 | | static int hf_dlsw_error_cause; |
53 | | static int hf_dlsw_dlc_header_length; |
54 | | static int hf_dlsw_oui; |
55 | | static int hf_dlsw_target_dlc; |
56 | | static int hf_dlsw_dlc_header_ac_byte; |
57 | | static int hf_dlsw_tcp_connections; |
58 | | static int hf_dlsw_initial_pacing_window; |
59 | | static int hf_dlsw_old_message_type; |
60 | | static int hf_dlsw_capex_type; |
61 | | static int hf_dlsw_ssp_flags; |
62 | | static int hf_dlsw_target_mac_address; |
63 | | static int hf_dlsw_origin_mac_address; |
64 | | static int hf_dlsw_dlc_header_rif; |
65 | | static int hf_dlsw_message_type; |
66 | | static int hf_dlsw_header_number; |
67 | | static int hf_dlsw_message_length; |
68 | | static int hf_dlsw_remote_dlc_pid; |
69 | | static int hf_dlsw_vendor_oui; |
70 | | static int hf_dlsw_flow_ctrl_byte; |
71 | | static int hf_dlsw_version; |
72 | | static int hf_dlsw_version_string; |
73 | | static int hf_dlsw_dlsw_version; |
74 | | static int hf_dlsw_remote_dlc; |
75 | | static int hf_dlsw_origin_dlc; |
76 | | static int hf_dlsw_origin_transport_id; |
77 | | static int hf_dlsw_dlc_header_ssap; |
78 | | static int hf_dlsw_target_link_sap; |
79 | | static int hf_dlsw_dlc_header_da; |
80 | | static int hf_dlsw_netbios_name; |
81 | | static int hf_dlsw_dlc_header_dsap; |
82 | | static int hf_dlsw_reserved; |
83 | | static int hf_dlsw_data; |
84 | | static int hf_dlsw_vector_data; |
85 | | static int hf_dlsw_unknown_data; |
86 | | static int hf_dlsw_mac_address_exclusivity; |
87 | | static int hf_dlsw_netbios_name_exclusivity; |
88 | | static int hf_dlsw_gds_id; |
89 | | static int hf_dlsw_sap_list_support; |
90 | | static int hf_dlsw_sap_list_support_x0; |
91 | | static int hf_dlsw_sap_list_support_x2; |
92 | | static int hf_dlsw_sap_list_support_x4; |
93 | | static int hf_dlsw_sap_list_support_x6; |
94 | | static int hf_dlsw_sap_list_support_x8; |
95 | | static int hf_dlsw_sap_list_support_xA; |
96 | | static int hf_dlsw_sap_list_support_xC; |
97 | | static int hf_dlsw_sap_list_support_xE; |
98 | | |
99 | | static int ett_dlsw; |
100 | | static int ett_dlsw_header; |
101 | | static int ett_dlsw_fc; |
102 | | static int ett_dlsw_sspflags; |
103 | | static int ett_dlsw_data; |
104 | | static int ett_dlsw_vector; |
105 | | static int ett_dlsw_sap_list_support; |
106 | | |
107 | | static expert_field ei_dlsw_dlc_header_length; |
108 | | static expert_field ei_dlsw_not_used_for_capex; |
109 | | static expert_field ei_dlsw_vec_len_invalid; |
110 | | |
111 | | #define CANUREACH 0x03 |
112 | | #define ICANREACH 0x04 |
113 | | #define REACH_ACK 0x05 |
114 | | #define DGRMFRAME 0x06 |
115 | | #define XIDFRAME 0x07 |
116 | | #define CONTACT 0x08 |
117 | | #define CONTACTED 0x09 |
118 | | #define RESTART_DL 0x10 |
119 | | #define DL_RESTARTED 0x11 |
120 | | #define ENTER_BUSY 0x0C |
121 | | #define EXIT_BUSY 0x0D |
122 | 1 | #define INFOFRAME 0x0A |
123 | | #define HALT_DL 0x0E |
124 | | #define DL_HALTED 0x0F |
125 | | #define NETBIOS_NQ 0x12 |
126 | | #define NETBIOS_NR 0x13 |
127 | | #define DATAFRAME 0x14 |
128 | | #define HALT_DL_NOACK 0x19 |
129 | | #define NETBIOS_ANQ 0x1A |
130 | | #define NETBIOS_ANR 0x1B |
131 | 2 | #define KEEPALIVE 0x1D |
132 | 67 | #define CAP_EXCHANGE 0x20 |
133 | 1 | #define IFCM 0x21 |
134 | | #define TEST_CIRCUIT_REQ 0x7A |
135 | | #define TEST_CIRCUIT_RSP 0x7B |
136 | | |
137 | | static const value_string dlsw_type_vals[] = { |
138 | | { CANUREACH , "Can U Reach Station-circuit start" }, |
139 | | { ICANREACH , "I Can Reach Station-circuit start" }, |
140 | | { REACH_ACK , "Reach Acknowledgment" }, |
141 | | { DGRMFRAME , "Datagram Frame" }, |
142 | | { XIDFRAME , "XID Frame" }, |
143 | | { CONTACT , "Contact Remote Station" }, |
144 | | { CONTACTED , "Remote Station Contacted" }, |
145 | | { RESTART_DL , "Restart Data Link" }, |
146 | | { DL_RESTARTED , "Data Link Restarted" }, |
147 | | { ENTER_BUSY , "Enter Busy" }, |
148 | | { EXIT_BUSY , "Exit Busy" }, |
149 | | { INFOFRAME , "Information (I) Frame" }, |
150 | | { HALT_DL , "Halt Data Link" }, |
151 | | { DL_HALTED , "Data Link Halted" }, |
152 | | { NETBIOS_NQ , "NETBIOS Name Query-circuit setup" }, |
153 | | { NETBIOS_NR , "NETBIOS Name Recog-circuit setup" }, |
154 | | { DATAFRAME , "Data Frame" }, |
155 | | { HALT_DL_NOACK , "Halt Data Link with no Ack" }, |
156 | | { NETBIOS_ANQ , "NETBIOS Add Name Query" }, |
157 | | { NETBIOS_ANR , "NETBIOS Add Name Response" }, |
158 | | { KEEPALIVE , "Transport Keepalive Message" }, |
159 | | { CAP_EXCHANGE , "Capabilities Exchange" }, |
160 | | { IFCM , "Independent Flow Control Message" }, |
161 | | { TEST_CIRCUIT_REQ , "Test Circuit Request" }, |
162 | | { TEST_CIRCUIT_RSP , "Test Circuit Response" }, |
163 | | { 0 , NULL } |
164 | | }; |
165 | | static const value_string dlsw_version_vals[] = { |
166 | | { 0x31 , "Version 1 (RFC 1795)" }, |
167 | | { 0x32 , "Version 2 (RFC 2166)" }, |
168 | | { 0x33 , "Vendor Specific" }, |
169 | | { 0x34 , "Vendor Specific" }, |
170 | | { 0x35 , "Vendor Specific" }, |
171 | | { 0x36 , "Vendor Specific" }, |
172 | | { 0x37 , "Vendor Specific" }, |
173 | | { 0x38 , "Vendor Specific" }, |
174 | | { 0x39 , "Vendor Specific" }, |
175 | | { 0x3A , "Vendor Specific" }, |
176 | | { 0x3B , "Vendor Specific" }, |
177 | | { 0x3C , "Vendor Specific" }, |
178 | | { 0x3D , "Vendor Specific" }, |
179 | | { 0x3E , "Vendor Specific" }, |
180 | | { 0x3F , "Vendor Specific" }, |
181 | | { 0x4B , "Pre 1 (RFC 1434)" }, |
182 | | { 0x00 , NULL } |
183 | | }; |
184 | | |
185 | | static const value_string dlsw_fc_cmd_vals[] = { |
186 | | { 0x00 , "Repeat Window" }, |
187 | | { 0x01 , "Increment Window" }, |
188 | | { 0x02 , "Decrement Window" }, |
189 | | { 0x03 , "Reset Window" }, |
190 | | { 0x04 , "Halve Window" }, |
191 | | { 0x00 , NULL } |
192 | | }; |
193 | | |
194 | | static const value_string dlsw_capex_type_vals[] = { |
195 | | { 0x01 , "Capabilities request" }, |
196 | | { 0x02 , "Capabilities response" }, |
197 | | { 0x00 , NULL } |
198 | | }; |
199 | | |
200 | | static const value_string dlsw_frame_direction_vals[] = { |
201 | | { 0x01 , "Origin DLSw to target DLSw" }, |
202 | | { 0x02 , "Target DLSw to origin DLSw" }, |
203 | | { 0x00 , NULL } |
204 | | }; |
205 | | |
206 | | static const value_string dlsw_vector_vals[] = { |
207 | | { 0x81 , "Vendor ID Control Vector" }, |
208 | | { 0x82 , "DLSw Version Control Vector" }, |
209 | | { 0x83 , "Initial Pacing Window Control Vector" }, |
210 | | { 0x84 , "Version String Control Vector" }, |
211 | | { 0x85 , "Mac Address Exclusivity Control Vector" }, |
212 | | { 0x86 , "Supported SAP List Control Vector" }, |
213 | | { 0x87 , "TCP Connections Control Vector" }, |
214 | | { 0x88 , "NetBIOS Name Exclusivity Control Vector" }, |
215 | | { 0x89 , "MAC Address List Control Vector" }, |
216 | | { 0x8a , "NetBIOS Name List Control Vector" }, |
217 | | { 0x8b , "Vendor Context Control Vector" }, |
218 | | { 0x8c , "Multicast Capabilities Control Vector" }, |
219 | | { 0x8d , "Reserved for future use" }, |
220 | | { 0x8e , "Reserved for future use" }, |
221 | | { 0x8f , "Reserved for future use" }, |
222 | | { 0x90 , "Reserved for future use" }, |
223 | | { 0x91 , "Control Vector" }, |
224 | | { 0x92 , "Control Vector" }, |
225 | | { 0x93 , "Control Vector" }, |
226 | | { 0x94 , "Control Vector" }, |
227 | | { 0x95 , "Control Vector" }, |
228 | | { 0x96 , "Control Vector" }, |
229 | | { 0x00 , NULL } |
230 | | }; |
231 | | |
232 | | static const value_string dlsw_pri_vals[] = { |
233 | | { 0 , "Unsupported" }, |
234 | | { 1 , "Low Priority" }, |
235 | | { 2 , "Medium Priority" }, |
236 | | { 3 , "High Priority" }, |
237 | | { 4 , "Highest Priority" }, |
238 | | { 5 , "Reserved" }, |
239 | | { 6 , "Reserved" }, |
240 | | { 7 , "Reserved" }, |
241 | | { 0, NULL } |
242 | | }; |
243 | | |
244 | | |
245 | | |
246 | | |
247 | 0 | #define DLSW_GDSID_SEND 0x1520 |
248 | 0 | #define DLSW_GDSID_ACK 0x1521 |
249 | 0 | #define DLSW_GDSID_REF 0x1522 |
250 | | |
251 | | static const value_string dlsw_gds_vals[] = { |
252 | | { DLSW_GDSID_SEND , "Request Capabilities GDS" }, |
253 | | { DLSW_GDSID_ACK , "Response Capabilities GDS" }, |
254 | | { DLSW_GDSID_REF , "Refuse Capabilities GDS" }, |
255 | | { 0 , NULL } |
256 | | }; |
257 | | |
258 | | static const value_string dlsw_refuse_vals[] = { |
259 | | { 0x1 , "invalid GDS length for a DLWs Capabilities Exchange Request"}, |
260 | | { 0x2 , "invalid GDS id for a DLSw Capabilities Exchange Request"}, |
261 | | { 0x3 , "vendor Id control vector is missing"}, |
262 | | { 0x4 , "DLSw Version control vector is missing"}, |
263 | | { 0x5 , "initial Pacing Window control vector is missing"}, |
264 | | { 0x6 , "length of control vectors doesn't correlate to the length of the GDS variable"}, |
265 | | { 0x7 , "invalid control vector id"}, |
266 | | { 0x8 , "length of control vector invalid"}, |
267 | | { 0x9 , "invalid control vector data value"}, |
268 | | { 0xa , "duplicate control vector"}, |
269 | | { 0xb , "out-of-sequence control vector"}, |
270 | | { 0xc , "DLSw Supported SAP List control vector is missing"}, |
271 | | { 0xd , "inconsistent DLSw Version, Multicast Capabilities, and TCP Connections CV received on the inbound Capabilities exchange"}, |
272 | | { 0x0 , NULL } |
273 | | }; |
274 | | |
275 | 16 | #define UDP_PORT_DLSW 2067 |
276 | 16 | #define TCP_PORT_DLSW 2065 |
277 | 34 | #define DLSW_INFO_HEADER 16 |
278 | | #define DLSW_CMD_HEADER 72 |
279 | | |
280 | | static void |
281 | | dissect_dlsw_capex(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree *ti2); |
282 | | |
283 | | static int |
284 | | dissect_dlsw_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) |
285 | 34 | { |
286 | 34 | unsigned version,hlen = 0,mlen = 0,mtype,dlchlen = 0,flags; |
287 | 34 | proto_tree *dlsw_tree, *dlsw_header_tree = NULL; |
288 | 34 | proto_item *ti,*ti2; |
289 | 34 | proto_tree *dlsw_flags_tree,*dlsw_data_tree; |
290 | | |
291 | 34 | col_set_str(pinfo->cinfo, COL_PROTOCOL, "DLSw"); |
292 | | |
293 | 34 | version=tvb_get_uint8(tvb,0); |
294 | | |
295 | 34 | col_add_fstr(pinfo->cinfo, COL_INFO, "DLSw %s",val_to_str_const(version , dlsw_version_vals, "Unknown Version")); |
296 | | |
297 | 34 | ti = proto_tree_add_item(tree, proto_dlsw, tvb, 0, -1, ENC_NA); |
298 | 34 | dlsw_tree = proto_item_add_subtree(ti, ett_dlsw); |
299 | | |
300 | 34 | hlen=tvb_get_uint8(tvb,1); |
301 | | |
302 | 34 | dlsw_header_tree = proto_tree_add_subtree_format(dlsw_tree, tvb, 0, hlen, ett_dlsw_header, NULL, |
303 | 34 | "DLSw header, %s", |
304 | 34 | val_to_str_const(version , dlsw_version_vals, "Unknown Version")); |
305 | | |
306 | 34 | proto_tree_add_item(dlsw_header_tree, hf_dlsw_version, tvb, 0, 1, ENC_BIG_ENDIAN); |
307 | 34 | proto_tree_add_item(dlsw_header_tree, hf_dlsw_header_length, tvb, 1, 1, ENC_BIG_ENDIAN); |
308 | 34 | mlen=tvb_get_ntohs(tvb,2); |
309 | 34 | proto_tree_add_item(dlsw_header_tree, hf_dlsw_message_length, tvb, 2, 2, ENC_BIG_ENDIAN); |
310 | 34 | proto_tree_add_item(dlsw_header_tree, hf_dlsw_remote_dlc, tvb, 4, 4, ENC_BIG_ENDIAN); |
311 | 34 | proto_tree_add_item(dlsw_header_tree, hf_dlsw_remote_dlc_pid, tvb, 8, 4, ENC_BIG_ENDIAN); |
312 | 34 | proto_tree_add_item(dlsw_header_tree, hf_dlsw_reserved, tvb, 12, 2, ENC_NA) ; |
313 | | |
314 | 34 | mtype=tvb_get_uint8(tvb,14); |
315 | 34 | col_append_fstr(pinfo->cinfo, COL_INFO, ", %s",val_to_str_const(mtype , dlsw_type_vals, "Unknown message Type")); |
316 | | |
317 | 34 | proto_tree_add_item(dlsw_header_tree, hf_dlsw_message_type, tvb, 14, 1, ENC_BIG_ENDIAN); |
318 | 34 | if (mtype==CAP_EXCHANGE) |
319 | 1 | { |
320 | 1 | proto_tree_add_expert(dlsw_header_tree, pinfo, &ei_dlsw_not_used_for_capex, tvb, 15, 1); |
321 | 1 | } |
322 | 33 | else |
323 | 33 | { |
324 | 33 | flags = tvb_get_uint8(tvb,15); |
325 | 33 | ti2 = proto_tree_add_item(dlsw_header_tree, hf_dlsw_flow_ctrl_byte, tvb, 15, 1, ENC_BIG_ENDIAN); |
326 | 33 | dlsw_flags_tree = proto_item_add_subtree(ti2, ett_dlsw_fc); |
327 | 33 | proto_tree_add_item(dlsw_flags_tree, hf_dlsw_flow_control_indication, tvb, 15, 1, ENC_BIG_ENDIAN); |
328 | 33 | if (flags & 0x80) |
329 | 11 | { |
330 | 11 | proto_tree_add_item(dlsw_flags_tree, hf_dlsw_flow_control_ack, tvb, 15, 1, ENC_BIG_ENDIAN); |
331 | 11 | proto_tree_add_item(dlsw_flags_tree, hf_dlsw_flow_control_operator, tvb, 15, 1, ENC_BIG_ENDIAN); |
332 | 11 | } |
333 | 33 | } |
334 | 34 | if (hlen != DLSW_INFO_HEADER) |
335 | 32 | { |
336 | 32 | if (mtype==CAP_EXCHANGE) |
337 | 1 | { |
338 | 1 | proto_tree_add_item(dlsw_header_tree, hf_dlsw_protocol_id, tvb, 16, 1, ENC_BIG_ENDIAN); |
339 | 1 | proto_tree_add_item(dlsw_header_tree, hf_dlsw_header_number, tvb, 17, 1, ENC_BIG_ENDIAN); |
340 | 1 | proto_tree_add_expert(dlsw_header_tree, pinfo, &ei_dlsw_not_used_for_capex, tvb, 18, 5); |
341 | 1 | proto_tree_add_item(dlsw_header_tree, hf_dlsw_old_message_type, tvb, 23, 1, ENC_BIG_ENDIAN); |
342 | 1 | proto_tree_add_expert(dlsw_header_tree, pinfo, &ei_dlsw_not_used_for_capex, tvb, 24, 14); |
343 | 1 | proto_tree_add_item(dlsw_header_tree, hf_dlsw_capex_type, tvb, 38, 1, ENC_BIG_ENDIAN); |
344 | 1 | proto_tree_add_expert(dlsw_header_tree, pinfo, &ei_dlsw_not_used_for_capex, tvb, 39, 33); |
345 | 1 | } |
346 | 31 | else |
347 | 31 | { |
348 | 31 | proto_tree_add_item(dlsw_header_tree, hf_dlsw_protocol_id, tvb, 16, 1, ENC_BIG_ENDIAN); |
349 | 31 | proto_tree_add_item(dlsw_header_tree, hf_dlsw_header_number, tvb, 17, 1, ENC_BIG_ENDIAN); |
350 | 31 | proto_tree_add_item(dlsw_header_tree, hf_dlsw_reserved, tvb, 18, 2, ENC_NA) ; |
351 | 31 | proto_tree_add_item(dlsw_header_tree, hf_dlsw_largest_frame_size, tvb, 20, 1, ENC_BIG_ENDIAN); |
352 | 31 | ti2 = proto_tree_add_item(dlsw_header_tree, hf_dlsw_ssp_flags, tvb, 21, 1, ENC_BIG_ENDIAN); |
353 | 31 | dlsw_flags_tree = proto_item_add_subtree(ti2, ett_dlsw_sspflags); |
354 | 31 | proto_tree_add_item (dlsw_flags_tree, hf_dlsw_flags_explorer_msg, tvb, 21, 1, ENC_BIG_ENDIAN); |
355 | 31 | proto_tree_add_item(dlsw_header_tree, hf_dlsw_circuit_priority, tvb, 22, 1, ENC_BIG_ENDIAN); |
356 | 31 | proto_tree_add_item(dlsw_header_tree, hf_dlsw_old_message_type, tvb, 23, 1, ENC_BIG_ENDIAN); |
357 | 31 | proto_tree_add_item(dlsw_header_tree, hf_dlsw_target_mac_address, tvb, 24, 6, ENC_NA); |
358 | 31 | proto_tree_add_item(dlsw_header_tree, hf_dlsw_origin_mac_address, tvb, 30, 6, ENC_NA); |
359 | 31 | proto_tree_add_item(dlsw_header_tree, hf_dlsw_origin_link_sap, tvb, 36, 1, ENC_BIG_ENDIAN); |
360 | 31 | proto_tree_add_item(dlsw_header_tree, hf_dlsw_target_link_sap, tvb, 37, 1, ENC_BIG_ENDIAN); |
361 | 31 | proto_tree_add_item(dlsw_header_tree, hf_dlsw_frame_direction, tvb, 38, 1, ENC_BIG_ENDIAN); |
362 | 31 | proto_tree_add_item(dlsw_header_tree, hf_dlsw_reserved, tvb, 39, 3, ENC_NA) ; |
363 | 31 | dlchlen=tvb_get_ntohs(tvb,42); |
364 | 31 | ti = proto_tree_add_item(dlsw_header_tree, hf_dlsw_dlc_header_length, tvb, 42, 2, ENC_BIG_ENDIAN); |
365 | 31 | if ( dlchlen > mlen ) |
366 | 14 | { |
367 | 14 | expert_add_info_format(pinfo, ti, &ei_dlsw_dlc_header_length, |
368 | 14 | "DLC Header Length = %u (bogus, must be <= message length %u)",dlchlen, mlen) ; |
369 | 14 | return 44; |
370 | 14 | } |
371 | 17 | proto_tree_add_item(dlsw_header_tree, hf_dlsw_origin_dlc_port_id, tvb, 44, 4, ENC_BIG_ENDIAN); |
372 | 17 | proto_tree_add_item(dlsw_header_tree, hf_dlsw_origin_dlc, tvb, 48, 4, ENC_BIG_ENDIAN); |
373 | 17 | proto_tree_add_item(dlsw_header_tree, hf_dlsw_origin_transport_id, tvb, 52, 4, ENC_BIG_ENDIAN); |
374 | 17 | proto_tree_add_item(dlsw_header_tree, hf_dlsw_target_dlc_port_id, tvb, 56, 4, ENC_BIG_ENDIAN); |
375 | 17 | proto_tree_add_item(dlsw_header_tree, hf_dlsw_target_dlc, tvb, 60, 4, ENC_BIG_ENDIAN); |
376 | 17 | proto_tree_add_item(dlsw_header_tree, hf_dlsw_target_transport_id, tvb, 64, 4, ENC_BIG_ENDIAN); |
377 | 17 | proto_tree_add_item(dlsw_header_tree, hf_dlsw_reserved, tvb, 68, 4, ENC_NA) ; |
378 | 17 | } |
379 | 32 | } |
380 | | |
381 | | /* end of header dissector */ |
382 | | |
383 | 20 | dlsw_data_tree = proto_tree_add_subtree(dlsw_tree, tvb, hlen, mlen, ett_dlsw_data, &ti2, "DLSw data"); |
384 | | |
385 | 20 | switch (mtype) |
386 | 20 | { |
387 | 1 | case CAP_EXCHANGE: |
388 | 1 | dissect_dlsw_capex(tvb_new_subset_length(tvb, hlen, mlen), pinfo, dlsw_data_tree, ti2); |
389 | 1 | break; |
390 | 1 | case IFCM: |
391 | 1 | case INFOFRAME: |
392 | 2 | case KEEPALIVE: |
393 | 2 | proto_tree_add_item(dlsw_data_tree, hf_dlsw_data, tvb, hlen, mlen, ENC_NA); |
394 | 2 | break; |
395 | | |
396 | 12 | default: |
397 | 12 | if (dlchlen!=0) |
398 | 5 | { |
399 | 5 | proto_tree_add_item(dlsw_data_tree, hf_dlsw_dlc_header_ac_byte, tvb, hlen, 1, ENC_BIG_ENDIAN); |
400 | 5 | proto_tree_add_item(dlsw_data_tree, hf_dlsw_dlc_header_fc_byte, tvb, hlen+1, 1, ENC_BIG_ENDIAN); |
401 | 5 | proto_tree_add_item(dlsw_data_tree, hf_dlsw_dlc_header_da, tvb, hlen+2, 6, ENC_ASCII); |
402 | 5 | proto_tree_add_item(dlsw_data_tree, hf_dlsw_dlc_header_sa, tvb, hlen+8, 6, ENC_ASCII); |
403 | 5 | proto_tree_add_item(dlsw_data_tree, hf_dlsw_dlc_header_rif, tvb, hlen+14, 18, ENC_ASCII); |
404 | 5 | proto_tree_add_item(dlsw_data_tree, hf_dlsw_dlc_header_dsap, tvb, hlen+32, 1, ENC_BIG_ENDIAN); |
405 | 5 | proto_tree_add_item(dlsw_data_tree, hf_dlsw_dlc_header_ssap, tvb, hlen+33, 1, ENC_BIG_ENDIAN); |
406 | 5 | proto_tree_add_item(dlsw_data_tree, hf_dlsw_dlc_header_ctrl, tvb, hlen+34, 1, ENC_BIG_ENDIAN); |
407 | 5 | } |
408 | 12 | proto_tree_add_item(dlsw_data_tree, hf_dlsw_data, tvb, hlen+dlchlen, mlen-dlchlen, ENC_NA); |
409 | 20 | } |
410 | | |
411 | 7 | return tvb_captured_length(tvb); |
412 | 20 | } |
413 | | |
414 | | static void |
415 | | dlsw_fmt_version( char *result, uint32_t revision ) |
416 | 0 | { |
417 | 0 | snprintf( result, ITEM_LABEL_LENGTH, "%d.%02d", (uint8_t)(( revision & 0xFF00 ) >> 8), (uint8_t)(revision & 0xFF) ); |
418 | 0 | } |
419 | | |
420 | | static void |
421 | | dissect_dlsw_capex(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree *ti2) |
422 | 1 | { |
423 | 1 | int vlen,vtype,i=0; |
424 | 1 | uint8_t tmp8; |
425 | 1 | uint32_t gdsid, mlen,offset=4; |
426 | 1 | proto_tree *dlsw_vector_tree; |
427 | 1 | proto_tree_add_item_ret_uint(tree, hf_dlsw_capabilities_length, tvb, 0, 2, ENC_BIG_ENDIAN, &mlen); |
428 | 1 | proto_tree_add_item_ret_uint(tree, hf_dlsw_gds_id, tvb, 2, 2, ENC_BIG_ENDIAN, &gdsid); |
429 | 1 | proto_item_append_text(ti2," - %s",val_to_str_const( gdsid, dlsw_gds_vals, "Invalid GDS ID")); |
430 | 1 | switch (gdsid) { |
431 | 0 | case DLSW_GDSID_ACK: |
432 | 0 | break; |
433 | 0 | case DLSW_GDSID_REF: |
434 | 0 | proto_tree_add_item(tree, hf_dlsw_error_pointer, tvb, 4, 2, ENC_BIG_ENDIAN); |
435 | 0 | proto_tree_add_item(tree, hf_dlsw_error_cause, tvb, 6, 2, ENC_BIG_ENDIAN); |
436 | 0 | break; |
437 | 0 | case DLSW_GDSID_SEND: |
438 | 0 | while (offset < mlen){ |
439 | 0 | vlen=tvb_get_uint8(tvb,offset); |
440 | 0 | if (vlen < 3) { |
441 | 0 | proto_tree_add_expert(tree, pinfo, &ei_dlsw_vec_len_invalid, tvb, offset, 1); |
442 | 0 | return; |
443 | 0 | } |
444 | 0 | vtype=tvb_get_uint8(tvb,offset+1); |
445 | 0 | dlsw_vector_tree=proto_tree_add_subtree (tree,tvb,offset,vlen,ett_dlsw_vector,NULL, |
446 | 0 | val_to_str_const(vtype,dlsw_vector_vals,"Unknown vector type")); |
447 | 0 | proto_tree_add_item(dlsw_vector_tree, hf_dlsw_vector_length, tvb, offset, 1, ENC_BIG_ENDIAN); |
448 | 0 | proto_tree_add_item(dlsw_vector_tree, hf_dlsw_vector_type, tvb, offset+1, 1, ENC_BIG_ENDIAN); |
449 | 0 | switch (vtype){ |
450 | 0 | case 0x81: |
451 | 0 | proto_tree_add_item(dlsw_vector_tree, hf_dlsw_oui, tvb, offset+2, vlen-2, ENC_BIG_ENDIAN); |
452 | 0 | break; |
453 | 0 | case 0x82: |
454 | 0 | proto_tree_add_item(dlsw_vector_tree, hf_dlsw_dlsw_version, tvb, offset+2, 2, ENC_BIG_ENDIAN); |
455 | 0 | break; |
456 | 0 | case 0x83: |
457 | 0 | proto_tree_add_item(dlsw_vector_tree, hf_dlsw_initial_pacing_window, tvb, offset+2, vlen-2, ENC_BIG_ENDIAN); |
458 | 0 | break; |
459 | 0 | case 0x84: |
460 | 0 | proto_tree_add_item(dlsw_vector_tree, hf_dlsw_version_string, tvb, offset+2, vlen-2, ENC_ASCII); |
461 | 0 | break; |
462 | 0 | case 0x85: |
463 | 0 | tmp8 = tvb_get_uint8(tvb,offset+2); |
464 | 0 | proto_tree_add_uint_format_value(dlsw_vector_tree, hf_dlsw_mac_address_exclusivity, tvb,offset+2, 1, |
465 | 0 | tmp8, "%s",tmp8==1?"On":"Off"); |
466 | 0 | break; |
467 | 0 | case 0x86: |
468 | 0 | for (i = 0; i < vlen - 2; i++) |
469 | 0 | { |
470 | 0 | static int * const flags[] = { |
471 | 0 | &hf_dlsw_sap_list_support_x0, |
472 | 0 | &hf_dlsw_sap_list_support_x2, |
473 | 0 | &hf_dlsw_sap_list_support_x4, |
474 | 0 | &hf_dlsw_sap_list_support_x6, |
475 | 0 | &hf_dlsw_sap_list_support_x8, |
476 | 0 | &hf_dlsw_sap_list_support_xA, |
477 | 0 | &hf_dlsw_sap_list_support_xC, |
478 | 0 | &hf_dlsw_sap_list_support_xE, |
479 | 0 | NULL |
480 | 0 | }; |
481 | |
|
482 | 0 | proto_tree_add_bitmask_with_flags(dlsw_vector_tree, tvb, offset+2+i, hf_dlsw_sap_list_support, ett_dlsw_sap_list_support, flags, ENC_NA, BMT_NO_FALSE); |
483 | 0 | } |
484 | 0 | break; |
485 | 0 | case 0x87: |
486 | 0 | proto_tree_add_item(dlsw_vector_tree, hf_dlsw_tcp_connections, tvb, offset+2, vlen-2, ENC_BIG_ENDIAN); |
487 | 0 | break; |
488 | 0 | case 0x88: |
489 | 0 | tmp8 = tvb_get_uint8(tvb,offset+2); |
490 | 0 | proto_tree_add_uint_format_value(dlsw_vector_tree, hf_dlsw_netbios_name_exclusivity, tvb,offset+2,1, |
491 | 0 | tmp8, "%s", tmp8==1?"On":"Off"); |
492 | 0 | break; |
493 | 0 | case 0x89: |
494 | 0 | proto_tree_add_item(dlsw_vector_tree, hf_dlsw_mac_address_list, tvb, offset+2, 6, ENC_NA); |
495 | 0 | proto_tree_add_item(dlsw_vector_tree, hf_dlsw_mac_address_list, tvb, offset+8, 6, ENC_NA); |
496 | 0 | break; |
497 | 0 | case 0x8a: |
498 | 0 | proto_tree_add_item(dlsw_vector_tree, hf_dlsw_netbios_name, tvb, offset+2, vlen-2, ENC_ASCII); |
499 | 0 | break; |
500 | 0 | case 0x8b: |
501 | 0 | proto_tree_add_item(dlsw_vector_tree, hf_dlsw_vendor_oui, tvb, offset+2, vlen-2, ENC_BIG_ENDIAN); |
502 | 0 | break; |
503 | 0 | case 0x8c: |
504 | 0 | proto_tree_add_item(dlsw_vector_tree, hf_dlsw_multicast_version_number, tvb, offset+2, vlen-2, ENC_BIG_ENDIAN); |
505 | 0 | break; |
506 | 0 | default: |
507 | 0 | proto_tree_add_item(dlsw_vector_tree, hf_dlsw_vector_data, tvb, offset+2, vlen-2, ENC_NA); |
508 | 0 | } |
509 | 0 | offset+=vlen; |
510 | 0 | }; |
511 | 0 | break; |
512 | 1 | default: |
513 | 1 | proto_tree_add_item(tree, hf_dlsw_unknown_data, tvb, 4, mlen - 4, ENC_NA); |
514 | 1 | } |
515 | | |
516 | 1 | } |
517 | | |
518 | | static int |
519 | | dissect_dlsw_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) |
520 | 0 | { |
521 | 0 | if (try_val_to_str(tvb_get_uint8(tvb, 0), dlsw_version_vals) == NULL) |
522 | 0 | { |
523 | | /* Probably not a DLSw packet. */ |
524 | 0 | return 0; |
525 | 0 | } |
526 | | |
527 | 0 | return dissect_dlsw_pdu(tvb, pinfo, tree, data); |
528 | 0 | } |
529 | | |
530 | | static unsigned |
531 | | get_dlsw_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_) |
532 | 34 | { |
533 | 34 | unsigned hlen, mlen; |
534 | | |
535 | | /* |
536 | | * Get the length of the DLSw header. |
537 | | */ |
538 | 34 | hlen=tvb_get_uint8(tvb,offset+1); |
539 | | |
540 | | /* |
541 | | * Get the length of the DLSw message. |
542 | | */ |
543 | 34 | mlen = tvb_get_ntohs(tvb,offset+2); |
544 | | |
545 | | /* |
546 | | * The total length is the sum of those. |
547 | | */ |
548 | 34 | return hlen + mlen; |
549 | 34 | } |
550 | | |
551 | | static int |
552 | | dissect_dlsw_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) |
553 | 13 | { |
554 | 13 | if (try_val_to_str(tvb_get_uint8(tvb, 0), dlsw_version_vals) == NULL) |
555 | 0 | { |
556 | | /* Probably not a DLSw packet. */ |
557 | 0 | return 0; |
558 | 0 | } |
559 | | |
560 | 13 | tcp_dissect_pdus(tvb, pinfo, tree, true, 4, get_dlsw_pdu_len, dissect_dlsw_pdu, data); |
561 | 13 | return tvb_captured_length(tvb); |
562 | 13 | } |
563 | | |
564 | | void |
565 | | proto_register_dlsw(void) |
566 | 16 | { |
567 | 16 | static hf_register_info hf[] = { |
568 | 16 | {&hf_dlsw_flow_control_indication, |
569 | 16 | {"Flow Control Indication", "dlsw.flow_control_indication", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x80, |
570 | 16 | NULL, HFILL}}, |
571 | 16 | {&hf_dlsw_flow_control_ack, |
572 | 16 | {"Flow Control Acknowledgment", "dlsw.flow_control_ack", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x40, |
573 | 16 | NULL, HFILL}}, |
574 | 16 | {&hf_dlsw_flow_control_operator, |
575 | 16 | {"Flow Control Operator", "dlsw.flow_control_operator", FT_UINT8, BASE_DEC, VALS(dlsw_fc_cmd_vals), 0x07, |
576 | 16 | NULL, HFILL}}, |
577 | 16 | {&hf_dlsw_flags_explorer_msg, |
578 | 16 | {"Explorer message", "dlsw.flags.explorer_msg", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x80, |
579 | 16 | NULL, HFILL}}, |
580 | | /* Generated from convert_proto_tree_add_text.pl */ |
581 | 16 | { &hf_dlsw_version, { "Version", "dlsw.version", FT_UINT8, BASE_DEC, VALS(dlsw_version_vals), 0x0, NULL, HFILL }}, |
582 | 16 | { &hf_dlsw_header_length, { "Header Length", "dlsw.header_length", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, |
583 | 16 | { &hf_dlsw_message_length, { "Message Length", "dlsw.message_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, |
584 | 16 | { &hf_dlsw_remote_dlc, { "Remote DLC", "dlsw.remote_dlc", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, |
585 | 16 | { &hf_dlsw_remote_dlc_pid, { "Remote DLC PID", "dlsw.remote_dlc_pid", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, |
586 | 16 | { &hf_dlsw_message_type, { "Message Type", "dlsw.message_type", FT_UINT8, BASE_HEX, VALS(dlsw_type_vals), 0x0, NULL, HFILL }}, |
587 | 16 | { &hf_dlsw_flow_ctrl_byte, { "Flow ctrl byte", "dlsw.flow_ctrl_byte", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }}, |
588 | 16 | { &hf_dlsw_protocol_id, { "Protocol ID", "dlsw.protocol_id", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }}, |
589 | 16 | { &hf_dlsw_header_number, { "Header Number", "dlsw.header_number", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }}, |
590 | 16 | { &hf_dlsw_old_message_type, { "Old message type", "dlsw.old_message_type", FT_UINT8, BASE_HEX, VALS(dlsw_type_vals), 0x0, NULL, HFILL }}, |
591 | 16 | { &hf_dlsw_capex_type, { "Capability exchange type", "dlsw.capex_type", FT_UINT8, BASE_HEX, VALS(dlsw_capex_type_vals), 0x0, NULL, HFILL }}, |
592 | 16 | { &hf_dlsw_largest_frame_size, { "Largest Frame size", "dlsw.largest_frame_size", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, |
593 | 16 | { &hf_dlsw_ssp_flags, { "SSP Flags", "dlsw.flags", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }}, |
594 | 16 | { &hf_dlsw_circuit_priority, { "Circuit priority", "dlsw.circuit_priority", FT_UINT8, BASE_DEC, VALS(dlsw_pri_vals), 0x7, NULL, HFILL }}, |
595 | 16 | { &hf_dlsw_target_mac_address, { "Target MAC Address", "dlsw.target_mac_address", FT_ETHER, BASE_NONE, NULL, 0x0, NULL, HFILL }}, |
596 | 16 | { &hf_dlsw_origin_mac_address, { "Origin MAC Address", "dlsw.origin_mac_address", FT_ETHER, BASE_NONE, NULL, 0x0, NULL, HFILL }}, |
597 | 16 | { &hf_dlsw_origin_link_sap, { "Origin Link SAP", "dlsw.origin_link_sap", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }}, |
598 | 16 | { &hf_dlsw_target_link_sap, { "Target Link SAP", "dlsw.target_link_sap", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }}, |
599 | 16 | { &hf_dlsw_frame_direction, { "Frame direction", "dlsw.frame_direction", FT_UINT8, BASE_HEX, VALS(dlsw_frame_direction_vals), 0x0, NULL, HFILL }}, |
600 | 16 | { &hf_dlsw_dlc_header_length, { "DLC Header Length", "dlsw.dlc_header_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, |
601 | 16 | { &hf_dlsw_origin_dlc_port_id, { "Origin DLC Port ID", "dlsw.origin_dlc_port_id", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, |
602 | 16 | { &hf_dlsw_origin_dlc, { "Origin DLC", "dlsw.origin_dlc", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, |
603 | 16 | { &hf_dlsw_origin_transport_id, { "Origin Transport ID", "dlsw.origin_transport_id", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, |
604 | 16 | { &hf_dlsw_target_dlc_port_id, { "Target DLC Port ID", "dlsw.target_dlc_port_id", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, |
605 | 16 | { &hf_dlsw_target_dlc, { "Target DLC", "dlsw.target_dlc", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, |
606 | 16 | { &hf_dlsw_target_transport_id, { "Target Transport ID", "dlsw.target_transport_id", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, |
607 | 16 | { &hf_dlsw_dlc_header_ac_byte, { "DLC Header - AC byte", "dlsw.dlc_header.ac_byte", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }}, |
608 | 16 | { &hf_dlsw_dlc_header_fc_byte, { "DLC Header - FC byte", "dlsw.dlc_header.fc_byte", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }}, |
609 | 16 | { &hf_dlsw_dlc_header_da, { "DLC Header - DA", "dlsw.dlc_header.da", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, |
610 | 16 | { &hf_dlsw_dlc_header_sa, { "DLC Header - SA", "dlsw.dlc_header.sa", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, |
611 | 16 | { &hf_dlsw_dlc_header_rif, { "DLC Header - RIF", "dlsw.dlc_header.rif", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, |
612 | 16 | { &hf_dlsw_dlc_header_dsap, { "DLC Header - DSAP", "dlsw.dlc_header.dsap", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }}, |
613 | 16 | { &hf_dlsw_dlc_header_ssap, { "DLC Header - SSAP", "dlsw.dlc_header.ssap", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }}, |
614 | 16 | { &hf_dlsw_dlc_header_ctrl, { "DLC Header - Ctrl", "dlsw.dlc_header.ctrl", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }}, |
615 | 16 | { &hf_dlsw_capabilities_length, { "Capabilities Length", "dlsw.capabilities_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, |
616 | 16 | { &hf_dlsw_error_pointer, { "Error pointer", "dlsw.error_pointer", FT_INT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, |
617 | 16 | { &hf_dlsw_error_cause, { "Error cause", "dlsw.error_cause", FT_UINT16, BASE_HEX, VALS(dlsw_refuse_vals), 0x0, NULL, HFILL }}, |
618 | 16 | { &hf_dlsw_vector_length, { "Vector Length", "dlsw.vector_length", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, |
619 | 16 | { &hf_dlsw_vector_type, { "Vector Type", "dlsw.vector_type", FT_UINT8, BASE_HEX, VALS(dlsw_vector_vals), 0x0, NULL, HFILL }}, |
620 | 16 | { &hf_dlsw_oui, { "OUI", "dlsw.oui", FT_UINT24, BASE_HEX, NULL, 0x0, NULL, HFILL }}, |
621 | 16 | { &hf_dlsw_initial_pacing_window, { "Initial Pacing Window", "dlsw.initial_pacing_window", FT_INT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, |
622 | 16 | { &hf_dlsw_dlsw_version, { "DLSw Version", "dlsw.dlsw_version", FT_UINT16, BASE_CUSTOM, CF_FUNC(dlsw_fmt_version), 0x0, NULL, HFILL }}, |
623 | 16 | { &hf_dlsw_version_string, { "Version String", "dlsw.version_string", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, |
624 | 16 | { &hf_dlsw_tcp_connections, { "TCP connections", "dlsw.tcp_connections", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, |
625 | 16 | { &hf_dlsw_mac_address_list, { "MAC Address List", "dlsw.mac_address_list", FT_ETHER, BASE_NONE, NULL, 0x0, NULL, HFILL }}, |
626 | 16 | { &hf_dlsw_netbios_name, { "NetBIOS name", "dlsw.netbios_name", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, |
627 | 16 | { &hf_dlsw_vendor_oui, { "Vendor OUI", "dlsw.vendor_oui", FT_UINT24, BASE_HEX, NULL, 0x0, NULL, HFILL }}, |
628 | 16 | { &hf_dlsw_multicast_version_number, { "Multicast Version Number", "dlsw.multicast_version_number", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, |
629 | 16 | { &hf_dlsw_reserved, { "Reserved", "dlsw.reserved", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, |
630 | 16 | { &hf_dlsw_data, { "Data", "dlsw.data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, |
631 | 16 | { &hf_dlsw_vector_data, { "Data", "dlsw.vector_data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, |
632 | 16 | { &hf_dlsw_unknown_data, { "Data", "dlsw.unknown_data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, |
633 | 16 | { &hf_dlsw_mac_address_exclusivity, { "MAC Address Exclusivity", "dlsw.mac_address_exclusivity", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, |
634 | 16 | { &hf_dlsw_netbios_name_exclusivity, { "NetBIOS Name Exclusivity", "dlsw.netbios_name_exclusivity", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, |
635 | 16 | { &hf_dlsw_gds_id, { "GDS ID", "dlsw.gds_id", FT_UINT16, BASE_DEC, VALS(dlsw_gds_vals), 0x0, NULL, HFILL }}, |
636 | 16 | { &hf_dlsw_sap_list_support, { "SAP List Support", "dlsw.sap_list_support", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }}, |
637 | 16 | { &hf_dlsw_sap_list_support_x0, { "x0", "dlsw.sap_list_support.x0", FT_BOOLEAN, 8, TFS(&tfs_on_off), 0x80, NULL, HFILL }}, |
638 | 16 | { &hf_dlsw_sap_list_support_x2, { "x2", "dlsw.sap_list_support.x2", FT_BOOLEAN, 8, TFS(&tfs_on_off), 0x40, NULL, HFILL }}, |
639 | 16 | { &hf_dlsw_sap_list_support_x4, { "x4", "dlsw.sap_list_support.x4", FT_BOOLEAN, 8, TFS(&tfs_on_off), 0x20, NULL, HFILL }}, |
640 | 16 | { &hf_dlsw_sap_list_support_x6, { "x6", "dlsw.sap_list_support.x6", FT_BOOLEAN, 8, TFS(&tfs_on_off), 0x10, NULL, HFILL }}, |
641 | 16 | { &hf_dlsw_sap_list_support_x8, { "x8", "dlsw.sap_list_support.x8", FT_BOOLEAN, 8, TFS(&tfs_on_off), 0x08, NULL, HFILL }}, |
642 | 16 | { &hf_dlsw_sap_list_support_xA, { "xA", "dlsw.sap_list_support.xA", FT_BOOLEAN, 8, TFS(&tfs_on_off), 0x04, NULL, HFILL }}, |
643 | 16 | { &hf_dlsw_sap_list_support_xC, { "xC", "dlsw.sap_list_support.xC", FT_BOOLEAN, 8, TFS(&tfs_on_off), 0x02, NULL, HFILL }}, |
644 | 16 | { &hf_dlsw_sap_list_support_xE, { "xE", "dlsw.sap_list_support.xE", FT_BOOLEAN, 8, TFS(&tfs_on_off), 0x01, NULL, HFILL }}, |
645 | 16 | }; |
646 | | |
647 | 16 | static int *ett[] = { |
648 | 16 | &ett_dlsw, |
649 | 16 | &ett_dlsw_header, |
650 | 16 | &ett_dlsw_fc, |
651 | 16 | &ett_dlsw_sspflags, |
652 | 16 | &ett_dlsw_data, |
653 | 16 | &ett_dlsw_vector, |
654 | 16 | &ett_dlsw_sap_list_support, |
655 | 16 | }; |
656 | | |
657 | 16 | static ei_register_info ei[] = { |
658 | 16 | { &ei_dlsw_dlc_header_length, { "dlsw.dlc_header_length.bogus", PI_PROTOCOL, PI_WARN, "DLC Header Length bogus", EXPFILL }}, |
659 | 16 | { &ei_dlsw_not_used_for_capex, { "dlsw.not_used_for_capex", PI_PROTOCOL, PI_NOTE, "Not used for CapEx", EXPFILL }}, |
660 | 16 | { &ei_dlsw_vec_len_invalid, { "dlsw.vec_len_invalid", PI_MALFORMED, PI_ERROR, "Invalid vector length (must be >=3)", EXPFILL }} |
661 | 16 | }; |
662 | | |
663 | 16 | expert_module_t* expert_dlsw; |
664 | | |
665 | 16 | proto_dlsw = proto_register_protocol("Data Link SWitching", "DLSw", "dlsw"); |
666 | 16 | proto_register_field_array(proto_dlsw, hf, array_length(hf)); |
667 | 16 | proto_register_subtree_array(ett, array_length(ett)); |
668 | 16 | expert_dlsw = expert_register_protocol(proto_dlsw); |
669 | 16 | expert_register_field_array(expert_dlsw, ei, array_length(ei)); |
670 | | |
671 | 16 | dlsw_udp_handle = register_dissector("dlsw.udp", dissect_dlsw_udp, proto_dlsw); |
672 | 16 | dlsw_tcp_handle = register_dissector("dlsw.tcp", dissect_dlsw_tcp, proto_dlsw); |
673 | 16 | } |
674 | | |
675 | | void |
676 | | proto_reg_handoff_dlsw(void) |
677 | 16 | { |
678 | 16 | dissector_add_uint_with_preference("udp.port", UDP_PORT_DLSW, dlsw_udp_handle); |
679 | 16 | dissector_add_uint_with_preference("tcp.port", TCP_PORT_DLSW, dlsw_tcp_handle); |
680 | 16 | } |
681 | | |
682 | | /* |
683 | | * Editor modelines - https://www.wireshark.org/tools/modelines.html |
684 | | * |
685 | | * Local Variables: |
686 | | * c-basic-offset: 2 |
687 | | * tab-width: 8 |
688 | | * indent-tabs-mode: nil |
689 | | * End: |
690 | | * |
691 | | * ex: set shiftwidth=2 tabstop=8 expandtab: |
692 | | * :indentSize=2:tabSize=8:noTabs=true: |
693 | | */ |