Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-vines.c
blobcd899adf198cb98cb63de8f401af8b9281aea21a
1 /* packet-vines.c
2 * Routines for Banyan VINES protocol packet disassembly
4 * Don Lafontaine <lafont02@cn.ca>
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
9 * Joerg Mayer (see AUTHORS file)
11 * SPDX-License-Identifier: GPL-2.0-or-later
14 /* Information about VINES can be found in
16 * VINES Protocol Definition
17 * Order Number: DA254-00
18 * Banyan Systems incorporated
19 * February 1990
20 * Part Number: 092093-000
22 * Banyan Systems are no longer in business, so that document cannot be
23 * ordered from them. An online copy appears to be available at
25 * http://banyan-vines.bamertal.com/Banyan-supplier-help/ProtoDef/ProtoDefMain.htm
27 * along with the VINES Architecture Definition at
29 * http://banyan-vines.bamertal.com/Banyan-supplier-help/ArchDef/ArchDefMain.htm
31 * and other VINES documentation linked to from
33 * http://banyan-vines.bamertal.com/Banyan-supplier-help/banyan.htm
35 * Some information can also be found in
37 * http://docwiki.cisco.com/wiki/Banyan_VINES
39 * and at
41 * http://www.banalyzer.de/ban/HTML/P_VINES/Eng/P_vines.html
43 * The document at
45 * http://www.watersprings.org/pub/id/draft-ietf-rmonmib-rmonprot-v2-00.txt
47 * lists a bunch of values of protocol identifier fields for various
48 * protocols. It speaks of the Vines Fragmentation Protocol,
49 * the "Vines Token Ring Protocol" which appears to be the same as the
50 * "Vines LLC" protocol here, the Vines echo protocol, Vines IP, and
51 * protocols running atop Vines IP.
53 * The LLC values it describes are:
55 * 0xbc (SAP_VINES2) Vines Token Ring a/k/a Vines LLC
57 * It doesn't mention 0xba (SAP_VINES1).
59 * The Vines Token Ring/Vines LLC protocol identifier values it
60 * describes are:
62 * 0xba Vines IP
63 * 0xbb Vines Echo
65 * The Ethernet type values it describes are:
67 * 0x0bad (ETHERTYPE_VINES) Vines IP
68 * 0x0baf Vines Echo
71 #include "config.h"
73 #include <epan/packet.h>
74 #include <epan/capture_dissectors.h>
75 #include <epan/etypes.h>
76 #include <epan/ppptypes.h>
77 #include <epan/ipproto.h>
78 #include <epan/arcnet_pids.h>
79 #include <epan/llcsaps.h>
80 #include <epan/to_str.h>
81 #include <epan/tfs.h>
82 #include <wsutil/array.h>
84 void proto_register_vines_frp(void);
85 void proto_reg_handoff_vines_frp(void);
86 void proto_register_vines_llc(void);
87 void proto_reg_handoff_vines_llc(void);
88 void proto_register_vines_ip(void);
89 void proto_reg_handoff_vines_ip(void);
90 void proto_register_vines_echo(void);
91 void proto_reg_handoff_vines_echo(void);
92 void proto_register_vines_ipc(void);
93 void proto_reg_handoff_vines_ipc(void);
94 void proto_register_vines_spp(void);
95 void proto_reg_handoff_vines_spp(void);
96 void proto_register_vines_arp(void);
97 void proto_reg_handoff_vines_arp(void);
98 void proto_register_vines_rtp(void);
99 void proto_reg_handoff_vines_rtp(void);
100 void proto_register_vines_icp(void);
101 void proto_reg_handoff_vines_icp(void);
104 #define UDP_PORT_VINES 573
106 static int proto_vines_frp;
107 static int hf_vines_frp_flags;
108 static int hf_vines_frp_flags_first_fragment;
109 static int hf_vines_frp_flags_last_fragment;
110 static int hf_vines_frp_sequence_number;
112 static int ett_vines_frp;
113 static int ett_vines_frp_flags;
115 static dissector_handle_t vines_frp_handle, vines_frp_new_handle;
117 static int proto_vines_llc;
118 static int hf_vines_llc_packet_type;
120 static int ett_vines_llc;
122 static dissector_handle_t vines_llc_handle;
124 static int proto_vines_ip;
125 static int hf_vines_ip_protocol;
126 static int hf_vines_ip_checksum;
127 static int hf_vines_ip_length;
128 static int hf_vines_ip_source;
129 static int hf_vines_ip_destination;
130 static int hf_vines_tctl;
131 static int hf_vines_tctl_node;
132 static int hf_vines_tctl_class;
133 static int hf_vines_tctl_forward_router;
134 static int hf_vines_tctl_metric;
135 static int hf_vines_tctl_notif_packet;
136 static int hf_vines_tctl_hop_count;
138 static int ett_vines_ip;
139 static int ett_vines_ip_tctl;
141 static dissector_handle_t vines_ip_handle;
143 static int proto_vines_echo;
145 static int hf_vines_echo_data;
147 static int ett_vines_echo;
149 static dissector_handle_t vines_echo_handle;
151 static int proto_vines_ipc;
152 static int hf_vines_ipc_src_port;
153 static int hf_vines_ipc_dest_port;
154 static int hf_vines_ipc_packet_type;
155 static int hf_vines_ipc_control;
156 static int hf_vines_ipc_control_ack;
157 static int hf_vines_ipc_control_end_msg;
158 static int hf_vines_ipc_control_beg_msg;
159 static int hf_vines_ipc_control_abort_msg;
160 static int hf_vines_ipc_local_connection_id;
161 static int hf_vines_ipc_sequence_number;
162 static int hf_vines_ipc_length;
163 static int hf_vines_ipc_remote_connection_id;
164 static int hf_vines_ipc_ack_number;
165 static int hf_vines_ipc_error;
167 static int ett_vines_ipc;
168 static int ett_vines_ipc_control;
170 static dissector_handle_t vines_ipc_handle;
172 static int proto_vines_spp;
173 static int hf_vines_spp_src_port;
174 static int hf_vines_spp_dest_port;
175 static int hf_vines_spp_packet_type;
176 static int hf_vines_spp_control;
177 static int hf_vines_spp_control_ack;
178 static int hf_vines_spp_control_end_msg;
179 static int hf_vines_spp_control_beg_msg;
180 static int hf_vines_spp_control_abort_msg;
181 static int hf_vines_spp_local_id;
182 static int hf_vines_spp_remote_id;
183 static int hf_vines_spp_seq_num;
184 static int hf_vines_spp_ack_num;
185 static int hf_vines_spp_window;
187 static int ett_vines_spp;
188 static int ett_vines_spp_control;
190 static dissector_handle_t vines_spp_handle;
192 static int proto_vines_arp;
193 static int hf_vines_arp_address;
194 static int hf_vines_arp_version;
195 static int hf_vines_arp_packet_type;
196 static int hf_vines_arp_interface_metric;
197 static int hf_vines_arp_sequence_number;
199 static int ett_vines_arp;
201 static dissector_handle_t vines_arp_handle;
203 static int proto_vines_rtp;
204 static int hf_vines_rtp_comp_flag;
205 static int hf_vines_rtp_comp_flag_neighbor_router;
206 static int hf_vines_rtp_comp_flag_sequence_rtp;
207 static int hf_vines_rtp_comp_flag_sequence_rtp_version;
208 static int hf_vines_rtp_control;
209 static int hf_vines_rtp_control_sync_broadcast;
210 static int hf_vines_rtp_control_topology_update;
211 static int hf_vines_rtp_control_specific_request;
212 static int hf_vines_rtp_control_end_msg;
213 static int hf_vines_rtp_control_beg_msg;
214 static int hf_vines_rtp_machine_rtp;
215 static int hf_vines_rtp_machine_tcpip;
216 static int hf_vines_rtp_machine_bus;
217 static int hf_vines_rtp_flag_sequence_rtp;
218 static int hf_vines_rtp_flag_network_p2p;
219 static int hf_vines_rtp_flag_data_link_p2p;
220 static int hf_vines_rtp_flag_broadcast_medium;
221 static int hf_vines_rtp_metric_to_preferred_gateway;
222 static int hf_vines_rtp_requested_info;
223 static int hf_vines_rtp_metric_to_destination;
224 static int hf_vines_rtp_source_route_length;
225 static int hf_vines_rtp_router_sequence_number;
226 static int hf_vines_rtp_sequence_number;
227 static int hf_vines_rtp_data_offset;
228 static int hf_vines_rtp_preferred_gateway_sequence_number;
229 static int hf_vines_rtp_preferred_gateway_node_type;
230 static int hf_vines_rtp_metric;
231 static int hf_vines_rtp_destination_sequence_number;
232 static int hf_vines_rtp_link_address_length;
233 static int hf_vines_rtp_controller_type;
234 static int hf_vines_rtp_destination_node_type;
235 static int hf_vines_rtp_information_type;
236 static int hf_vines_rtp_version;
237 static int hf_vines_rtp_preferred_gateway;
238 static int hf_vines_rtp_neighbor_metric;
239 static int hf_vines_rtp_destination;
240 static int hf_vines_rtp_node_type;
241 static int hf_vines_rtp_operation_type;
242 static int hf_vines_rtp_packet_id;
243 static int hf_vines_rtp_network_number;
244 static int hf_vines_rtp_machine_type;
245 static int hf_vines_rtp_destination_controller_type;
246 static int hf_vines_rtp_destination_machine;
247 static int hf_vines_rtp_pref_gateway_controller_type;
248 static int hf_vines_rtp_pref_gateway_machine;
249 static int hf_vines_rtp_network_flags;
250 static int hf_vines_rtp_destination_flags;
251 static int hf_vines_rtp_preferred_gateway_flags;
252 static int hf_vines_rtp_preferred_gateway_data_link_address_ether;
253 static int hf_vines_rtp_preferred_gateway_data_link_address_bytes;
254 static int hf_vines_rtp_preferred_gateway_source_route;
256 static int ett_vines_rtp;
257 static int ett_vines_rtp_compatibility_flags;
258 static int ett_vines_rtp_req_info;
259 static int ett_vines_rtp_control_flags;
260 static int ett_vines_rtp_mtype;
261 static int ett_vines_rtp_flags;
263 static dissector_handle_t vines_rtp_handle;
265 static int proto_vines;
266 static int proto_vines_icp;
267 static int hf_vines_icp_exception_code;
268 static int hf_vines_icp_metric;
269 static int hf_vines_icp_packet_type;
271 static int ett_vines_icp;
273 static dissector_handle_t vines_icp_handle;
274 static capture_dissector_handle_t vines_echo_cap_handle;
275 static capture_dissector_handle_t vines_ip_cap_handle;
277 /* VINES IP structs and definitions */
279 enum {
280 VIP_PROTO_IPC = 1, /* Interprocess Communications Protocol (IPC) */
281 VIP_PROTO_SPP = 2, /* Sequenced Packet Protocol (SPP) */
282 VIP_PROTO_ARP = 4, /* Address Resolution Protocol (ARP) */
283 VIP_PROTO_RTP = 5, /* Routing Update Protocol (RTP) / SRTP (Sequenced RTP) */
284 VIP_PROTO_ICP = 6 /* Internet Control Protocol (ICP) */
287 /* VINES SPP and IPC structs and definitions */
289 enum {
290 PKTTYPE_DGRAM = 0, /* Unreliable datagram */
291 PKTTYPE_DATA = 1, /* User Data */
292 PKTTYPE_ERR = 2, /* Error */
293 PKTTYPE_DISC = 3, /* Diconnect Request */
294 PKTTYPE_PROBE = 4, /* Probe (retransmit) */
295 PKTTYPE_ACK = 5 /* Acknowledgement */
298 typedef struct _e_vspp {
299 uint16_t vspp_sport;
300 uint16_t vspp_dport;
301 uint8_t vspp_pkttype;
302 uint8_t vspp_control;
303 uint16_t vspp_lclid; /* Local Connection ID */
304 uint16_t vspp_rmtid; /* Remote Connection ID */
305 uint16_t vspp_seqno; /* Sequence Number */
306 uint16_t vspp_ack; /* Acknowledgement Number */
307 uint16_t vspp_win;
308 } e_vspp;
310 typedef struct _e_vipc {
311 uint16_t vipc_sport;
312 uint16_t vipc_dport;
313 uint8_t vipc_pkttype;
314 uint8_t vipc_control;
315 uint16_t vipc_lclid; /* Local Connection ID */
316 uint16_t vipc_rmtid; /* Remote Connection ID */
317 uint16_t vipc_seqno; /* Sequence Number */
318 uint16_t vipc_ack; /* Acknowledgement Number */
319 uint16_t vipc_err_len;
320 } e_vipc;
322 static bool
323 capture_vines(const unsigned char *pd _U_, int offset _U_, int len _U_, capture_packet_info_t *cpinfo, const union wtap_pseudo_header *pseudo_header _U_)
325 capture_dissector_increment_count(cpinfo, proto_vines);
326 return true;
329 /* Control flags */
330 #define VINES_FRP_FIRST_FRAGMENT 0x01
331 #define VINES_FRP_LAST_FRAGMENT 0x02
333 /* AFAIK Vines FRP (Fragmentation Protocol) is used on all media except
334 * Ethernet and TR (and probably FDDI) - Fragmentation on these media types
335 * is not possible
336 * FIXME: Do we need to use this header with PPP too?
338 static int
339 dissect_vines_frp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
341 proto_tree *vines_frp_tree;
342 proto_item *ti;
343 proto_tree *flags_tree;
344 tvbuff_t *next_tvb;
346 col_set_str(pinfo->cinfo, COL_PROTOCOL, "Vines FRP");
347 col_clear(pinfo->cinfo, COL_INFO);
349 if (tree) {
350 ti = proto_tree_add_item(tree, proto_vines_frp, tvb, 0, 2, ENC_NA);
351 vines_frp_tree = proto_item_add_subtree(ti, ett_vines_frp);
353 ti = proto_tree_add_item(vines_frp_tree, hf_vines_frp_flags, tvb, 0, 1, ENC_NA);
354 flags_tree = proto_item_add_subtree(ti, ett_vines_frp_flags);
355 proto_tree_add_item(flags_tree, hf_vines_frp_flags_first_fragment, tvb, 0, 1, ENC_NA);
356 proto_tree_add_item(flags_tree, hf_vines_frp_flags_last_fragment, tvb, 0, 1, ENC_NA);
358 proto_tree_add_item(vines_frp_tree, hf_vines_frp_sequence_number, tvb, 1, 1, ENC_LITTLE_ENDIAN);
361 /* Decode the "real" Vines now */
362 next_tvb = tvb_new_subset_remaining(tvb, 2);
363 call_dissector(vines_ip_handle, next_tvb, pinfo, tree);
364 return tvb_captured_length(tvb);
367 static int
368 dissect_vines_frp_new(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
369 void *params _U_)
371 if (pinfo->srcport != pinfo->destport) {
372 /* Require that the source and destination ports be the
373 * port for Vines FRP. */
374 return 0;
376 if (!tvb_bytes_exist(tvb, 0, 1)) {
377 /* Too short to check the flags value. */
378 return 0;
381 if ((tvb_get_uint8(tvb, 0) & ~(VINES_FRP_FIRST_FRAGMENT|VINES_FRP_LAST_FRAGMENT)) != 0) {
382 /* Those are the only flags; if anything else is set, this
383 * is presumably not Vines FRP. */
384 return 0;
386 dissect_vines_frp(tvb, pinfo, tree, params);
387 return tvb_captured_length(tvb);
390 void
391 proto_register_vines_frp(void)
393 static hf_register_info hf[] = {
394 { &hf_vines_frp_flags,
395 { "Control Flags", "vines_frp.flags",
396 FT_UINT8, BASE_HEX, NULL, 0x0,
397 NULL, HFILL }},
399 { &hf_vines_frp_flags_first_fragment,
400 { "First fragment", "vines_frp.flags.first_fragment",
401 FT_BOOLEAN, 8, NULL, VINES_FRP_FIRST_FRAGMENT,
402 NULL, HFILL }},
404 { &hf_vines_frp_flags_last_fragment,
405 { "Last fragment", "vines_frp.flags.last_fragment",
406 FT_BOOLEAN, 8, NULL, VINES_FRP_LAST_FRAGMENT,
407 NULL, HFILL }},
409 { &hf_vines_frp_sequence_number,
410 { "Sequence Number", "vines_frp.sequence_number",
411 FT_UINT8, BASE_HEX, NULL, 0x0,
412 NULL, HFILL }},
414 static int *ett[] = {
415 &ett_vines_frp,
416 &ett_vines_frp_flags
419 proto_vines_frp = proto_register_protocol("Banyan Vines Fragmentation Protocol", "Vines FRP", "vines_frp");
420 proto_register_field_array(proto_vines_frp, hf, array_length(hf));
421 proto_register_subtree_array(ett, array_length(ett));
422 vines_frp_handle = register_dissector("vines_frp", dissect_vines_frp, proto_vines_frp);
423 vines_frp_new_handle = register_dissector("vines_frp.udp", dissect_vines_frp_new, proto_vines_frp);
426 void
427 proto_reg_handoff_vines_frp(void)
429 dissector_add_uint("ip.proto", IP_PROTO_VINES, vines_frp_handle);
430 dissector_add_uint_with_preference("udp.port", UDP_PORT_VINES, vines_frp_new_handle);
433 static dissector_table_t vines_llc_dissector_table;
435 #define VINES_LLC_IP 0xba
436 #define VINES_LLC_ECHO 0xbb
438 static const value_string vines_llc_ptype_vals[] = {
439 { VINES_LLC_IP, "Vines IP" },
440 { VINES_LLC_ECHO, "Vines Echo" },
441 { 0, NULL }
444 static int
445 dissect_vines_llc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
447 uint8_t ptype;
448 proto_tree *vines_llc_tree;
449 proto_item *ti;
450 tvbuff_t *next_tvb;
452 col_set_str(pinfo->cinfo, COL_PROTOCOL, "Vines LLC");
453 col_clear(pinfo->cinfo, COL_INFO);
455 ptype = tvb_get_uint8(tvb, 0);
456 col_add_str(pinfo->cinfo, COL_INFO,
457 val_to_str(ptype, vines_llc_ptype_vals,
458 "Unknown protocol 0x%02x"));
459 if (tree) {
460 ti = proto_tree_add_item(tree, proto_vines_llc, tvb, 0, 1, ENC_NA);
461 vines_llc_tree = proto_item_add_subtree(ti, ett_vines_llc);
463 proto_tree_add_item(vines_llc_tree, hf_vines_llc_packet_type, tvb, 0, 1, ENC_NA);
466 next_tvb = tvb_new_subset_remaining(tvb, 1);
467 if (!dissector_try_uint(vines_llc_dissector_table, ptype,
468 next_tvb, pinfo, tree))
469 call_data_dissector(next_tvb, pinfo, tree);
471 return tvb_captured_length(tvb);
474 void
475 proto_register_vines_llc(void)
477 static hf_register_info hf[] = {
478 { &hf_vines_llc_packet_type,
479 { "Packet Type", "vines_llc.packet_type",
480 FT_UINT8, BASE_HEX, VALS(vines_llc_ptype_vals), 0x0,
481 NULL, HFILL }},
484 static int *ett[] = {
485 &ett_vines_llc,
488 proto_vines_llc = proto_register_protocol("Banyan Vines LLC", "Vines LLC", "vines_llc");
489 proto_register_field_array(proto_vines_llc, hf, array_length(hf));
490 proto_register_subtree_array(ett, array_length(ett));
491 vines_llc_handle = register_dissector("vines_llc", dissect_vines_llc, proto_vines_llc);
493 /* subdissector code */
494 vines_llc_dissector_table = register_dissector_table("vines_llc.ptype",
495 "Vines LLC protocol", proto_vines_llc, FT_UINT8, BASE_HEX);
498 void
499 proto_reg_handoff_vines_llc(void)
501 dissector_add_uint("llc.dsap", SAP_VINES2, vines_llc_handle);
504 static dissector_table_t vines_ip_dissector_table;
506 static const value_string class_vals[] = {
507 { 0x00, "Regardless of cost" },
508 { 0x10, "Without cost" },
509 { 0x20, "With low cost (>= 4800 bps)" },
510 { 0x30, "Via LAN" },
511 { 0, NULL }
514 static const value_string proto_vals[] = {
515 { VIP_PROTO_IPC, "IPC" },
516 { VIP_PROTO_SPP, "SPP" },
517 { VIP_PROTO_ARP, "ARP" },
518 { VIP_PROTO_RTP, "RTP" },
519 { VIP_PROTO_ICP, "ICP" },
520 { 0, NULL }
523 static const uint8_t bcast_addr[VINES_ADDR_LEN] = {
524 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
527 static const true_false_string tfs_vine_tctl_router_all = { "Router nodes", "All nodes" };
528 static const true_false_string tfs_vine_tctl_forward_router = { "Can handle redirect packets", "Cannot handle redirect packets" };
529 static const true_false_string tfs_vine_tctl_return_not_return = { "Return", "Do not return" };
531 static int
532 dissect_vines_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
534 int offset = 0;
535 uint16_t vip_pktlen;
536 uint8_t vip_tctl; /* Transport Control */
537 uint8_t vip_proto;
538 proto_tree *vip_tree, *tctl_tree;
539 proto_item *ti;
540 bool is_broadcast = false;
541 tvbuff_t *next_tvb;
543 col_set_str(pinfo->cinfo, COL_PROTOCOL, "Vines IP");
544 col_clear(pinfo->cinfo, COL_INFO);
546 /* To do: check for runts, errs, etc. */
548 /* capture the necessary parts of the header */
549 vip_pktlen = tvb_get_ntohs(tvb, offset+2);
550 vip_tctl = tvb_get_uint8(tvb, offset+3);
551 vip_proto = tvb_get_uint8(tvb, offset+4);
553 col_add_fstr(pinfo->cinfo, COL_INFO, "%s (0x%02x)",
554 val_to_str_const(vip_tctl, proto_vals, "Unknown VIP protocol"),
555 vip_tctl);
557 set_address_tvb(&pinfo->net_src, AT_VINES, VINES_ADDR_LEN, tvb, offset+12);
558 copy_address_shallow(&pinfo->src, &pinfo->net_src);
559 set_address_tvb(&pinfo->net_dst, AT_VINES, VINES_ADDR_LEN, tvb, offset+6);
560 copy_address_shallow(&pinfo->dst, &pinfo->net_dst);
562 /* helpers to transport control */
563 if (tvb_memeql(tvb, offset+6, bcast_addr, VINES_ADDR_LEN) == 0)
564 is_broadcast = true;
567 * Adjust the length of this tvbuff to include only the Vines IP
568 * datagram.
570 set_actual_length(tvb, vip_pktlen < 18 ? 18 : vip_pktlen);
572 if (tree) {
573 ti = proto_tree_add_item(tree, proto_vines_ip, tvb, offset, vip_pktlen, ENC_NA);
574 vip_tree = proto_item_add_subtree(ti, ett_vines_ip);
575 proto_tree_add_checksum(vip_tree, tvb, offset, hf_vines_ip_checksum, -1, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
576 offset += 2;
578 proto_tree_add_item(vip_tree, hf_vines_ip_length, tvb, offset, 2, ENC_BIG_ENDIAN);
579 offset += 2;
581 ti = proto_tree_add_item(vip_tree, hf_vines_tctl, tvb, offset, 1, ENC_BIG_ENDIAN);
583 tctl_tree = proto_item_add_subtree(ti, ett_vines_ip_tctl);
585 * XXX - bit 0x80 is "Normal" if 0; what is it if 1?
587 if (is_broadcast) {
588 proto_tree_add_item(tctl_tree, hf_vines_tctl_node, tvb, offset, 1, ENC_NA);
589 proto_tree_add_item(tctl_tree, hf_vines_tctl_class, tvb, offset, 1, ENC_NA);
590 } else {
591 proto_tree_add_item(tctl_tree, hf_vines_tctl_forward_router, tvb, offset, 1, ENC_NA);
592 proto_tree_add_item(tctl_tree, hf_vines_tctl_metric, tvb, offset, 1, ENC_NA);
593 proto_tree_add_item(tctl_tree, hf_vines_tctl_notif_packet, tvb, offset, 1, ENC_NA);
596 proto_tree_add_item(tctl_tree, hf_vines_tctl_hop_count, tvb, offset, 1, ENC_NA);
597 offset += 1;
599 proto_tree_add_item(vip_tree, hf_vines_ip_protocol, tvb, offset, 1, ENC_NA);
600 offset += 1;
602 proto_tree_add_item(vip_tree, hf_vines_ip_destination, tvb, offset, VINES_ADDR_LEN, ENC_NA);
603 offset += 6;
605 proto_tree_add_item(vip_tree, hf_vines_ip_source, tvb, offset, VINES_ADDR_LEN, ENC_NA);
606 offset += 6;
607 } else {
608 offset += 18;
610 next_tvb = tvb_new_subset_remaining(tvb, offset);
611 if (!dissector_try_uint(vines_ip_dissector_table, vip_proto,
612 next_tvb, pinfo, tree))
613 call_data_dissector(next_tvb, pinfo, tree);
615 return tvb_captured_length(tvb);
618 void
619 proto_register_vines_ip(void)
621 static int *ett[] = {
622 &ett_vines_ip,
623 &ett_vines_ip_tctl,
626 static hf_register_info hf[] = {
627 { &hf_vines_ip_protocol,
628 { "Protocol", "vines_ip.protocol",
629 FT_UINT8, BASE_HEX, VALS(proto_vals), 0x0,
630 "Vines protocol", HFILL }},
632 { &hf_vines_ip_checksum,
633 { "Packet checksum", "vines_ip.checksum",
634 FT_UINT16, BASE_HEX, NULL, 0x0,
635 NULL, HFILL }},
637 { &hf_vines_ip_length,
638 { "Packet length", "vines_ip.length",
639 FT_UINT16, BASE_DEC, NULL, 0x0,
640 NULL, HFILL }},
642 { &hf_vines_tctl,
643 { "Transport control", "vines_ip.tctl",
644 FT_UINT8, BASE_HEX, NULL, 0x0,
645 NULL, HFILL }},
647 { &hf_vines_tctl_node,
648 { "Nodes", "vines_ip.tctl.node",
649 FT_BOOLEAN, 8, TFS(&tfs_vine_tctl_router_all), 0x40,
650 NULL, HFILL }},
652 { &hf_vines_tctl_class,
653 { "Reachable", "vines_ip.tctl.class",
654 FT_UINT8, BASE_DEC, VALS(class_vals), 0x30,
655 NULL, HFILL }},
657 { &hf_vines_tctl_forward_router,
658 { "Forwarding Router", "vines_ip.tctl.forward_router",
659 FT_BOOLEAN, 8, TFS(&tfs_vine_tctl_forward_router), 0x40,
660 NULL, HFILL }},
662 { &hf_vines_tctl_metric,
663 { "Metric notification packet", "vines_ip.tctl.metric",
664 FT_BOOLEAN, 8, TFS(&tfs_vine_tctl_return_not_return), 0x20,
665 NULL, HFILL }},
667 { &hf_vines_tctl_notif_packet,
668 { "Exception notification packet", "vines_ip.tctl.notif_packet",
669 FT_BOOLEAN, 8, TFS(&tfs_vine_tctl_return_not_return), 0x10,
670 NULL, HFILL }},
672 { &hf_vines_tctl_hop_count,
673 { "Hop count remaining", "vines_ip.tctl.hop_count",
674 FT_UINT8, BASE_DEC, NULL, 0x0F,
675 NULL, HFILL }},
677 { &hf_vines_ip_destination,
678 { "Destination", "vines_ip.destination",
679 FT_VINES, BASE_NONE, NULL, 0x0,
680 NULL, HFILL }},
682 { &hf_vines_ip_source,
683 { "Source", "vines_ip.source",
684 FT_VINES, BASE_NONE, NULL, 0x0,
685 NULL, HFILL }},
688 proto_vines_ip = proto_register_protocol("Banyan Vines IP", "Vines IP",
689 "vines_ip");
690 proto_register_field_array(proto_vines_ip, hf, array_length(hf));
691 proto_register_subtree_array(ett, array_length(ett));
693 /* subdissector code */
694 vines_ip_dissector_table = register_dissector_table("vines_ip.protocol",
695 "Vines protocol", proto_vines_ip, FT_UINT8, BASE_HEX);
697 vines_ip_handle = register_dissector("vines_ip", dissect_vines_ip,
698 proto_vines_ip);
701 void
702 proto_reg_handoff_vines_ip(void)
704 dissector_add_uint("ethertype", ETHERTYPE_VINES_IP, vines_ip_handle);
705 dissector_add_uint("ppp.protocol", PPP_VINES, vines_ip_handle);
706 dissector_add_uint("arcnet.protocol_id", ARCNET_PROTO_BANYAN,
707 vines_ip_handle);
708 dissector_add_uint("vines_llc.ptype", VINES_LLC_IP, vines_ip_handle);
711 static int
712 dissect_vines_echo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
714 proto_tree *vines_echo_tree = NULL;
715 proto_item *ti;
717 col_set_str(pinfo->cinfo, COL_PROTOCOL, "Vines Echo");
718 col_clear(pinfo->cinfo, COL_INFO);
720 if (tree) {
721 ti = proto_tree_add_item(tree, proto_vines_echo, tvb, 0, -1, ENC_NA);
722 vines_echo_tree = proto_item_add_subtree(ti, ett_vines_echo);
723 proto_tree_add_item(vines_echo_tree, hf_vines_echo_data, tvb, 0, -1, ENC_NA);
725 return tvb_captured_length(tvb);
728 void
729 proto_register_vines_echo(void)
731 static hf_register_info hf[] = {
732 { &hf_vines_echo_data,
733 { "Data", "vines_echo.data",
734 FT_BYTES, BASE_NONE, NULL, 0x0,
735 NULL, HFILL }},
738 static int *ett[] = {
739 &ett_vines_echo,
742 proto_vines_echo = proto_register_protocol("Banyan Vines Echo", "Vines Echo", "vines_echo");
743 proto_register_field_array(proto_vines_echo, hf, array_length(hf));
744 proto_register_subtree_array(ett, array_length(ett));
745 vines_echo_handle = register_dissector("vines_echo", dissect_vines_echo,
746 proto_vines_echo);
749 void
750 proto_reg_handoff_vines_echo(void)
752 dissector_add_uint("vines_llc.ptype", VINES_LLC_ECHO, vines_echo_handle);
753 dissector_add_uint("ethertype", ETHERTYPE_VINES_ECHO, vines_echo_handle);
756 static const value_string pkttype_vals[] = {
757 { PKTTYPE_DGRAM, "Datagram" },
758 { PKTTYPE_DATA, "Data" },
759 { PKTTYPE_ERR, "Error" },
760 { PKTTYPE_DISC, "Disconnect" },
761 { PKTTYPE_PROBE, "Probe" },
762 { PKTTYPE_ACK, "Ack" },
763 { 0, NULL }
766 static heur_dissector_list_t vines_ipc_heur_subdissector_list;
768 static const value_string vipc_err_vals[] = {
769 { 151, "Bad socket descriptor" },
770 { 152, "Address already in use" },
771 { 153, "Invalid operation" },
772 { 154, "User address parameter fault" },
773 { 155, "Net/host unreachable" },
774 { 156, "Message overflow error" },
775 { 157, "Destination socket does not exist" },
776 { 158, "Address family does not exist" },
777 { 159, "Socket type does not exist" },
778 { 160, "Protocol does not exist" },
779 { 161, "No more sockets available" },
780 { 162, "No buffer space available" },
781 { 163, "Timeout event" },
782 { 164, "Operation not supported" },
783 { 165, "Resource not available" },
784 { 166, "Internal communication service failure" },
785 { 167, "Controller reset failure" },
786 { 0, NULL }
789 static const true_false_string tfs_vine_ipc_send_not_send = { "Send", "Do not Send" };
790 static const true_false_string tfs_vine_ipc_abort_not_abort = { "Abort", "Do not abort" };
792 static int
793 dissect_vines_ipc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
795 int offset = 0;
796 e_vipc viph;
797 proto_tree *vipc_tree = NULL, *control_tree;
798 proto_item *ti;
799 tvbuff_t *next_tvb;
800 heur_dtbl_entry_t *hdtbl_entry;
802 col_set_str(pinfo->cinfo, COL_PROTOCOL, "VIPC");
803 col_clear(pinfo->cinfo, COL_INFO);
805 /* To do: check for runts, errs, etc. */
807 /* Avoids alignment problems on many architectures. */
808 tvb_memcpy(tvb, (uint8_t *)&viph, offset, sizeof(e_vipc));
810 viph.vipc_sport = g_ntohs(viph.vipc_sport);
811 viph.vipc_dport = g_ntohs(viph.vipc_dport);
812 viph.vipc_lclid = g_ntohs(viph.vipc_lclid);
813 viph.vipc_rmtid = g_ntohs(viph.vipc_rmtid);
814 viph.vipc_seqno = g_ntohs(viph.vipc_seqno);
815 viph.vipc_ack = g_ntohs(viph.vipc_ack);
816 viph.vipc_err_len = g_ntohs(viph.vipc_err_len);
818 col_set_str(pinfo->cinfo, COL_PROTOCOL, "Vines IPC");
819 switch (viph.vipc_pkttype) {
821 case PKTTYPE_DGRAM:
822 col_add_fstr(pinfo->cinfo, COL_INFO,
823 "%s D=%04x S=%04x",
824 val_to_str(viph.vipc_pkttype, pkttype_vals,
825 "Unknown packet type (0x%02x)"),
826 viph.vipc_dport, viph.vipc_sport);
827 break;
829 case PKTTYPE_ERR:
830 col_add_fstr(pinfo->cinfo, COL_INFO,
831 "%s NS=%u NR=%u Err=%s RID=%04x LID=%04x D=%04x S=%04x",
832 val_to_str(viph.vipc_pkttype, pkttype_vals,
833 "Unknown packet type (0x%02x)"),
834 viph.vipc_seqno, viph.vipc_ack,
835 val_to_str(viph.vipc_err_len,
836 vipc_err_vals, "Unknown (%u)"),
837 viph.vipc_rmtid, viph.vipc_lclid,
838 viph.vipc_dport, viph.vipc_sport);
839 break;
841 default:
842 col_add_fstr(pinfo->cinfo, COL_INFO,
843 "%s NS=%u NR=%u Len=%u RID=%04x LID=%04x D=%04x S=%04x",
844 val_to_str(viph.vipc_pkttype, pkttype_vals,
845 "Unknown packet type (0x%02x)"),
846 viph.vipc_seqno, viph.vipc_ack,
847 viph.vipc_err_len, viph.vipc_rmtid,
848 viph.vipc_lclid, viph.vipc_dport,
849 viph.vipc_sport);
850 break;
853 ti = proto_tree_add_item(tree, proto_vines_ipc, tvb, offset, sizeof(viph), ENC_NA);
854 vipc_tree = proto_item_add_subtree(ti, ett_vines_ipc);
856 proto_tree_add_item(vipc_tree, hf_vines_ipc_src_port, tvb, offset, 2, ENC_BIG_ENDIAN);
857 offset += 2;
858 proto_tree_add_item(vipc_tree, hf_vines_ipc_dest_port, tvb, offset, 2, ENC_BIG_ENDIAN);
859 offset += 2;
860 proto_tree_add_item(vipc_tree, hf_vines_ipc_packet_type, tvb, offset, 1, ENC_BIG_ENDIAN);
861 offset += 1;
862 if (viph.vipc_pkttype != PKTTYPE_DGRAM) {
863 ti = proto_tree_add_item(vipc_tree, hf_vines_ipc_control, tvb, offset, 1, ENC_BIG_ENDIAN);
865 control_tree = proto_item_add_subtree(ti, ett_vines_ipc_control);
867 * XXX - do reassembly based on BOM/EOM bits.
869 proto_tree_add_item(control_tree, hf_vines_ipc_control_ack, tvb, offset, 1, ENC_BIG_ENDIAN);
870 proto_tree_add_item(control_tree, hf_vines_ipc_control_end_msg, tvb, offset, 1, ENC_BIG_ENDIAN);
871 proto_tree_add_item(control_tree, hf_vines_ipc_control_beg_msg, tvb, offset, 1, ENC_BIG_ENDIAN);
872 proto_tree_add_item(control_tree, hf_vines_ipc_control_abort_msg, tvb, offset, 1, ENC_BIG_ENDIAN);
874 offset += 1;
875 if (viph.vipc_pkttype != PKTTYPE_DGRAM) {
876 proto_tree_add_item(vipc_tree, hf_vines_ipc_local_connection_id, tvb, offset, 2, ENC_BIG_ENDIAN);
877 offset += 2;
878 proto_tree_add_item(vipc_tree, hf_vines_ipc_remote_connection_id, tvb, offset, 2, ENC_BIG_ENDIAN);
879 offset += 2;
880 proto_tree_add_item(vipc_tree, hf_vines_ipc_sequence_number, tvb, offset, 2, ENC_BIG_ENDIAN);
881 offset += 2;
882 proto_tree_add_item(vipc_tree, hf_vines_ipc_ack_number, tvb, offset, 2, ENC_BIG_ENDIAN);
883 offset += 2;
884 if (viph.vipc_pkttype == PKTTYPE_ERR) {
885 proto_tree_add_item(vipc_tree, hf_vines_ipc_error, tvb, offset, 2, ENC_BIG_ENDIAN);
886 } else {
887 proto_tree_add_item(vipc_tree, hf_vines_ipc_length, tvb, offset, 2, ENC_BIG_ENDIAN);
889 offset += 2;
893 * For data packets, try the heuristic dissectors for Vines SPP;
894 * if none of them accept the packet, or if it's not a data packet,
895 * dissect it as data.
897 next_tvb = tvb_new_subset_remaining(tvb, offset);
898 if (viph.vipc_pkttype != PKTTYPE_DATA ||
899 !dissector_try_heuristic(vines_ipc_heur_subdissector_list,
900 next_tvb, pinfo, tree, &hdtbl_entry, NULL))
901 call_data_dissector(next_tvb, pinfo, tree);
903 return tvb_captured_length(tvb);
906 void
907 proto_register_vines_ipc(void)
909 static hf_register_info hf[] = {
910 { &hf_vines_ipc_src_port,
911 { "Source port", "vines_ipc.src_port",
912 FT_UINT16, BASE_HEX, NULL, 0x0,
913 NULL, HFILL }},
915 { &hf_vines_ipc_dest_port,
916 { "Destination port", "vines_ipc.dest_port",
917 FT_UINT16, BASE_HEX, NULL, 0x0,
918 NULL, HFILL }},
920 { &hf_vines_ipc_packet_type,
921 { "Packet type", "vines_ipc.packet_type",
922 FT_UINT8, BASE_HEX, VALS(pkttype_vals), 0x0,
923 NULL, HFILL }},
925 { &hf_vines_ipc_control,
926 { "Control", "vines_ipc.control",
927 FT_UINT8, BASE_HEX, VALS(pkttype_vals), 0x0,
928 NULL, HFILL }},
930 { &hf_vines_ipc_control_ack,
931 { "Immediate acknowledgment", "vines_ipc.control.ack",
932 FT_BOOLEAN, 8, TFS(&tfs_vine_ipc_send_not_send), 0x80,
933 NULL, HFILL }},
935 { &hf_vines_ipc_control_end_msg,
936 { "End of message", "vines_ipc.control.end_msg",
937 FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x40,
938 NULL, HFILL }},
940 { &hf_vines_ipc_control_beg_msg,
941 { "Beginning of message", "vines_ipc.control.beg_msg",
942 FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x20,
943 NULL, HFILL }},
945 { &hf_vines_ipc_control_abort_msg,
946 { "Current message", "vines_ipc.control.abort_msg",
947 FT_BOOLEAN, 8, TFS(&tfs_vine_ipc_abort_not_abort), 0x10,
948 NULL, HFILL }},
950 { &hf_vines_ipc_local_connection_id,
951 { "Local Connection ID", "vines_ipc.local_connection_id",
952 FT_UINT16, BASE_HEX, NULL, 0x0,
953 NULL, HFILL }},
955 { &hf_vines_ipc_remote_connection_id,
956 { "Remote Connection ID", "vines_ipc.remote_connection_id",
957 FT_UINT16, BASE_HEX, NULL, 0x0,
958 NULL, HFILL }},
960 { &hf_vines_ipc_sequence_number,
961 { "Sequence number", "vines_ipc.sequence_number",
962 FT_UINT16, BASE_DEC, NULL, 0x0,
963 NULL, HFILL }},
965 { &hf_vines_ipc_ack_number,
966 { "Ack number", "vines_ipc.ack_number",
967 FT_UINT16, BASE_DEC, NULL, 0x0,
968 NULL, HFILL }},
970 { &hf_vines_ipc_error,
971 { "Error", "vines_ipc.error",
972 FT_UINT16, BASE_DEC, VALS(vipc_err_vals), 0x0,
973 NULL, HFILL }},
975 { &hf_vines_ipc_length,
976 { "Length", "vines_ipc.length",
977 FT_UINT16, BASE_DEC, NULL, 0x0,
978 NULL, HFILL }},
981 static int *ett[] = {
982 &ett_vines_ipc,
983 &ett_vines_ipc_control,
986 proto_vines_ipc = proto_register_protocol("Banyan Vines IPC",
987 "Vines IPC", "vines_ipc");
988 proto_register_field_array(proto_vines_ipc, hf, array_length(hf));
989 proto_register_subtree_array(ett, array_length(ett));
990 vines_ipc_handle = register_dissector("vines_ipc", dissect_vines_ipc,
991 proto_vines_ipc);
993 vines_ipc_heur_subdissector_list = register_heur_dissector_list_with_description("vines_ipc", "Vines IPC Data payload", proto_vines_ipc);
996 void
997 proto_reg_handoff_vines_ipc(void)
999 dissector_add_uint("vines_ip.protocol", VIP_PROTO_IPC, vines_ipc_handle);
1002 static heur_dissector_list_t vines_spp_heur_subdissector_list;
1004 static int
1005 dissect_vines_spp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
1007 int offset = 0;
1008 e_vspp viph;
1009 proto_tree *vspp_tree, *control_tree;
1010 proto_item *ti;
1011 tvbuff_t *next_tvb;
1012 heur_dtbl_entry_t *hdtbl_entry;
1014 col_set_str(pinfo->cinfo, COL_PROTOCOL, "VSPP");
1015 col_clear(pinfo->cinfo, COL_INFO);
1017 /* To do: check for runts, errs, etc. */
1019 /* Avoids alignment problems on many architectures. */
1020 tvb_memcpy(tvb, (uint8_t *)&viph, offset, sizeof(e_vspp));
1022 viph.vspp_sport = g_ntohs(viph.vspp_sport);
1023 viph.vspp_dport = g_ntohs(viph.vspp_dport);
1024 viph.vspp_lclid = g_ntohs(viph.vspp_lclid);
1025 viph.vspp_rmtid = g_ntohs(viph.vspp_rmtid);
1026 viph.vspp_seqno = g_ntohs(viph.vspp_seqno);
1027 viph.vspp_ack = g_ntohs(viph.vspp_ack);
1028 viph.vspp_win = g_ntohs(viph.vspp_win);
1030 col_set_str(pinfo->cinfo, COL_PROTOCOL, "Vines SPP");
1031 col_add_fstr(pinfo->cinfo, COL_INFO,
1032 "%s NS=%u NR=%u Window=%u RID=%04x LID=%04x D=%04x S=%04x",
1033 val_to_str(viph.vspp_pkttype, pkttype_vals,
1034 "Unknown packet type (0x%02x)"),
1035 viph.vspp_seqno, viph.vspp_ack, viph.vspp_win,
1036 viph.vspp_rmtid, viph.vspp_lclid, viph.vspp_dport,
1037 viph.vspp_sport);
1039 if (tree) {
1040 ti = proto_tree_add_item(tree, proto_vines_spp, tvb, offset, sizeof(viph), ENC_NA);
1041 vspp_tree = proto_item_add_subtree(ti, ett_vines_spp);
1042 proto_tree_add_item(vspp_tree, hf_vines_spp_src_port, tvb, offset, 2, ENC_BIG_ENDIAN);
1043 proto_tree_add_item(vspp_tree, hf_vines_spp_dest_port, tvb, offset+2, 2, ENC_BIG_ENDIAN);
1044 proto_tree_add_item(vspp_tree, hf_vines_spp_packet_type, tvb, offset+4, 1, ENC_BIG_ENDIAN);
1046 ti = proto_tree_add_item(vspp_tree, hf_vines_spp_control, tvb, offset+5, 1, ENC_BIG_ENDIAN);
1047 control_tree = proto_item_add_subtree(ti, ett_vines_spp_control);
1049 * XXX - do reassembly based on BOM/EOM bits.
1051 proto_tree_add_item(control_tree, hf_vines_spp_control_ack, tvb, offset+5, 1, ENC_BIG_ENDIAN);
1052 proto_tree_add_item(control_tree, hf_vines_spp_control_end_msg, tvb, offset+5, 1, ENC_BIG_ENDIAN);
1053 proto_tree_add_item(control_tree, hf_vines_spp_control_beg_msg, tvb, offset+5, 1, ENC_BIG_ENDIAN);
1054 proto_tree_add_item(control_tree, hf_vines_spp_control_abort_msg, tvb, offset+5, 1, ENC_BIG_ENDIAN);
1055 proto_tree_add_item(vspp_tree, hf_vines_spp_local_id, tvb, offset+6, 2, ENC_BIG_ENDIAN);
1056 proto_tree_add_item(vspp_tree, hf_vines_spp_remote_id, tvb, offset+8, 2, ENC_BIG_ENDIAN);
1057 proto_tree_add_item(vspp_tree, hf_vines_spp_seq_num, tvb, offset+10, 2, ENC_BIG_ENDIAN);
1058 proto_tree_add_item(vspp_tree, hf_vines_spp_ack_num, tvb, offset+12, 2, ENC_BIG_ENDIAN);
1059 proto_tree_add_item(vspp_tree, hf_vines_spp_window, tvb, offset+14, 2, ENC_BIG_ENDIAN);
1060 } else {
1061 offset += 16; /* sizeof SPP */
1064 * For data packets, try the heuristic dissectors for Vines SPP;
1065 * if none of them accept the packet, or if it's not a data packet,
1066 * dissect it as data.
1068 next_tvb = tvb_new_subset_remaining(tvb, offset);
1069 if (viph.vspp_pkttype != PKTTYPE_DATA ||
1070 !dissector_try_heuristic(vines_spp_heur_subdissector_list,
1071 next_tvb, pinfo, tree, &hdtbl_entry, NULL))
1072 call_data_dissector(next_tvb, pinfo, tree);
1074 return tvb_captured_length(tvb);
1077 void
1078 proto_register_vines_spp(void)
1080 static hf_register_info hf[] = {
1081 { &hf_vines_spp_src_port,
1082 { "Source port", "vines_spp.src_port",
1083 FT_UINT16, BASE_HEX, NULL, 0x0,
1084 NULL, HFILL }},
1086 { &hf_vines_spp_dest_port,
1087 { "Destination port", "vines_spp.dest_port",
1088 FT_UINT16, BASE_HEX, NULL, 0x0,
1089 NULL, HFILL }},
1091 { &hf_vines_spp_packet_type,
1092 { "Packet type", "vines_spp.packet_type",
1093 FT_UINT8, BASE_HEX, VALS(pkttype_vals), 0x0,
1094 NULL, HFILL }},
1096 { &hf_vines_spp_control,
1097 { "Control", "vines_spp.control",
1098 FT_UINT8, BASE_HEX, NULL, 0x0,
1099 NULL, HFILL }},
1101 { &hf_vines_spp_control_ack,
1102 { "Immediate acknowledgment", "vines_spp.control.ack",
1103 FT_BOOLEAN, 8, TFS(&tfs_vine_ipc_send_not_send), 0x80,
1104 NULL, HFILL }},
1106 { &hf_vines_spp_control_end_msg,
1107 { "End of message", "vines_spp.control.end_msg",
1108 FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x40,
1109 NULL, HFILL }},
1111 { &hf_vines_spp_control_beg_msg,
1112 { "Beginning of message", "vines_spp.control.beg_msg",
1113 FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x20,
1114 NULL, HFILL }},
1116 { &hf_vines_spp_control_abort_msg,
1117 { "Current message", "vines_spp.control.abort_msg",
1118 FT_BOOLEAN, 8, TFS(&tfs_vine_ipc_abort_not_abort), 0x10,
1119 NULL, HFILL }},
1121 { &hf_vines_spp_local_id,
1122 { "Local Connection ID", "vines_spp.local_id",
1123 FT_UINT16, BASE_HEX, NULL, 0x0,
1124 NULL, HFILL }},
1126 { &hf_vines_spp_remote_id,
1127 { "Remote Connection ID", "vines_spp.remote_id",
1128 FT_UINT16, BASE_HEX, NULL, 0x0,
1129 NULL, HFILL }},
1131 { &hf_vines_spp_seq_num,
1132 { "Sequence number", "vines_spp.seq_num",
1133 FT_UINT16, BASE_DEC, NULL, 0x0,
1134 NULL, HFILL }},
1136 { &hf_vines_spp_ack_num,
1137 { "Ack number", "vines_spp.ack_num",
1138 FT_UINT16, BASE_DEC, NULL, 0x0,
1139 NULL, HFILL }},
1141 { &hf_vines_spp_window,
1142 { "Window", "vines_spp.window",
1143 FT_UINT16, BASE_DEC, NULL, 0x0,
1144 NULL, HFILL }}
1147 static int *ett[] = {
1148 &ett_vines_spp,
1149 &ett_vines_spp_control,
1152 proto_vines_spp = proto_register_protocol("Banyan Vines SPP",
1153 "Vines SPP", "vines_spp");
1154 proto_register_field_array(proto_vines_spp, hf, array_length(hf));
1155 proto_register_subtree_array(ett, array_length(ett));
1156 vines_spp_handle = register_dissector("vines_spp", dissect_vines_spp,
1157 proto_vines_spp);
1159 vines_spp_heur_subdissector_list = register_heur_dissector_list_with_description("vines_spp", "Vines SPP Data payload", proto_vines_spp);
1162 void
1163 proto_reg_handoff_vines_spp(void)
1165 dissector_add_uint("vines_ip.protocol", VIP_PROTO_SPP, vines_spp_handle);
1168 #define VINES_VERS_PRE_5_5 0x00
1169 #define VINES_VERS_5_5 0x01
1171 static const value_string vines_version_vals[] = {
1172 { VINES_VERS_PRE_5_5, "Pre-5.50" },
1173 { VINES_VERS_5_5, "5.50" },
1174 { 0, NULL }
1177 #define VARP_QUERY_REQ 0x00
1178 #define VARP_SERVICE_RESP 0x01
1179 #define VARP_ASSIGNMENT_REQ 0x02
1180 #define VARP_ASSIGNMENT_RESP 0x03
1182 static const value_string vines_arp_packet_type_vals[] = {
1183 { VARP_QUERY_REQ, "Query request" },
1184 { VARP_SERVICE_RESP, "Service response" },
1185 { VARP_ASSIGNMENT_REQ, "Assignment request" },
1186 { VARP_ASSIGNMENT_RESP, "Assignment response" },
1187 { 0, NULL }
1190 static int
1191 dissect_vines_arp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
1193 proto_tree *vines_arp_tree;
1194 proto_item *ti;
1195 uint8_t version;
1196 uint16_t packet_type;
1197 uint16_t metric;
1199 col_set_str(pinfo->cinfo, COL_PROTOCOL, "Vines ARP");
1200 col_clear(pinfo->cinfo, COL_INFO);
1202 ti = proto_tree_add_item(tree, proto_vines_arp, tvb, 0, -1, ENC_NA);
1203 vines_arp_tree = proto_item_add_subtree(ti, ett_vines_arp);
1205 version = tvb_get_uint8(tvb, 0);
1206 proto_tree_add_item(vines_arp_tree, hf_vines_arp_version, tvb, 0, 1, ENC_NA);
1208 if (version == VINES_VERS_5_5) {
1210 * Sequenced ARP.
1212 col_set_str(pinfo->cinfo, COL_PROTOCOL, "Vines SARP");
1213 packet_type = tvb_get_uint8(tvb, 1);
1214 col_add_str(pinfo->cinfo, COL_INFO,
1215 val_to_str(packet_type, vines_arp_packet_type_vals,
1216 "Unknown (0x%02x)"));
1218 proto_tree_add_item(vines_arp_tree, hf_vines_arp_packet_type, tvb, 1, 1, ENC_NA);
1220 if (packet_type == VARP_ASSIGNMENT_RESP) {
1221 col_append_fstr(pinfo->cinfo, COL_INFO,
1222 ", Address = %s",
1223 tvb_address_to_str(pinfo->pool, tvb, AT_VINES, 2));
1224 proto_tree_add_item(vines_arp_tree, hf_vines_arp_address, tvb, 2, VINES_ADDR_LEN, ENC_NA);
1226 proto_tree_add_item(vines_arp_tree, hf_vines_arp_sequence_number, tvb, 2+VINES_ADDR_LEN, 4, ENC_BIG_ENDIAN);
1227 metric = tvb_get_ntohs(tvb, 2+VINES_ADDR_LEN+4);
1228 proto_tree_add_uint_format_value(vines_arp_tree, hf_vines_arp_interface_metric, tvb,
1229 2+VINES_ADDR_LEN+4, 2, metric,
1230 "%u ticks (%g seconds)",
1231 metric, metric*.2);
1232 } else {
1234 * Non-sequenced ARP.
1236 packet_type = (uint8_t) tvb_get_ntohs(tvb, 0);
1237 col_add_str(pinfo->cinfo, COL_INFO,
1238 val_to_str(packet_type, vines_arp_packet_type_vals,
1239 "Unknown (0x%02x)"));
1240 proto_tree_add_item(vines_arp_tree, hf_vines_arp_packet_type, tvb, 0, 2, ENC_BIG_ENDIAN);
1242 if (packet_type == VARP_ASSIGNMENT_RESP) {
1243 col_append_fstr(pinfo->cinfo, COL_INFO,
1244 ", Address = %s",
1245 tvb_address_to_str(pinfo->pool, tvb, AT_VINES, 2));
1247 proto_tree_add_item(vines_arp_tree, hf_vines_arp_address, tvb, 2, VINES_ADDR_LEN, ENC_NA);
1250 return tvb_captured_length(tvb);
1253 void
1254 proto_register_vines_arp(void)
1256 static hf_register_info hf[] = {
1257 { &hf_vines_arp_version,
1258 { "Version", "vines_arp.version",
1259 FT_UINT8, BASE_HEX, VALS(vines_version_vals), 0x0,
1260 NULL, HFILL }},
1262 { &hf_vines_arp_packet_type,
1263 { "Packet Type", "vines_arp.packet_type",
1264 FT_UINT16, BASE_HEX, VALS(vines_arp_packet_type_vals), 0x0,
1265 NULL, HFILL }},
1267 { &hf_vines_arp_address,
1268 { "Address", "vines_arp.address",
1269 FT_VINES, BASE_NONE, NULL, 0x0,
1270 NULL, HFILL }},
1272 { &hf_vines_arp_sequence_number,
1273 { "Sequence Number", "vines_arp.sequence_number",
1274 FT_UINT32, BASE_DEC, NULL, 0x0,
1275 NULL, HFILL }},
1277 { &hf_vines_arp_interface_metric,
1278 { "Interface Metric", "vines_arp.interface_metric",
1279 FT_UINT16, BASE_DEC, NULL, 0x0,
1280 NULL, HFILL }},
1283 static int *ett[] = {
1284 &ett_vines_arp,
1287 proto_vines_arp = proto_register_protocol("Banyan Vines ARP", "Vines ARP", "vines_arp");
1288 proto_register_field_array(proto_vines_arp, hf, array_length(hf));
1289 proto_register_subtree_array(ett, array_length(ett));
1290 vines_arp_handle = register_dissector("vines_arp", dissect_vines_arp,
1291 proto_vines_arp);
1294 void
1295 proto_reg_handoff_vines_arp(void)
1297 dissector_add_uint("vines_ip.protocol", VIP_PROTO_ARP, vines_arp_handle);
1300 #define VRTP_OP_REQUEST 0x01
1301 #define VRTP_OP_UPDATE_RESPONSE 0x02
1302 #define VRTP_OP_REDIRECT 0x03
1303 #define VRTP_OP_REINITIALIZE 0x04
1304 #define VRTP_OP_REDIRECT2 0x06
1306 static const value_string vines_rtp_operation_type_vals[] = {
1307 { VRTP_OP_REQUEST, "Request" },
1308 { VRTP_OP_UPDATE_RESPONSE, "Update/response" },
1309 { VRTP_OP_REDIRECT, "Redirect" },
1310 { VRTP_OP_REINITIALIZE, "Reinitialize" },
1311 { VRTP_OP_REDIRECT2, "Redirect" },
1312 { 0, NULL }
1315 static const value_string vines_rtp_node_type_vals[] = {
1316 { 0x01, "Host" },
1317 { 0x02, "Router" },
1318 { 0, NULL }
1321 static const value_string vines_rtp_controller_type_vals[] = {
1322 { 0x00, "Default Card" },
1323 { 0x01, "Multibuffer" },
1324 { 0, NULL }
1327 static const value_string vines_rtp_info_type_vals[] = {
1328 { 0x00, "Update" },
1329 { 0x01, "Update" },
1330 { 0x02, "Response" },
1331 { 0, NULL }
1334 static const true_false_string tfs_vine_auto_config_not_auto_config = { "Auto-configured", "Not an auto-configured" };
1335 static const true_false_string tfs_vine_rtp_not_all_neighbor_all_neighbor = { "Not all neighbor routers support", "All neighbor routers support" };
1336 static const true_false_string tfs_vine_rtp_sequenced_not_sequenced = { "Sequenced", "Not Sequenced" };
1337 static const true_false_string tfs_part_not_part = { "Part of", "Not part of" };
1338 static const true_false_string tfs_fast_bus_slow_bus = { "Fast bus", "Slow bus" };
1340 static void
1341 rtp_show_machine_type(proto_tree *tree, tvbuff_t *tvb, int offset, int hf_machine)
1343 proto_item *ti;
1344 proto_tree *subtree;
1346 ti = proto_tree_add_item(tree, hf_machine, tvb, offset, 1, ENC_NA);
1347 subtree = proto_item_add_subtree(ti, ett_vines_rtp_mtype);
1348 proto_tree_add_item(subtree, hf_vines_rtp_machine_rtp,
1349 tvb, offset, 1, ENC_BIG_ENDIAN);
1350 proto_tree_add_item(subtree, hf_vines_rtp_machine_tcpip,
1351 tvb, offset, 1, ENC_BIG_ENDIAN);
1352 proto_tree_add_item(subtree, hf_vines_rtp_machine_bus,
1353 tvb, offset, 1, ENC_BIG_ENDIAN);
1356 static void
1357 rtp_show_flags(proto_tree *tree, tvbuff_t *tvb, int offset, int hf_flag)
1359 proto_item *ti;
1360 proto_tree *flags_tree;
1362 ti = proto_tree_add_item(tree, hf_flag, tvb, offset, 1, ENC_NA);
1363 flags_tree = proto_item_add_subtree(ti, ett_vines_rtp_flags);
1364 proto_tree_add_item(flags_tree, hf_vines_rtp_flag_sequence_rtp,
1365 tvb, offset, 1, ENC_BIG_ENDIAN);
1366 proto_tree_add_item(flags_tree, hf_vines_rtp_flag_network_p2p,
1367 tvb, offset, 1, ENC_BIG_ENDIAN);
1368 proto_tree_add_item(flags_tree, hf_vines_rtp_flag_data_link_p2p,
1369 tvb, offset, 1, ENC_BIG_ENDIAN);
1370 proto_tree_add_item(flags_tree, hf_vines_rtp_flag_broadcast_medium,
1371 tvb, offset, 1, ENC_BIG_ENDIAN);
1374 static int
1375 srtp_show_machine_info(proto_tree *tree, tvbuff_t *tvb, int offset, int hf_vines,
1376 int hf_metric, int hf_nodetype, int hf_controller_type, int hf_machine)
1378 uint16_t metric;
1380 proto_tree_add_item(tree, hf_vines, tvb, offset, VINES_ADDR_LEN, ENC_NA);
1381 offset += VINES_ADDR_LEN;
1382 metric = tvb_get_ntohs(tvb, offset);
1383 proto_tree_add_uint_format_value(tree, hf_metric, tvb,
1384 offset, 2, metric,
1385 "%u ticks (%g seconds)",
1386 metric, metric*.2);
1387 offset += 2;
1388 proto_tree_add_item(tree, hf_nodetype, tvb, offset, 1, ENC_NA);
1389 offset += 1;
1390 rtp_show_machine_type(tree, tvb, offset, hf_machine);
1391 offset += 1;
1392 proto_tree_add_item(tree, hf_controller_type, tvb, offset, 1, ENC_NA);
1393 offset += 1;
1394 return offset;
1397 static int
1398 rtp_show_gateway_info(proto_tree *tree, tvbuff_t *tvb, int offset,
1399 uint8_t link_addr_length, uint8_t source_route_length)
1401 if (link_addr_length != 0) {
1402 proto_tree_add_item(
1403 tree,
1404 link_addr_length == 6 ? hf_vines_rtp_preferred_gateway_data_link_address_ether : hf_vines_rtp_preferred_gateway_data_link_address_bytes,
1405 tvb, offset, link_addr_length, ENC_NA);
1406 offset += link_addr_length;
1408 if (source_route_length != 0) {
1409 proto_tree_add_item(tree, hf_vines_rtp_preferred_gateway_source_route, tvb, offset, source_route_length, ENC_NA);
1410 offset += source_route_length;
1412 return offset;
1415 static int
1416 dissect_vines_rtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
1418 int offset = 0;
1419 proto_tree *vines_rtp_tree = NULL;
1420 proto_item *ti;
1421 proto_tree *subtree;
1422 uint8_t operation_type;
1423 uint8_t link_addr_length;
1424 uint8_t source_route_length;
1425 uint16_t metric;
1427 col_set_str(pinfo->cinfo, COL_PROTOCOL, "Vines RTP");
1428 col_clear(pinfo->cinfo, COL_INFO);
1430 ti = proto_tree_add_item(tree, proto_vines_rtp, tvb, 0, -1, ENC_NA);
1431 vines_rtp_tree = proto_item_add_subtree(ti, ett_vines_rtp);
1433 if (tvb_get_uint8(tvb, 0) != 0) {
1435 * Non-sequenced RTP.
1437 operation_type = tvb_get_uint8(tvb, offset);
1438 col_add_str(pinfo->cinfo, COL_INFO,
1439 val_to_str(operation_type, vines_rtp_operation_type_vals,
1440 "Unknown (0x%02x)"));
1442 if (tree) {
1443 proto_tree_add_item(vines_rtp_tree, hf_vines_rtp_operation_type, tvb, offset, 1, ENC_NA);
1444 offset += 1;
1445 proto_tree_add_item(vines_rtp_tree, hf_vines_rtp_node_type, tvb, offset, 1, ENC_NA);
1446 offset += 1;
1447 proto_tree_add_item(vines_rtp_tree, hf_vines_rtp_controller_type, tvb, offset, 1, ENC_NA);
1448 offset += 1;
1449 rtp_show_machine_type(vines_rtp_tree, tvb, offset, hf_vines_rtp_machine_type);
1450 offset += 1;
1451 switch (operation_type) {
1453 case VRTP_OP_REDIRECT:
1454 case VRTP_OP_REDIRECT2:
1455 proto_tree_add_item(vines_rtp_tree, hf_vines_rtp_version, tvb, offset, 2, ENC_BIG_ENDIAN);
1456 offset += 2;
1457 link_addr_length = tvb_get_uint8(tvb, offset);
1458 proto_tree_add_item(vines_rtp_tree, hf_vines_rtp_link_address_length, tvb, offset, 1, ENC_NA);
1459 offset += 1;
1460 source_route_length = tvb_get_uint8(tvb, offset);
1461 proto_tree_add_item(vines_rtp_tree, hf_vines_rtp_source_route_length, tvb, offset, 1, ENC_NA);
1462 offset += 1;
1463 offset = srtp_show_machine_info(vines_rtp_tree, tvb, offset, hf_vines_rtp_destination,
1464 hf_vines_rtp_metric_to_destination, hf_vines_rtp_destination_node_type,
1465 hf_vines_rtp_destination_controller_type, hf_vines_rtp_destination_machine);
1466 offset += 1;
1467 offset = srtp_show_machine_info(vines_rtp_tree, tvb, offset, hf_vines_rtp_preferred_gateway,
1468 hf_vines_rtp_metric_to_preferred_gateway, hf_vines_rtp_preferred_gateway_node_type,
1469 hf_vines_rtp_pref_gateway_controller_type, hf_vines_rtp_pref_gateway_machine);
1470 offset += 1;
1471 rtp_show_gateway_info(vines_rtp_tree, tvb,offset, link_addr_length, source_route_length);
1472 break;
1474 default:
1475 while (tvb_reported_length_remaining(tvb, offset) > 0) {
1476 proto_tree_add_item(vines_rtp_tree, hf_vines_rtp_network_number, tvb, offset, 4, ENC_BIG_ENDIAN);
1477 offset += 4;
1478 metric = tvb_get_ntohs(tvb, offset);
1479 proto_tree_add_uint_format_value(vines_rtp_tree, hf_vines_rtp_neighbor_metric, tvb,
1480 offset, 2, metric,
1481 "%u ticks (%g seconds)",
1482 metric,
1483 metric*.2);
1484 offset += 2;
1486 break;
1489 } else {
1490 col_set_str(pinfo->cinfo, COL_PROTOCOL, "Vines SRTP");
1491 proto_tree_add_item(vines_rtp_tree, hf_vines_rtp_version, tvb, offset, 2, ENC_BIG_ENDIAN);
1492 offset += 2;
1493 operation_type = tvb_get_uint8(tvb, offset);
1494 col_add_str(pinfo->cinfo, COL_INFO,
1495 val_to_str(operation_type, vines_rtp_operation_type_vals,
1496 "Unknown (0x%02x)"));
1498 if (tree) {
1499 proto_tree_add_item(vines_rtp_tree, hf_vines_rtp_operation_type, tvb, offset, 1, ENC_NA);
1500 offset += 1;
1501 proto_tree_add_item(vines_rtp_tree, hf_vines_rtp_node_type, tvb, offset, 1, ENC_NA);
1502 offset += 1;
1503 ti = proto_tree_add_item(vines_rtp_tree, hf_vines_rtp_comp_flag,
1504 tvb, offset, 1, ENC_BIG_ENDIAN);
1505 subtree = proto_item_add_subtree(ti, ett_vines_rtp_compatibility_flags);
1507 proto_tree_add_item(subtree, hf_vines_rtp_comp_flag_neighbor_router, tvb, offset, 1, ENC_BIG_ENDIAN);
1508 proto_tree_add_item(subtree, hf_vines_rtp_comp_flag_sequence_rtp, tvb, offset, 1, ENC_BIG_ENDIAN);
1509 proto_tree_add_item(subtree, hf_vines_rtp_comp_flag_sequence_rtp_version, tvb, offset, 1, ENC_BIG_ENDIAN);
1510 offset += 1;
1511 offset += 1; /* reserved */
1512 switch (operation_type) {
1514 case VRTP_OP_REQUEST:
1515 proto_tree_add_item(vines_rtp_tree, hf_vines_rtp_requested_info, tvb, offset, 1, ENC_NA);
1516 break;
1518 case VRTP_OP_UPDATE_RESPONSE:
1519 proto_tree_add_item(vines_rtp_tree, hf_vines_rtp_information_type, tvb, offset, 1, ENC_NA);
1520 offset += 1;
1521 ti = proto_tree_add_item(vines_rtp_tree, hf_vines_rtp_control, tvb, offset, 1, ENC_BIG_ENDIAN);
1522 subtree = proto_item_add_subtree(ti, ett_vines_rtp_control_flags);
1523 proto_tree_add_item(subtree, hf_vines_rtp_control_sync_broadcast, tvb, offset, 1, ENC_BIG_ENDIAN);
1524 proto_tree_add_item(subtree, hf_vines_rtp_control_topology_update, tvb, offset, 1, ENC_BIG_ENDIAN);
1525 proto_tree_add_item(subtree, hf_vines_rtp_control_specific_request, tvb, offset, 1, ENC_BIG_ENDIAN);
1526 /* XXX - need reassembly? */
1527 proto_tree_add_item(subtree, hf_vines_rtp_control_end_msg, tvb, offset, 1, ENC_BIG_ENDIAN);
1528 proto_tree_add_item(subtree, hf_vines_rtp_control_beg_msg, tvb, offset, 1, ENC_BIG_ENDIAN);
1529 offset += 1;
1530 proto_tree_add_item(vines_rtp_tree, hf_vines_rtp_packet_id, tvb, offset, 2, ENC_BIG_ENDIAN);
1531 offset += 2;
1532 proto_tree_add_item(vines_rtp_tree, hf_vines_rtp_data_offset, tvb, offset, 2, ENC_BIG_ENDIAN);
1533 offset += 2;
1534 proto_tree_add_item(vines_rtp_tree, hf_vines_rtp_router_sequence_number, tvb, offset, 4, ENC_BIG_ENDIAN);
1535 offset += 4;
1536 metric = tvb_get_ntohs(tvb, offset);
1537 proto_tree_add_uint_format_value(vines_rtp_tree, hf_vines_rtp_metric, tvb,
1538 offset, 2, metric,
1539 "%u ticks (%g seconds)",
1540 metric, metric*.2);
1541 offset += 2;
1542 while (tvb_reported_length_remaining(tvb, offset) > 0) {
1543 proto_tree_add_item(vines_rtp_tree, hf_vines_rtp_network_number, tvb, offset, 4, ENC_BIG_ENDIAN);
1544 offset += 4;
1545 metric = tvb_get_ntohs(tvb, offset);
1546 if (metric == 0xffff) {
1547 proto_tree_add_uint_format_value(vines_rtp_tree, hf_vines_rtp_neighbor_metric, tvb,
1548 offset, 2, 0xffff, "Unreachable");
1549 } else {
1550 proto_tree_add_uint_format_value(vines_rtp_tree, hf_vines_rtp_neighbor_metric, tvb,
1551 offset, 2, metric,
1552 "%u ticks (%g seconds)",
1553 metric, metric*.2);
1555 offset += 2;
1556 proto_tree_add_item(vines_rtp_tree, hf_vines_rtp_sequence_number, tvb, offset, 4, ENC_BIG_ENDIAN);
1557 offset += 4;
1558 rtp_show_flags(vines_rtp_tree, tvb, offset, hf_vines_rtp_network_flags);
1559 offset += 1;
1560 offset += 1; /* reserved */
1562 break;
1564 case VRTP_OP_REDIRECT:
1565 link_addr_length = tvb_get_uint8(tvb, offset);
1566 proto_tree_add_item(vines_rtp_tree, hf_vines_rtp_link_address_length, tvb, offset, 1, ENC_NA);
1567 offset += 1;
1568 source_route_length = tvb_get_uint8(tvb, offset);
1569 proto_tree_add_item(vines_rtp_tree, hf_vines_rtp_source_route_length, tvb, offset, 1, ENC_NA);
1570 offset += 1;
1571 proto_tree_add_item(vines_rtp_tree, hf_vines_rtp_destination, tvb, offset, VINES_ADDR_LEN, ENC_NA);
1572 offset += VINES_ADDR_LEN;
1573 metric = tvb_get_ntohs(tvb, offset);
1574 proto_tree_add_uint_format_value(vines_rtp_tree, hf_vines_rtp_metric_to_destination, tvb,
1575 offset, 2, metric,
1576 "%u ticks (%g seconds)",
1577 metric, metric*.2);
1578 offset += 2;
1579 proto_tree_add_item(vines_rtp_tree, hf_vines_rtp_destination_node_type, tvb, offset, 1, ENC_NA);
1580 offset += 1;
1581 rtp_show_flags(vines_rtp_tree, tvb, offset, hf_vines_rtp_destination_flags);
1582 offset += 1;
1583 proto_tree_add_item(vines_rtp_tree, hf_vines_rtp_destination_sequence_number, tvb, ENC_BIG_ENDIAN, 4, ENC_BIG_ENDIAN);
1584 offset += 4;
1585 proto_tree_add_item(vines_rtp_tree, hf_vines_rtp_preferred_gateway, tvb, offset, VINES_ADDR_LEN, ENC_NA);
1586 offset += VINES_ADDR_LEN;
1587 metric = tvb_get_ntohs(tvb, offset);
1588 proto_tree_add_uint_format_value(vines_rtp_tree, hf_vines_rtp_metric_to_preferred_gateway, tvb,
1589 offset, 2, metric,
1590 "%u ticks (%g seconds)",
1591 metric, metric*.2);
1592 offset += 2;
1593 proto_tree_add_item(vines_rtp_tree, hf_vines_rtp_preferred_gateway_node_type, tvb, offset, 1, ENC_NA);
1594 offset += 1;
1595 rtp_show_flags(vines_rtp_tree, tvb, offset, hf_vines_rtp_preferred_gateway_flags);
1596 offset += 1;
1597 proto_tree_add_item(vines_rtp_tree, hf_vines_rtp_preferred_gateway_sequence_number, tvb, offset, 4, ENC_BIG_ENDIAN);
1598 offset += 4;
1599 rtp_show_gateway_info(vines_rtp_tree, tvb,offset, link_addr_length, source_route_length);
1600 break;
1602 case VRTP_OP_REINITIALIZE:
1603 break;
1608 return tvb_captured_length(tvb);
1611 void
1612 proto_register_vines_rtp(void)
1614 static hf_register_info hf[] = {
1615 { &hf_vines_rtp_comp_flag,
1616 { "Compatibility Flags", "vines_rtp.comp_flag",
1617 FT_UINT8, BASE_HEX, NULL, 0x0,
1618 NULL, HFILL }},
1620 { &hf_vines_rtp_comp_flag_neighbor_router,
1621 { "non-Vines-reachable neighbor router", "vines_rtp.comp_flag.neighbor_router",
1622 FT_BOOLEAN, 8, TFS(&tfs_vine_auto_config_not_auto_config), 0x04,
1623 NULL, HFILL }},
1625 { &hf_vines_rtp_comp_flag_sequence_rtp,
1626 { "Sequenced RTP", "vines_rtp.comp_flag.sequence_rtp",
1627 FT_BOOLEAN, 8, TFS(&tfs_vine_rtp_not_all_neighbor_all_neighbor), 0x02,
1628 NULL, HFILL }},
1630 { &hf_vines_rtp_comp_flag_sequence_rtp_version,
1631 { "RTP version mismatch", "vines_rtp.comp_flag.rtp_version",
1632 FT_BOOLEAN, 8, TFS(&tfs_vine_rtp_sequenced_not_sequenced), 0x01,
1633 NULL, HFILL }},
1635 { &hf_vines_rtp_control,
1636 { "Control Flags", "vines_rtp.control",
1637 FT_UINT8, BASE_HEX, NULL, 0x0,
1638 NULL, HFILL }},
1640 { &hf_vines_rtp_control_sync_broadcast,
1641 { "Routing table synchronization broadcast", "vines_rtp.control.sync_broadcast",
1642 FT_BOOLEAN, 8, TFS(&tfs_part_not_part), 0x10,
1643 NULL, HFILL }},
1645 { &hf_vines_rtp_control_topology_update,
1646 { "Full topology update", "vines_rtp.control.topology_update",
1647 FT_BOOLEAN, 8, TFS(&tfs_part_not_part), 0x08,
1648 NULL, HFILL }},
1650 { &hf_vines_rtp_control_specific_request,
1651 { "Contains info specifically requested", "vines_rtp.control.specific_request",
1652 FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x04,
1653 NULL, HFILL }},
1655 { &hf_vines_rtp_control_end_msg,
1656 { "End of message", "vines_rtp.control.end_msg",
1657 FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x02,
1658 NULL, HFILL }},
1660 { &hf_vines_rtp_control_beg_msg,
1661 { "Beginning of message", "vines_rtp.control.beg_msg",
1662 FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x01,
1663 NULL, HFILL }},
1665 { &hf_vines_rtp_machine_rtp,
1666 { "Sequenced RTP", "vines_rtp.machine.rtp",
1667 FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x04,
1668 NULL, HFILL }},
1670 { &hf_vines_rtp_machine_tcpip,
1671 { "TCP/IP", "vines_rtp.machine.tcpip",
1672 FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x02,
1673 NULL, HFILL }},
1675 { &hf_vines_rtp_machine_bus,
1676 { "Bus", "vines_rtp.machine.bus",
1677 FT_BOOLEAN, 8, TFS(&tfs_fast_bus_slow_bus), 0x01,
1678 NULL, HFILL }},
1680 { &hf_vines_rtp_flag_sequence_rtp,
1681 { "Network supports Sequenced RTP", "vines_rtp.flag.sequence_rtp",
1682 FT_BOOLEAN, 8, TFS(&tfs_no_yes), 0x08,
1683 NULL, HFILL }},
1685 { &hf_vines_rtp_flag_network_p2p,
1686 { "Network accessed point-to-point on non-Vines network", "vines_rtp.flag.network_p2p",
1687 FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x04,
1688 NULL, HFILL }},
1690 { &hf_vines_rtp_flag_data_link_p2p,
1691 { "Data link to network uses point-to-point connection", "vines_rtp.flag.data_link_p2p",
1692 FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x02,
1693 NULL, HFILL }},
1695 { &hf_vines_rtp_flag_broadcast_medium,
1696 { "Network accessed across broadcast medium", "vines_rtp.flag.broadcast_medium",
1697 FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x01,
1698 NULL, HFILL }},
1700 { &hf_vines_rtp_operation_type,
1701 { "Operation Type", "vines_rtp.operation_type",
1702 FT_UINT8, BASE_HEX, VALS(vines_rtp_operation_type_vals), 0x0,
1703 NULL, HFILL }},
1705 { &hf_vines_rtp_node_type,
1706 { "Node Type", "vines_rtp.node_type",
1707 FT_UINT8, BASE_HEX, VALS(vines_rtp_node_type_vals), 0x0,
1708 NULL, HFILL }},
1710 { &hf_vines_rtp_controller_type,
1711 { "Controller Type", "vines_rtp.controller_type",
1712 FT_UINT8, BASE_HEX, VALS(vines_rtp_controller_type_vals), 0x0,
1713 NULL, HFILL }},
1715 { &hf_vines_rtp_version,
1716 { "Version", "vines_rtp.version",
1717 FT_UINT16, BASE_HEX, NULL, 0x0,
1718 NULL, HFILL }},
1720 { &hf_vines_rtp_link_address_length,
1721 { "Link Address Length", "vines_rtp.link_address_length",
1722 FT_UINT8, BASE_DEC, NULL, 0x0,
1723 NULL, HFILL }},
1725 { &hf_vines_rtp_source_route_length,
1726 { "Source Route Length", "vines_rtp.source_route_length",
1727 FT_UINT8, BASE_DEC, NULL, 0x0,
1728 NULL, HFILL }},
1730 { &hf_vines_rtp_network_number,
1731 { "Network Number", "vines_rtp.network_number",
1732 FT_UINT32, BASE_HEX, NULL, 0x0,
1733 NULL, HFILL }},
1735 { &hf_vines_rtp_neighbor_metric,
1736 { "Neighbor Metric", "vines_rtp.neighbor_metric",
1737 FT_UINT16, BASE_DEC, NULL, 0x0,
1738 NULL, HFILL }},
1740 { &hf_vines_rtp_requested_info,
1741 { "Requested Info", "vines_rtp.requested_info",
1742 FT_UINT8, BASE_HEX, NULL, 0x0,
1743 NULL, HFILL }},
1745 { &hf_vines_rtp_information_type,
1746 { "Information Type", "vines_rtp.information_type",
1747 FT_UINT8, BASE_HEX, VALS(vines_rtp_info_type_vals), 0x0,
1748 NULL, HFILL }},
1750 { &hf_vines_rtp_packet_id,
1751 { "Packet ID", "vines_rtp.packet_id",
1752 FT_UINT16, BASE_DEC, NULL, 0x0,
1753 NULL, HFILL }},
1755 { &hf_vines_rtp_data_offset,
1756 { "Data Offset", "vines_rtp.data_offset",
1757 FT_UINT16, BASE_DEC, NULL, 0x0,
1758 NULL, HFILL }},
1760 { &hf_vines_rtp_router_sequence_number,
1761 { "Router Sequence Number", "vines_rtp.router_sequence_number",
1762 FT_UINT32, BASE_DEC, NULL, 0x0,
1763 NULL, HFILL }},
1765 { &hf_vines_rtp_metric,
1766 { "Metric", "vines_rtp.metric",
1767 FT_UINT16, BASE_DEC, NULL, 0x0,
1768 NULL, HFILL }},
1770 { &hf_vines_rtp_sequence_number,
1771 { "Sequence Number", "vines_rtp.sequence_number",
1772 FT_UINT32, BASE_DEC, NULL, 0x0,
1773 NULL, HFILL }},
1775 { &hf_vines_rtp_destination,
1776 { "Destination", "vines_rtp.destination",
1777 FT_VINES, BASE_NONE, NULL, 0x0,
1778 NULL, HFILL }},
1780 { &hf_vines_rtp_metric_to_destination,
1781 { "Metric to Destination", "vines_rtp.metric_to_destination",
1782 FT_UINT16, BASE_DEC, NULL, 0x0,
1783 NULL, HFILL }},
1785 { &hf_vines_rtp_destination_node_type,
1786 { "Destination Node Type", "vines_rtp.destination_node_type",
1787 FT_UINT8, BASE_HEX, VALS(vines_rtp_node_type_vals), 0x0,
1788 NULL, HFILL }},
1790 { &hf_vines_rtp_destination_sequence_number,
1791 { "Destination Sequence Number", "vines_rtp.destination_sequence_number",
1792 FT_UINT32, BASE_DEC, NULL, 0x0,
1793 NULL, HFILL }},
1795 { &hf_vines_rtp_preferred_gateway,
1796 { "Preferred Gateway", "vines_rtp.preferred_gateway",
1797 FT_VINES, BASE_NONE, NULL, 0x0,
1798 NULL, HFILL }},
1800 { &hf_vines_rtp_metric_to_preferred_gateway,
1801 { "Metric to Preferred Gateway", "vines_rtp.metric_to_preferred_gateway",
1802 FT_UINT16, BASE_DEC, NULL, 0x0,
1803 NULL, HFILL }},
1805 { &hf_vines_rtp_preferred_gateway_node_type,
1806 { "Preferred Gateway Node Type", "vines_rtp.preferred_gateway_node_type",
1807 FT_UINT8, BASE_HEX, VALS(vines_rtp_node_type_vals), 0x0,
1808 NULL, HFILL }},
1810 { &hf_vines_rtp_preferred_gateway_sequence_number,
1811 { "Preferred Gateway Sequence Number", "vines_rtp.preferred_gateway_sequence_number",
1812 FT_UINT32, BASE_DEC, NULL, 0x0,
1813 NULL, HFILL }},
1815 { &hf_vines_rtp_machine_type,
1816 { "Machine Type", "vines_rtp.machine_type",
1817 FT_UINT8, BASE_HEX, NULL, 0x0,
1818 NULL, HFILL }},
1820 { &hf_vines_rtp_destination_machine,
1821 { "Destination Machine Type", "vines_rtp.destination_machine_type",
1822 FT_UINT8, BASE_HEX, NULL, 0x0,
1823 NULL, HFILL }},
1825 { &hf_vines_rtp_pref_gateway_machine,
1826 { "Preferred Gateway Machine Type", "vines_rtp.preferred_gateway_machine_type",
1827 FT_UINT8, BASE_HEX, NULL, 0x0,
1828 NULL, HFILL }},
1830 { &hf_vines_rtp_destination_controller_type,
1831 { "Destination Controller Type", "vines_rtp.destination_controller_type",
1832 FT_UINT8, BASE_HEX, VALS(vines_rtp_controller_type_vals), 0x0,
1833 NULL, HFILL }},
1835 { &hf_vines_rtp_pref_gateway_controller_type,
1836 { "Preferred Gateway Controller Type", "vines_rtp.preferred_gateway_controller_type",
1837 FT_UINT8, BASE_HEX, VALS(vines_rtp_controller_type_vals), 0x0,
1838 NULL, HFILL }},
1840 { &hf_vines_rtp_network_flags,
1841 { "Network Flags", "vines_rtp.network_flags",
1842 FT_UINT8, BASE_HEX, NULL, 0x0,
1843 NULL, HFILL }},
1845 { &hf_vines_rtp_destination_flags,
1846 { "Destination Flags", "vines_rtp.destination_flags",
1847 FT_UINT8, BASE_HEX, NULL, 0x0,
1848 NULL, HFILL }},
1850 { &hf_vines_rtp_preferred_gateway_flags,
1851 { "Preferred Gateway Flags", "vines_rtp.preferred_gateway_flags",
1852 FT_UINT8, BASE_HEX, NULL, 0x0,
1853 NULL, HFILL }},
1855 { &hf_vines_rtp_preferred_gateway_data_link_address_ether,
1856 { "Preferred Gateway Data Link Address", "vines_rtp.preferred_gateway_data_link_address",
1857 FT_ETHER, BASE_NONE, NULL, 0x0,
1858 NULL, HFILL }},
1860 { &hf_vines_rtp_preferred_gateway_data_link_address_bytes,
1861 { "Preferred Gateway Data Link Address", "vines_rtp.preferred_gateway_data_link_address",
1862 FT_BYTES, BASE_NONE, NULL, 0x0,
1863 NULL, HFILL }},
1865 { &hf_vines_rtp_preferred_gateway_source_route,
1866 { "Preferred Gateway Source Route", "vines_rtp.preferred_gateway_source_route",
1867 FT_BYTES, BASE_NONE, NULL, 0x0,
1868 NULL, HFILL }},
1871 static int *ett[] = {
1872 &ett_vines_rtp,
1873 &ett_vines_rtp_compatibility_flags,
1874 &ett_vines_rtp_req_info,
1875 &ett_vines_rtp_control_flags,
1876 &ett_vines_rtp_mtype,
1877 &ett_vines_rtp_flags,
1880 proto_vines_rtp = proto_register_protocol("Banyan Vines RTP", "Vines RTP", "vines_rtp");
1881 proto_register_field_array(proto_vines_rtp, hf, array_length(hf));
1882 proto_register_subtree_array(ett, array_length(ett));
1883 vines_rtp_handle = register_dissector("vines_rtp", dissect_vines_rtp,
1884 proto_vines_rtp);
1887 void
1888 proto_reg_handoff_vines_rtp(void)
1890 dissector_add_uint("vines_ip.protocol", VIP_PROTO_RTP, vines_rtp_handle);
1893 #define VICP_EXCEPTION_NOTIFICATION 0x0000
1894 #define VICP_METRIC_NOTIFICATION 0x0001
1896 static const value_string vines_icp_packet_type_vals[] = {
1897 { VICP_EXCEPTION_NOTIFICATION, "Exception notification" },
1898 { VICP_METRIC_NOTIFICATION, "Metric notification" },
1899 { 0, NULL }
1902 static int
1903 dissect_vines_icp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
1905 int offset = 0;
1906 proto_tree *vines_icp_tree;
1907 proto_item *ti;
1908 uint16_t packet_type;
1909 uint16_t exception_code;
1910 uint16_t metric;
1911 bool save_in_error_pkt;
1912 tvbuff_t *next_tvb;
1914 col_set_str(pinfo->cinfo, COL_PROTOCOL, "Vines ICP");
1915 col_clear(pinfo->cinfo, COL_INFO);
1917 ti = proto_tree_add_item(tree, proto_vines_icp, tvb, 0, -1, ENC_NA);
1918 vines_icp_tree = proto_item_add_subtree(ti, ett_vines_icp);
1920 packet_type = tvb_get_ntohs(tvb, offset);
1921 col_add_str(pinfo->cinfo, COL_INFO,
1922 val_to_str(packet_type, vines_icp_packet_type_vals,
1923 "Unknown (0x%02x)"));
1925 proto_tree_add_item(vines_icp_tree, hf_vines_icp_packet_type, tvb, offset, 2, ENC_BIG_ENDIAN);
1926 offset += 2;
1928 switch (packet_type) {
1930 case VICP_EXCEPTION_NOTIFICATION:
1931 exception_code = tvb_get_ntohs(tvb, offset);
1932 col_append_fstr(pinfo->cinfo, COL_INFO, ", %s",
1933 val_to_str(exception_code, vipc_err_vals,
1934 "Unknown exception code (%u)"));
1935 proto_tree_add_item(vines_icp_tree, hf_vines_icp_exception_code, tvb, offset, 2, ENC_BIG_ENDIAN);
1936 break;
1938 case VICP_METRIC_NOTIFICATION:
1939 metric = tvb_get_ntohs(tvb, offset);
1940 col_append_fstr(pinfo->cinfo, COL_INFO, ", metric %u", metric);
1941 proto_tree_add_item(vines_icp_tree, hf_vines_icp_metric, tvb, offset, 2, ENC_BIG_ENDIAN);
1942 break;
1944 offset += 2;
1947 * Save the current value of the "we're inside an error packet"
1948 * flag, and set that flag; subdissectors may treat packets
1949 * that are the payload of error packets differently from
1950 * "real" packets.
1952 save_in_error_pkt = pinfo->flags.in_error_pkt;
1953 pinfo->flags.in_error_pkt = true;
1955 /* Decode the first 40 bytes of the original VIP datagram. */
1956 next_tvb = tvb_new_subset_remaining(tvb, offset);
1957 call_dissector(vines_ip_handle, next_tvb, pinfo, vines_icp_tree);
1959 /* Restore the "we're inside an error packet" flag. */
1960 pinfo->flags.in_error_pkt = save_in_error_pkt;
1961 return tvb_captured_length(tvb);
1964 void
1965 proto_register_vines_icp(void)
1967 static hf_register_info hf[] = {
1968 { &hf_vines_icp_packet_type,
1969 { "Packet Type", "vines_icp.packet_type",
1970 FT_UINT16, BASE_HEX, VALS(vines_icp_packet_type_vals), 0x0,
1971 NULL, HFILL }},
1973 { &hf_vines_icp_exception_code,
1974 { "Exception Code", "vines_icp.exception_code",
1975 FT_UINT16, BASE_DEC, VALS(vipc_err_vals), 0x0,
1976 NULL, HFILL }},
1978 { &hf_vines_icp_metric,
1979 { "Metric", "vines_icp.metric",
1980 FT_UINT16, BASE_DEC, NULL, 0x0,
1981 NULL, HFILL }},
1984 static int *ett[] = {
1985 &ett_vines_icp,
1988 proto_vines_icp = proto_register_protocol("Banyan Vines ICP", "Vines ICP", "vines_icp");
1989 /* Placeholder for capture statistics */
1990 proto_vines = proto_register_protocol("VINES", "VINES", "vines");
1991 proto_register_field_array(proto_vines_icp, hf, array_length(hf));
1992 proto_register_subtree_array(ett, array_length(ett));
1994 vines_icp_handle = register_dissector("vines_icp", dissect_vines_icp, proto_vines_icp);
1995 vines_ip_cap_handle = register_capture_dissector("vines.ip", capture_vines, proto_vines_ip);
1996 vines_echo_cap_handle = register_capture_dissector("vines.echo", capture_vines, proto_vines_echo);
1999 void
2000 proto_reg_handoff_vines_icp(void)
2002 dissector_add_uint("vines_ip.protocol", VIP_PROTO_ICP, vines_icp_handle);
2004 capture_dissector_add_uint("ethertype", ETHERTYPE_VINES_IP, vines_ip_cap_handle);
2005 capture_dissector_add_uint("ethertype", ETHERTYPE_VINES_ECHO, vines_echo_cap_handle);
2006 capture_dissector_add_uint("ppp_hdlc", PPP_VINES, vines_echo_cap_handle);
2007 capture_dissector_add_uint("ip.proto", PPP_VINES, vines_echo_cap_handle);
2008 capture_dissector_add_uint("llc.dsap", SAP_VINES1, vines_echo_cap_handle);
2009 capture_dissector_add_uint("llc.dsap", SAP_VINES2, vines_echo_cap_handle);
2013 * Editor modelines - https://www.wireshark.org/tools/modelines.html
2015 * Local variables:
2016 * c-basic-offset: 8
2017 * tab-width: 8
2018 * indent-tabs-mode: t
2019 * End:
2021 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
2022 * :indentSize=8:tabSize=8:noTabs=false: