2 * Routines for ATM packet disassembly
4 * $Id: packet-atm.c,v 1.49 2002/08/28 21:00:07 jmayer Exp $
6 * Ethereal - Network traffic analyzer
7 * By Gerald Combs <gerald@ethereal.com>
8 * Copyright 1998 Gerald Combs
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
31 #include <epan/packet.h>
33 #include <epan/resolv.h>
35 #include "packet-atm.h"
36 #include "packet-snmp.h"
37 #include "packet-eth.h"
38 #include "packet-tr.h"
39 #include "packet-llc.h"
41 static int proto_atm = -1;
42 static int hf_atm_vpi = -1;
43 static int hf_atm_vci = -1;
44 static int proto_atm_lane = -1;
45 static int proto_ilmi = -1;
47 static gint ett_atm = -1;
48 static gint ett_atm_lane = -1;
49 static gint ett_atm_lane_lc_lan_dest = -1;
50 static gint ett_atm_lane_lc_lan_dest_rd = -1;
51 static gint ett_atm_lane_lc_flags = -1;
52 static gint ett_atm_lane_lc_tlv = -1;
53 static gint ett_ilmi = -1;
55 static dissector_handle_t eth_handle;
56 static dissector_handle_t tr_handle;
57 static dissector_handle_t llc_handle;
58 static dissector_handle_t sscop_handle;
59 static dissector_handle_t lane_handle;
60 static dissector_handle_t ilmi_handle;
61 static dissector_handle_t data_handle;
66 * http://www.atmforum.org/atmforum/specs/approved.html
68 * for a number of ATM Forum specifications, e.g. the LAN Emulation
69 * over ATM 1.0 spec, whence I got most of this.
72 /* LE Control opcodes */
73 #define LE_CONFIGURE_REQUEST 0x0001
74 #define LE_CONFIGURE_RESPONSE 0x0101
75 #define LE_JOIN_REQUEST 0x0002
76 #define LE_JOIN_RESPONSE 0x0102
77 #define READY_QUERY 0x0003
78 #define READY_IND 0x0103
79 #define LE_REGISTER_REQUEST 0x0004
80 #define LE_REGISTER_RESPONSE 0x0104
81 #define LE_UNREGISTER_REQUEST 0x0005
82 #define LE_UNREGISTER_RESPONSE 0x0105
83 #define LE_ARP_REQUEST 0x0006
84 #define LE_ARP_RESPONSE 0x0106
85 #define LE_FLUSH_REQUEST 0x0007
86 #define LE_FLUSH_RESPONSE 0x0107
87 #define LE_NARP_REQUEST 0x0008
88 #define LE_TOPOLOGY_REQUEST 0x0009
89 #define LE_VERIFY_REQUEST 0x000A
90 #define LE_VERIFY_RESPONSE 0x010A
92 static const value_string le_control_opcode_vals[] = {
93 { LE_CONFIGURE_REQUEST, "LE_CONFIGURE_REQUEST" },
94 { LE_CONFIGURE_RESPONSE, "LE_CONFIGURE_RESPONSE" },
95 { LE_JOIN_REQUEST, "LE_JOIN_REQUEST" },
96 { LE_JOIN_RESPONSE, "LE_JOIN_RESPONSE" },
97 { READY_QUERY, "READY_QUERY" },
98 { READY_IND, "READY_IND" },
99 { LE_REGISTER_REQUEST, "LE_REGISTER_REQUEST" },
100 { LE_REGISTER_RESPONSE, "LE_REGISTER_RESPONSE" },
101 { LE_UNREGISTER_REQUEST, "LE_UNREGISTER_REQUEST" },
102 { LE_UNREGISTER_RESPONSE, "LE_UNREGISTER_RESPONSE" },
103 { LE_ARP_REQUEST, "LE_ARP_REQUEST" },
104 { LE_ARP_RESPONSE, "LE_ARP_RESPONSE" },
105 { LE_FLUSH_REQUEST, "LE_FLUSH_REQUEST" },
106 { LE_FLUSH_RESPONSE, "LE_FLUSH_RESPONSE" },
107 { LE_NARP_REQUEST, "LE_NARP_REQUEST" },
108 { LE_TOPOLOGY_REQUEST, "LE_TOPOLOGY_REQUEST" },
109 { LE_VERIFY_REQUEST, "LE_VERIFY_REQUEST" },
110 { LE_VERIFY_RESPONSE, "LE_VERIFY_RESPONSE" },
114 /* LE Control statuses */
115 static const value_string le_control_status_vals[] = {
117 { 1, "Version not supported" },
118 { 2, "Invalid request parameters" },
119 { 4, "Duplicate LAN destination registration" },
120 { 5, "Duplicate ATM address" },
121 { 6, "Insufficient resources to grant request" },
122 { 7, "Access denied" },
123 { 8, "Invalid REQUESTOR-ID" },
124 { 9, "Invalid LAN destination" },
125 { 10, "Invalid ATM address" },
126 { 20, "No configuraton" },
127 { 21, "LE_CONFIGURE error" },
128 { 22, "Insufficient information" },
129 { 24, "TLV not found" },
133 /* LE Control LAN destination tags */
134 #define TAG_NOT_PRESENT 0x0000
135 #define TAG_MAC_ADDRESS 0x0001
136 #define TAG_ROUTE_DESCRIPTOR 0x0002
138 static const value_string le_control_landest_tag_vals[] = {
139 { TAG_NOT_PRESENT, "Not present" },
140 { TAG_MAC_ADDRESS, "MAC address" },
141 { TAG_ROUTE_DESCRIPTOR, "Route descriptor" },
145 /* LE Control LAN types */
146 #define LANT_UNSPEC 0x00
147 #define LANT_802_3 0x01
148 #define LANT_802_5 0x02
150 static const value_string le_control_lan_type_vals[] = {
151 { LANT_UNSPEC, "Unspecified" },
152 { LANT_802_3, "Ethernet/802.3" },
153 { LANT_802_5, "802.5" },
157 static const value_string le_control_frame_size_vals[] = {
158 { 0x00, "Unspecified" },
159 { 0x01, "1516/1528/1580/1592" },
160 { 0x02, "4544/4556/1580/1592" },
161 { 0x03, "9234/9246" },
162 { 0x04, "18190/18202" },
167 dissect_le_client(tvbuff_t *tvb, proto_tree *tree)
170 proto_tree *lane_tree;
173 ti = proto_tree_add_protocol_format(tree, proto_atm_lane, tvb, 0, 2, "ATM LANE");
174 lane_tree = proto_item_add_subtree(ti, ett_atm_lane);
176 proto_tree_add_text(lane_tree, tvb, 0, 2, "LE Client: 0x%04X",
177 tvb_get_ntohs(tvb, 0));
182 dissect_lan_destination(tvbuff_t *tvb, int offset, const char *type, proto_tree *tree)
185 proto_tree *dest_tree;
189 guint16 route_descriptor;
191 td = proto_tree_add_text(tree, tvb, offset, 8, "%s LAN destination",
193 dest_tree = proto_item_add_subtree(td, ett_atm_lane_lc_lan_dest);
194 tag = tvb_get_ntohs(tvb, offset);
195 proto_tree_add_text(dest_tree, tvb, offset, 2, "Tag: %s",
196 val_to_str(tag, le_control_landest_tag_vals,
197 "Unknown (0x%04X)"));
202 case TAG_MAC_ADDRESS:
203 proto_tree_add_text(dest_tree, tvb, offset, 6, "MAC address: %s",
204 ether_to_str(tvb_get_ptr(tvb, offset, 6)));
207 case TAG_ROUTE_DESCRIPTOR:
209 route_descriptor = tvb_get_ntohs(tvb, offset);
210 trd = proto_tree_add_text(dest_tree, tvb, offset, 2, "Route descriptor: 0x%02X",
212 rd_tree = proto_item_add_subtree(td, ett_atm_lane_lc_lan_dest_rd);
213 proto_tree_add_text(rd_tree, tvb, offset, 2,
214 decode_numeric_bitfield(route_descriptor, 0xFFF0, 2*8,
216 proto_tree_add_text(rd_tree, tvb, offset, 2,
217 decode_numeric_bitfield(route_descriptor, 0x000F, 2*8,
218 "Bridge number = %u"));
224 * TLV values in LE Control frames.
226 #define TLV_TYPE(oui, ident) (((oui) << 8) | (ident))
228 #define LE_CONTROL_TIMEOUT TLV_TYPE(OUI_ATM_FORUM, 0x01)
229 #define LE_MAX_UNK_FRAME_COUNT TLV_TYPE(OUI_ATM_FORUM, 0x02)
230 #define LE_MAX_UNK_FRAME_TIME TLV_TYPE(OUI_ATM_FORUM, 0x03)
231 #define LE_VCC_TIMEOUT_PERIOD TLV_TYPE(OUI_ATM_FORUM, 0x04)
232 #define LE_MAX_RETRY_COUNT TLV_TYPE(OUI_ATM_FORUM, 0x05)
233 #define LE_AGING_TIME TLV_TYPE(OUI_ATM_FORUM, 0x06)
234 #define LE_FORWARD_DELAY_TIME TLV_TYPE(OUI_ATM_FORUM, 0x07)
235 #define LE_EXPECTED_ARP_RESPONSE_TIME TLV_TYPE(OUI_ATM_FORUM, 0x08)
236 #define LE_FLUSH_TIMEOUT TLV_TYPE(OUI_ATM_FORUM, 0x09)
237 #define LE_PATH_SWITCHING_DELAY TLV_TYPE(OUI_ATM_FORUM, 0x0A)
238 #define LE_LOCAL_SEGMENT_ID TLV_TYPE(OUI_ATM_FORUM, 0x0B)
239 #define LE_MCAST_SEND_VCC_TYPE TLV_TYPE(OUI_ATM_FORUM, 0x0C)
240 #define LE_MCAST_SEND_VCC_AVGRATE TLV_TYPE(OUI_ATM_FORUM, 0x0D)
241 #define LE_MCAST_SEND_VCC_PEAKRATE TLV_TYPE(OUI_ATM_FORUM, 0x0E)
242 #define LE_CONN_COMPLETION_TIMER TLV_TYPE(OUI_ATM_FORUM, 0x0F)
243 #define LE_CONFIG_FRAG_INFO TLV_TYPE(OUI_ATM_FORUM, 0x10)
244 #define LE_LAYER_3_ADDRESS TLV_TYPE(OUI_ATM_FORUM, 0x11)
245 #define LE_ELAN_ID TLV_TYPE(OUI_ATM_FORUM, 0x12)
246 #define LE_SERVICE_CATEGORY TLV_TYPE(OUI_ATM_FORUM, 0x13)
247 #define LE_LLC_MUXED_ATM_ADDRESS TLV_TYPE(OUI_ATM_FORUM, 0x2B)
248 #define LE_X5_ADJUSTMENT TLV_TYPE(OUI_ATM_FORUM, 0x2C)
249 #define LE_PREFERRED_LES TLV_TYPE(OUI_ATM_FORUM, 0x2D)
251 static const value_string le_tlv_type_vals[] = {
252 { LE_CONTROL_TIMEOUT, "Control Time-out" },
253 { LE_MAX_UNK_FRAME_COUNT, "Maximum Unknown Frame Count" },
254 { LE_MAX_UNK_FRAME_TIME, "Maximum Unknown Frame Time" },
255 { LE_VCC_TIMEOUT_PERIOD, "VCC Time-out" },
256 { LE_MAX_RETRY_COUNT, "Maximum Retry Count" },
257 { LE_AGING_TIME, "Aging Time" },
258 { LE_FORWARD_DELAY_TIME, "Forwarding Delay Time" },
259 { LE_EXPECTED_ARP_RESPONSE_TIME, "Expected LE_ARP Response Time" },
260 { LE_FLUSH_TIMEOUT, "Flush Time-out" },
261 { LE_PATH_SWITCHING_DELAY, "Path Switching Delay" },
262 { LE_LOCAL_SEGMENT_ID, "Local Segment ID" },
263 { LE_MCAST_SEND_VCC_TYPE, "Mcast Send VCC Type" },
264 { LE_MCAST_SEND_VCC_AVGRATE, "Mcast Send VCC AvgRate" },
265 { LE_MCAST_SEND_VCC_PEAKRATE, "Mcast Send VCC PeakRate" },
266 { LE_CONN_COMPLETION_TIMER, "Connection Completion Timer" },
267 { LE_CONFIG_FRAG_INFO, "Config Frag Info" },
268 { LE_LAYER_3_ADDRESS, "Layer 3 Address" },
269 { LE_ELAN_ID, "ELAN ID" },
270 { LE_SERVICE_CATEGORY, "Service Category" },
271 { LE_LLC_MUXED_ATM_ADDRESS, "LLC-muxed ATM Address" },
272 { LE_X5_ADJUSTMENT, "X5 Adjustment" },
273 { LE_PREFERRED_LES, "Preferred LES" },
278 dissect_le_control_tlvs(tvbuff_t *tvb, int offset, guint num_tlvs,
284 proto_tree *tlv_tree;
286 while (num_tlvs != 0) {
287 tlv_type = tvb_get_ntohl(tvb, offset);
288 tlv_length = tvb_get_guint8(tvb, offset+4);
289 ttlv = proto_tree_add_text(tree, tvb, offset, 5+tlv_length, "TLV type: %s",
290 val_to_str(tlv_type, le_tlv_type_vals, "Unknown (0x%08x)"));
291 tlv_tree = proto_item_add_subtree(ttlv, ett_atm_lane_lc_tlv);
292 proto_tree_add_text(tlv_tree, tvb, offset, 4, "TLV Type: %s",
293 val_to_str(tlv_type, le_tlv_type_vals, "Unknown (0x%08x)"));
294 proto_tree_add_text(tlv_tree, tvb, offset+4, 1, "TLV Length: %u", tlv_length);
295 offset += 5+tlv_length;
301 dissect_le_configure_join_frame(tvbuff_t *tvb, int offset, proto_tree *tree)
306 dissect_lan_destination(tvb, offset, "Source", tree);
309 dissect_lan_destination(tvb, offset, "Target", tree);
312 proto_tree_add_text(tree, tvb, offset, 20, "Source ATM Address: %s",
313 tvb_bytes_to_str(tvb, offset, 20));
316 proto_tree_add_text(tree, tvb, offset, 1, "LAN type: %s",
317 val_to_str(tvb_get_guint8(tvb, offset), le_control_lan_type_vals,
318 "Unknown (0x%02X)"));
321 proto_tree_add_text(tree, tvb, offset, 1, "Maximum frame size: %s",
322 val_to_str(tvb_get_guint8(tvb, offset), le_control_frame_size_vals,
323 "Unknown (0x%02X)"));
326 num_tlvs = tvb_get_guint8(tvb, offset);
327 proto_tree_add_text(tree, tvb, offset, 1, "Number of TLVs: %u", num_tlvs);
330 name_size = tvb_get_guint8(tvb, offset);
331 proto_tree_add_text(tree, tvb, offset, 1, "ELAN name size: %u", name_size);
334 proto_tree_add_text(tree, tvb, offset, 20, "Target ATM Address: %s",
335 tvb_bytes_to_str(tvb, offset, 20));
340 if (name_size != 0) {
341 proto_tree_add_text(tree, tvb, offset, name_size, "ELAN name: %s",
342 tvb_bytes_to_str(tvb, offset, name_size));
346 dissect_le_control_tlvs(tvb, offset, num_tlvs, tree);
350 dissect_le_registration_frame(tvbuff_t *tvb, int offset, proto_tree *tree)
354 dissect_lan_destination(tvb, offset, "Source", tree);
357 dissect_lan_destination(tvb, offset, "Target", tree);
360 proto_tree_add_text(tree, tvb, offset, 20, "Source ATM Address: %s",
361 tvb_bytes_to_str(tvb, offset, 20));
367 num_tlvs = tvb_get_guint8(tvb, offset);
368 proto_tree_add_text(tree, tvb, offset, 1, "Number of TLVs: %u", num_tlvs);
374 dissect_le_control_tlvs(tvb, offset, num_tlvs, tree);
378 dissect_le_arp_frame(tvbuff_t *tvb, int offset, proto_tree *tree)
382 dissect_lan_destination(tvb, offset, "Source", tree);
385 dissect_lan_destination(tvb, offset, "Target", tree);
388 proto_tree_add_text(tree, tvb, offset, 20, "Source ATM Address: %s",
389 tvb_bytes_to_str(tvb, offset, 20));
395 num_tlvs = tvb_get_guint8(tvb, offset);
396 proto_tree_add_text(tree, tvb, offset, 1, "Number of TLVs: %u", num_tlvs);
402 proto_tree_add_text(tree, tvb, offset, 20, "Target ATM Address: %s",
403 tvb_bytes_to_str(tvb, offset, 20));
409 dissect_le_control_tlvs(tvb, offset, num_tlvs, tree);
413 dissect_le_verify_frame(tvbuff_t *tvb, int offset, proto_tree *tree)
420 num_tlvs = tvb_get_guint8(tvb, offset);
421 proto_tree_add_text(tree, tvb, offset, 1, "Number of TLVs: %u", num_tlvs);
427 proto_tree_add_text(tree, tvb, offset, 20, "Target ATM Address: %s",
428 tvb_bytes_to_str(tvb, offset, 20));
434 dissect_le_control_tlvs(tvb, offset, num_tlvs, tree);
438 dissect_le_flush_frame(tvbuff_t *tvb, int offset, proto_tree *tree)
440 dissect_lan_destination(tvb, offset, "Source", tree);
443 dissect_lan_destination(tvb, offset, "Target", tree);
446 proto_tree_add_text(tree, tvb, offset, 20, "Source ATM Address: %s",
447 tvb_bytes_to_str(tvb, offset, 20));
453 proto_tree_add_text(tree, tvb, offset, 20, "Target ATM Address: %s",
454 tvb_bytes_to_str(tvb, offset, 20));
462 dissect_le_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
465 proto_tree *lane_tree = NULL;
468 proto_tree *flags_tree;
472 if (check_col(pinfo->cinfo, COL_INFO))
473 col_set_str(pinfo->cinfo, COL_INFO, "LE Control");
476 ti = proto_tree_add_protocol_format(tree, proto_atm_lane, tvb, offset, 108, "ATM LANE");
477 lane_tree = proto_item_add_subtree(ti, ett_atm_lane);
479 proto_tree_add_text(lane_tree, tvb, offset, 2, "Marker: 0x%04X",
480 tvb_get_ntohs(tvb, offset));
485 proto_tree_add_text(lane_tree, tvb, offset, 1, "Protocol: 0x%02X",
486 tvb_get_guint8(tvb, offset));
491 proto_tree_add_text(lane_tree, tvb, offset, 1, "Version: 0x%02X",
492 tvb_get_guint8(tvb, offset));
496 opcode = tvb_get_ntohs(tvb, offset);
497 if (check_col(pinfo->cinfo, COL_INFO)) {
498 col_append_fstr(pinfo->cinfo, COL_INFO, ": %s",
499 val_to_str(opcode, le_control_opcode_vals,
500 "Unknown opcode (0x%04X)"));
503 proto_tree_add_text(lane_tree, tvb, offset, 2, "Opcode: %s",
504 val_to_str(opcode, le_control_opcode_vals,
505 "Unknown (0x%04X)"));
509 if (opcode == READY_QUERY || opcode == READY_IND) {
510 /* There's nothing more in this packet. */
515 if (opcode & 0x0100) {
516 /* Response; decode status. */
517 proto_tree_add_text(lane_tree, tvb, offset, 2, "Status: %s",
518 val_to_str(tvb_get_ntohs(tvb, offset), le_control_status_vals,
519 "Unknown (0x%04X)"));
523 proto_tree_add_text(lane_tree, tvb, offset, 4, "Transaction ID: 0x%08X",
524 tvb_get_ntohl(tvb, offset));
527 proto_tree_add_text(lane_tree, tvb, offset, 2, "Requester LECID: 0x%04X",
528 tvb_get_ntohs(tvb, offset));
531 flags = tvb_get_ntohs(tvb, offset);
532 tf = proto_tree_add_text(lane_tree, tvb, offset, 2, "Flags: 0x%04X",
534 flags_tree = proto_item_add_subtree(tf, ett_atm_lane_lc_flags);
538 case LE_CONFIGURE_REQUEST:
539 case LE_CONFIGURE_RESPONSE:
540 proto_tree_add_text(flags_tree, tvb, offset, 2, "%s",
541 decode_boolean_bitfield(flags, 0x0002, 8*2,
542 "V2 capable", "Not V2 capable"));
544 dissect_le_configure_join_frame(tvb, offset, lane_tree);
547 case LE_JOIN_REQUEST:
548 case LE_JOIN_RESPONSE:
549 proto_tree_add_text(flags_tree, tvb, offset, 2, "%s",
550 decode_boolean_bitfield(flags, 0x0002, 8*2,
551 "V2 capable", "Not V2 capable"));
552 if (opcode == LE_JOIN_REQUEST) {
553 proto_tree_add_text(flags_tree, tvb, offset, 2, "%s",
554 decode_boolean_bitfield(flags, 0x0004, 8*2,
555 "Selective multicast", "No selective multicast"));
557 proto_tree_add_text(flags_tree, tvb, offset, 2, "%s",
558 decode_boolean_bitfield(flags, 0x0008, 8*2,
559 "V2 required", "V2 not required"));
561 proto_tree_add_text(flags_tree, tvb, offset, 2, "%s",
562 decode_boolean_bitfield(flags, 0x0080, 8*2,
563 "Proxy", "Not proxy"));
564 proto_tree_add_text(flags_tree, tvb, offset, 2, "%s",
565 decode_boolean_bitfield(flags, 0x0200, 8*2,
566 "Exclude explorer frames",
567 "Don't exclude explorer frames"));
569 dissect_le_configure_join_frame(tvb, offset, lane_tree);
572 case LE_REGISTER_REQUEST:
573 case LE_REGISTER_RESPONSE:
574 case LE_UNREGISTER_REQUEST:
575 case LE_UNREGISTER_RESPONSE:
577 dissect_le_registration_frame(tvb, offset, lane_tree);
581 case LE_ARP_RESPONSE:
582 case LE_NARP_REQUEST:
583 if (opcode != LE_NARP_REQUEST) {
584 proto_tree_add_text(flags_tree, tvb, offset, 2, "%s",
585 decode_boolean_bitfield(flags, 0x0001, 8*2,
586 "Remote address", "Local address"));
589 dissect_le_arp_frame(tvb, offset, lane_tree);
592 case LE_TOPOLOGY_REQUEST:
593 proto_tree_add_text(flags_tree, tvb, offset, 2, "%s",
594 decode_boolean_bitfield(flags, 0x0100, 8*2,
595 "Topology change", "No topology change"));
597 /* 92 reserved bytes */
600 case LE_VERIFY_REQUEST:
601 case LE_VERIFY_RESPONSE:
603 dissect_le_verify_frame(tvb, offset, lane_tree);
606 case LE_FLUSH_REQUEST:
607 case LE_FLUSH_RESPONSE:
609 dissect_le_flush_frame(tvb, offset, lane_tree);
616 capture_lane(const union wtap_pseudo_header *pseudo_header, const guchar *pd,
617 int len, packet_counts *ld)
619 /* Is it LE Control, 802.3, 802.5, or "none of the above"? */
620 switch (pseudo_header->atm.subtype) {
622 case TRAF_ST_LANE_802_3:
623 case TRAF_ST_LANE_802_3_MC:
624 /* Dissect as Ethernet */
625 capture_eth(pd, 2, len, ld);
628 case TRAF_ST_LANE_802_5:
629 case TRAF_ST_LANE_802_5_MC:
630 /* Dissect as Token-Ring */
631 capture_tr(pd, 2, len, ld);
641 dissect_lane(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
644 tvbuff_t *next_tvb_le_client;
646 if (check_col(pinfo->cinfo, COL_PROTOCOL))
647 col_set_str(pinfo->cinfo, COL_PROTOCOL, "ATM LANE");
649 /* Is it LE Control, 802.3, 802.5, or "none of the above"? */
650 switch (pinfo->pseudo_header->atm.subtype) {
652 case TRAF_ST_LANE_LE_CTRL:
653 dissect_le_control(tvb, pinfo, tree);
656 case TRAF_ST_LANE_802_3:
657 case TRAF_ST_LANE_802_3_MC:
658 if (check_col(pinfo->cinfo, COL_INFO))
659 col_set_str(pinfo->cinfo, COL_INFO, "LE Client - Ethernet/802.3");
660 dissect_le_client(tvb, tree);
662 /* Dissect as Ethernet */
663 next_tvb_le_client = tvb_new_subset(tvb, 2, -1, -1);
664 call_dissector(eth_handle, next_tvb_le_client, pinfo, tree);
667 case TRAF_ST_LANE_802_5:
668 case TRAF_ST_LANE_802_5_MC:
669 if (check_col(pinfo->cinfo, COL_INFO))
670 col_set_str(pinfo->cinfo, COL_INFO, "LE Client - 802.5");
671 dissect_le_client(tvb, tree);
673 /* Dissect as Token-Ring */
674 next_tvb_le_client = tvb_new_subset(tvb, 2, -1, -1);
675 call_dissector(tr_handle, next_tvb_le_client, pinfo, tree);
679 /* Dump it as raw data. */
680 if (check_col(pinfo->cinfo, COL_INFO))
681 col_set_str(pinfo->cinfo, COL_INFO, "Unknown LANE traffic type");
682 next_tvb = tvb_new_subset(tvb, 0, -1, -1);
683 call_dissector(data_handle,next_tvb, pinfo, tree);
689 dissect_ilmi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
691 dissect_snmp_pdu(tvb, 0, pinfo, tree, "ILMI", proto_ilmi, ett_ilmi);
695 static const value_string aal_vals[] = {
696 { AAL_UNKNOWN, "Unknown AAL" },
699 { AAL_3_4, "AAL3/4" },
701 { AAL_USER, "User AAL" },
702 { AAL_SIGNALLING, "Signalling AAL" },
703 { AAL_OAMCELL, "OAM cell" },
707 /* AAL5 higher-level traffic types */
708 static const value_string aal5_hltype_vals[] = {
709 { TRAF_UNKNOWN, "Unknown traffic type" },
710 { TRAF_LLCMX, "LLC multiplexed" },
711 { TRAF_VCMX, "VC multiplexed" },
712 { TRAF_LANE, "LANE" },
713 { TRAF_ILMI, "ILMI" },
714 { TRAF_FR, "Frame Relay" },
715 { TRAF_SPANS, "FORE SPANS" },
716 { TRAF_IPSILON, "Ipsilon" },
720 /* Traffic subtypes for VC multiplexed traffic */
721 static const value_string vcmx_type_vals[] = {
722 { TRAF_ST_UNKNOWN, "Unknown VC multiplexed traffic type" },
723 { TRAF_ST_VCMX_802_3_FCS, "802.3 FCS" },
724 { TRAF_ST_VCMX_802_4_FCS, "802.4 FCS" },
725 { TRAF_ST_VCMX_802_5_FCS, "802.5 FCS" },
726 { TRAF_ST_VCMX_FDDI_FCS, "FDDI FCS" },
727 { TRAF_ST_VCMX_802_6_FCS, "802.6 FCS" },
728 { TRAF_ST_VCMX_802_3, "802.3" },
729 { TRAF_ST_VCMX_802_4, "802.4" },
730 { TRAF_ST_VCMX_802_5, "802.5" },
731 { TRAF_ST_VCMX_FDDI, "FDDI" },
732 { TRAF_ST_VCMX_802_6, "802.6" },
733 { TRAF_ST_VCMX_FRAGMENTS, "Fragments" },
734 { TRAF_ST_VCMX_BPDU, "BPDU" },
738 /* Traffic subtypes for LANE traffic */
739 static const value_string lane_type_vals[] = {
740 { TRAF_ST_UNKNOWN, "Unknown LANE traffic type" },
741 { TRAF_ST_LANE_LE_CTRL, "LE Control" },
742 { TRAF_ST_LANE_802_3, "802.3" },
743 { TRAF_ST_LANE_802_5, "802.5" },
744 { TRAF_ST_LANE_802_3_MC, "802.3 multicast" },
745 { TRAF_ST_LANE_802_5_MC, "802.5 multicast" },
749 /* Traffic subtypes for Ipsilon traffic */
750 static const value_string ipsilon_type_vals[] = {
751 { TRAF_ST_UNKNOWN, "Unknown Ipsilon traffic type" },
752 { TRAF_ST_IPSILON_FT0, "Flow type 0" },
753 { TRAF_ST_IPSILON_FT1, "Flow type 1" },
754 { TRAF_ST_IPSILON_FT2, "Flow type 2" },
759 capture_atm(const union wtap_pseudo_header *pseudo_header, const guchar *pd,
760 int len, packet_counts *ld)
762 if (pseudo_header->atm.aal == AAL_5) {
763 switch (pseudo_header->atm.type) {
766 /* Dissect as WTAP_ENCAP_ATM_RFC1483 */
767 /* The ATM iptrace capture that we have shows LLC at this point,
768 * so that's what I'm calling */
769 capture_llc(pd, 0, len, ld);
773 capture_lane(pseudo_header, pd, len, ld);
785 dissect_atm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
787 proto_tree *atm_tree;
790 if (check_col(pinfo->cinfo, COL_PROTOCOL))
791 col_set_str(pinfo->cinfo, COL_PROTOCOL, "ATM");
793 switch (pinfo->pseudo_header->atm.channel) {
796 /* Traffic from DCE to DTE. */
797 if (check_col(pinfo->cinfo, COL_RES_DL_DST))
798 col_set_str(pinfo->cinfo, COL_RES_DL_DST, "DTE");
799 if (check_col(pinfo->cinfo, COL_RES_DL_SRC))
800 col_set_str(pinfo->cinfo, COL_RES_DL_SRC, "DCE");
804 /* Traffic from DTE to DCE. */
805 if (check_col(pinfo->cinfo, COL_RES_DL_DST))
806 col_set_str(pinfo->cinfo, COL_RES_DL_DST, "DCE");
807 if (check_col(pinfo->cinfo, COL_RES_DL_SRC))
808 col_set_str(pinfo->cinfo, COL_RES_DL_SRC, "DTE");
812 if (check_col(pinfo->cinfo, COL_INFO)) {
813 if (pinfo->pseudo_header->atm.aal == AAL_5) {
814 col_add_fstr(pinfo->cinfo, COL_INFO, "AAL5 %s",
815 val_to_str(pinfo->pseudo_header->atm.type, aal5_hltype_vals,
816 "Unknown traffic type (%u)"));
818 col_add_str(pinfo->cinfo, COL_INFO,
819 val_to_str(pinfo->pseudo_header->atm.aal, aal_vals,
820 "Unknown AAL (%u)"));
825 ti = proto_tree_add_protocol_format(tree, proto_atm, tvb, 0, 0, "ATM");
826 atm_tree = proto_item_add_subtree(ti, ett_atm);
828 proto_tree_add_text(atm_tree, tvb, 0, 0, "AAL: %s",
829 val_to_str(pinfo->pseudo_header->atm.aal, aal_vals,
830 "Unknown AAL (%u)"));
831 if (pinfo->pseudo_header->atm.aal == AAL_5) {
832 proto_tree_add_text(atm_tree, tvb, 0, 0, "Traffic type: %s",
833 val_to_str(pinfo->pseudo_header->atm.type, aal5_hltype_vals,
834 "Unknown AAL5 traffic type (%u)"));
835 switch (pinfo->pseudo_header->atm.type) {
838 proto_tree_add_text(atm_tree, tvb, 0, 0, "VC multiplexed traffic type: %s",
839 val_to_str(pinfo->pseudo_header->atm.subtype,
840 vcmx_type_vals, "Unknown VCMX traffic type (%u)"));
844 proto_tree_add_text(atm_tree, tvb, 0, 0, "LANE traffic type: %s",
845 val_to_str(pinfo->pseudo_header->atm.subtype,
846 lane_type_vals, "Unknown LANE traffic type (%u)"));
850 proto_tree_add_text(atm_tree, tvb, 0, 0, "Ipsilon traffic type: %s",
851 val_to_str(pinfo->pseudo_header->atm.subtype,
852 ipsilon_type_vals, "Unknown Ipsilon traffic type (%u)"));
856 proto_tree_add_uint(atm_tree, hf_atm_vpi, tvb, 0, 0,
857 pinfo->pseudo_header->atm.vpi);
858 proto_tree_add_uint(atm_tree, hf_atm_vci, tvb, 0, 0,
859 pinfo->pseudo_header->atm.vci);
860 switch (pinfo->pseudo_header->atm.channel) {
863 /* Traffic from DCE to DTE. */
864 proto_tree_add_text(atm_tree, tvb, 0, 0, "Channel: DCE->DTE");
868 /* Traffic from DTE to DCE. */
869 proto_tree_add_text(atm_tree, tvb, 0, 0, "Channel: DTE->DCE");
873 /* Sniffers shouldn't provide anything other than 0 or 1. */
874 proto_tree_add_text(atm_tree, tvb, 0, 0, "Channel: %u",
875 pinfo->pseudo_header->atm.channel);
878 if (pinfo->pseudo_header->atm.cells != 0) {
880 * If the cell count is 0, assume it means we don't know how
883 * XXX - also, if this is AAL5 traffic, assume it means we don't
884 * know what was in the AAL5 trailer. We may, however, find
885 * some capture program that can give us the AAL5 trailer
886 * information but not the cell count, in which case we need
887 * some other way of indicating whether we have the AAL5 trailer
890 proto_tree_add_text(atm_tree, tvb, 0, 0, "Cells: %u",
891 pinfo->pseudo_header->atm.cells);
892 if (pinfo->pseudo_header->atm.aal == AAL_5) {
893 proto_tree_add_text(atm_tree, tvb, 0, 0, "AAL5 U2U: %u",
894 pinfo->pseudo_header->atm.aal5t_u2u);
895 proto_tree_add_text(atm_tree, tvb, 0, 0, "AAL5 len: %u",
896 pinfo->pseudo_header->atm.aal5t_len);
897 proto_tree_add_text(atm_tree, tvb, 0, 0, "AAL5 checksum: 0x%08X",
898 pinfo->pseudo_header->atm.aal5t_chksum);
903 switch (pinfo->pseudo_header->atm.aal) {
906 call_dissector(sscop_handle, tvb, pinfo, tree);
910 switch (pinfo->pseudo_header->atm.type) {
913 /* Dissect as WTAP_ENCAP_ATM_RFC1483 */
914 /* The ATM iptrace capture that we have shows LLC at this point,
915 * so that's what I'm calling */
916 call_dissector(llc_handle, tvb, pinfo, tree);
920 call_dissector(lane_handle, tvb, pinfo, tree);
924 call_dissector(ilmi_handle, tvb, pinfo, tree);
929 /* Dump it as raw data. */
930 call_dissector(data_handle,tvb, pinfo, tree);
938 /* Dump it as raw data. (Is this a single cell?) */
939 call_dissector(data_handle,tvb, pinfo, tree);
946 proto_register_atm(void)
948 static hf_register_info hf[] = {
950 { "VPI", "atm.vpi", FT_UINT8, BASE_DEC, NULL, 0x0,
954 { "VCI", "atm.vci", FT_UINT16, BASE_DEC, NULL, 0x0,
957 static gint *ett[] = {
961 &ett_atm_lane_lc_lan_dest,
962 &ett_atm_lane_lc_lan_dest_rd,
963 &ett_atm_lane_lc_flags,
964 &ett_atm_lane_lc_tlv,
966 proto_atm = proto_register_protocol("ATM", "ATM", "atm");
967 proto_register_field_array(proto_atm, hf, array_length(hf));
968 proto_register_subtree_array(ett, array_length(ett));
970 proto_ilmi = proto_register_protocol("ILMI", "ILMI", "ilmi");
972 register_dissector("ilmi", dissect_ilmi, proto_ilmi);
974 proto_atm_lane = proto_register_protocol("ATM LAN Emulation",
977 register_dissector("lane", dissect_lane, proto_atm_lane);
981 proto_reg_handoff_atm(void)
983 dissector_handle_t atm_handle;
986 * Get handles for the Ethernet, Token Ring, LLC, SSCOP, LANE,
987 * and ILMI dissectors.
989 eth_handle = find_dissector("eth");
990 tr_handle = find_dissector("tr");
991 llc_handle = find_dissector("llc");
992 sscop_handle = find_dissector("sscop");
993 lane_handle = find_dissector("lane");
994 ilmi_handle = find_dissector("ilmi");
995 data_handle = find_dissector("data");
997 atm_handle = create_dissector_handle(dissect_atm, proto_atm);
999 dissector_add("wtap_encap", WTAP_ENCAP_ATM_SNIFFER, atm_handle);