2 * Routines for ATM packet disassembly
4 * $Id: packet-atm.c,v 1.36 2001/06/18 02:17:44 guy Exp $
6 * Ethereal - Network traffic analyzer
7 * By Gerald Combs <gerald@ethereal.com>
8 * Copyright 1998 Gerald Combs
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
30 #ifdef HAVE_SYS_TYPES_H
31 # include <sys/types.h>
40 #include "packet-snmp.h"
42 static int proto_atm = -1;
43 static int hf_atm_vpi = -1;
44 static int hf_atm_vci = -1;
45 static int proto_atm_lane = -1;
46 static int proto_ilmi = -1;
48 static gint ett_atm = -1;
49 static gint ett_atm_lane = -1;
50 static gint ett_atm_lane_lc_lan_dest = -1;
51 static gint ett_atm_lane_lc_lan_dest_rd = -1;
52 static gint ett_atm_lane_lc_flags = -1;
53 static gint ett_atm_lane_lc_tlv = -1;
54 static gint ett_ilmi = -1;
56 static dissector_handle_t eth_handle;
57 static dissector_handle_t tr_handle;
58 static dissector_handle_t llc_handle;
59 static dissector_handle_t sscop_handle;
60 static dissector_handle_t lane_handle;
61 static dissector_handle_t ilmi_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
90 static const value_string le_control_opcode_vals[] = {
91 { LE_CONFIGURE_REQUEST, "LE_CONFIGURE_REQUEST" },
92 { LE_CONFIGURE_RESPONSE, "LE_CONFIGURE_RESPONSE" },
93 { LE_JOIN_REQUEST, "LE_JOIN_REQUEST" },
94 { LE_JOIN_RESPONSE, "LE_JOIN_RESPONSE" },
95 { READY_QUERY, "READY_QUERY" },
96 { READY_IND, "READY_IND" },
97 { LE_REGISTER_REQUEST, "LE_REGISTER_REQUEST" },
98 { LE_REGISTER_RESPONSE, "LE_REGISTER_RESPONSE" },
99 { LE_UNREGISTER_REQUEST, "LE_UNREGISTER_REQUEST" },
100 { LE_UNREGISTER_RESPONSE, "LE_UNREGISTER_RESPONSE" },
101 { LE_ARP_REQUEST, "LE_ARP_REQUEST" },
102 { LE_ARP_RESPONSE, "LE_ARP_RESPONSE" },
103 { LE_FLUSH_REQUEST, "LE_FLUSH_REQUEST" },
104 { LE_FLUSH_RESPONSE, "LE_FLUSH_RESPONSE" },
105 { LE_NARP_REQUEST, "LE_NARP_REQUEST" },
106 { LE_TOPOLOGY_REQUEST, "LE_TOPOLOGY_REQUEST" },
110 /* LE Control statuses */
111 static const value_string le_control_status_vals[] = {
113 { 1, "Version not supported" },
114 { 2, "Invalid request parameters" },
115 { 4, "Duplicate LAN destination registration" },
116 { 5, "Duplicate ATM address" },
117 { 6, "Insufficient resources to grant request" },
118 { 7, "Access denied" },
119 { 8, "Invalid REQUESTOR-ID" },
120 { 9, "Invalid LAN destination" },
121 { 10, "Invalid ATM address" },
122 { 20, "No configuraton" },
123 { 21, "LE_CONFIGURE error" },
124 { 22, "Insufficient information" },
128 /* LE Control LAN destination tags */
129 #define TAG_NOT_PRESENT 0x0000
130 #define TAG_MAC_ADDRESS 0x0001
131 #define TAG_ROUTE_DESCRIPTOR 0x0002
133 static const value_string le_control_landest_tag_vals[] = {
134 { TAG_NOT_PRESENT, "Not present" },
135 { TAG_MAC_ADDRESS, "MAC address" },
136 { TAG_ROUTE_DESCRIPTOR, "Route descriptor" },
140 /* LE Control LAN types */
141 #define LANT_UNSPEC 0x00
142 #define LANT_802_3 0x01
143 #define LANT_802_5 0x02
145 static const value_string le_control_lan_type_vals[] = {
146 { LANT_UNSPEC, "Unspecified" },
147 { LANT_802_3, "Ethernet/802.3" },
148 { LANT_802_5, "802.5" },
153 dissect_le_client(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
156 proto_tree *lane_tree;
159 ti = proto_tree_add_protocol_format(tree, proto_atm_lane, tvb, 0, 2, "ATM LANE");
160 lane_tree = proto_item_add_subtree(ti, ett_atm_lane);
162 proto_tree_add_text(lane_tree, tvb, 0, 2, "LE Client: 0x%04X",
163 tvb_get_ntohs(tvb, 0));
168 dissect_lan_destination(tvbuff_t *tvb, int offset, const char *type, proto_tree *tree)
171 proto_tree *dest_tree;
175 guint16 route_descriptor;
177 td = proto_tree_add_text(tree, tvb, offset, 8, "%s LAN destination",
179 dest_tree = proto_item_add_subtree(td, ett_atm_lane_lc_lan_dest);
180 tag = tvb_get_ntohs(tvb, offset);
181 proto_tree_add_text(dest_tree, tvb, offset, 2, "Tag: %s",
182 val_to_str(tag, le_control_landest_tag_vals,
183 "Unknown (0x%04X)"));
188 case TAG_MAC_ADDRESS:
189 proto_tree_add_text(dest_tree, tvb, offset, 6, "MAC address: %s",
190 ether_to_str(tvb_get_ptr(tvb, offset, 6)));
193 case TAG_ROUTE_DESCRIPTOR:
195 route_descriptor = tvb_get_ntohs(tvb, offset);
196 trd = proto_tree_add_text(dest_tree, tvb, offset, 2, "Route descriptor: 0x%02X",
198 rd_tree = proto_item_add_subtree(td, ett_atm_lane_lc_lan_dest_rd);
199 proto_tree_add_text(rd_tree, tvb, offset, 2,
200 decode_numeric_bitfield(route_descriptor, 0xFFF0, 2*8,
202 proto_tree_add_text(rd_tree, tvb, offset, 2,
203 decode_numeric_bitfield(route_descriptor, 0x000F, 2*8,
204 "Bridge number = %u"));
210 * TLV values in LE Control frames.
212 #define TLV_TYPE(oui, ident) (((oui) << 8) | (ident))
214 #define LE_CONTROL_TIMEOUT TLV_TYPE(OUI_ATM_FORUM, 0x01)
215 #define LE_MAX_UNK_FRAME_COUNT TLV_TYPE(OUI_ATM_FORUM, 0x02)
216 #define LE_MAX_UNK_FRAME_TIME TLV_TYPE(OUI_ATM_FORUM, 0x03)
217 #define LE_VCC_TIMEOUT_PERIOD TLV_TYPE(OUI_ATM_FORUM, 0x04)
218 #define LE_MAX_RETRY_COUNT TLV_TYPE(OUI_ATM_FORUM, 0x05)
219 #define LE_AGING_TIME TLV_TYPE(OUI_ATM_FORUM, 0x06)
220 #define LE_FORWARD_DELAY_TIME TLV_TYPE(OUI_ATM_FORUM, 0x07)
221 #define LE_EXPECTED_ARP_RESPONSE_TIME TLV_TYPE(OUI_ATM_FORUM, 0x08)
222 #define LE_FLUSH_TIMEOUT TLV_TYPE(OUI_ATM_FORUM, 0x09)
223 #define LE_PATH_SWITCHING_DELAY TLV_TYPE(OUI_ATM_FORUM, 0x0A)
224 #define LE_LOCAL_SEGMENT_ID TLV_TYPE(OUI_ATM_FORUM, 0x0B)
225 #define LE_MCAST_SEND_VCC_TYPE TLV_TYPE(OUI_ATM_FORUM, 0x0C)
226 #define LE_MCAST_SEND_VCC_AVGRATE TLV_TYPE(OUI_ATM_FORUM, 0x0D)
227 #define LE_MCAST_SEND_VCC_PEAKRATE TLV_TYPE(OUI_ATM_FORUM, 0x0E)
228 #define LE_CONN_COMPLETION_TIMER TLV_TYPE(OUI_ATM_FORUM, 0x0F)
230 static const value_string le_tlv_type_vals[] = {
231 { LE_CONTROL_TIMEOUT, "Control Time-out" },
232 { LE_MAX_UNK_FRAME_COUNT, "Maximum Unknown Frame Count" },
233 { LE_MAX_UNK_FRAME_TIME, "Maximum Unknown Frame Time" },
234 { LE_VCC_TIMEOUT_PERIOD, "VCC Time-out" },
235 { LE_MAX_RETRY_COUNT, "Maximum Retry Count" },
236 { LE_AGING_TIME, "Aging Time" },
237 { LE_FORWARD_DELAY_TIME, "Forwarding Delay Time" },
238 { LE_EXPECTED_ARP_RESPONSE_TIME, "Expected LE_ARP Response Time" },
239 { LE_FLUSH_TIMEOUT, "Flush Time-out" },
240 { LE_PATH_SWITCHING_DELAY, "Path Switching Delay" },
241 { LE_LOCAL_SEGMENT_ID, "Local Segment ID" },
242 { LE_MCAST_SEND_VCC_TYPE, "Mcast Send VCC Type" },
243 { LE_MCAST_SEND_VCC_AVGRATE, "Mcast Send VCC AvgRate" },
244 { LE_MCAST_SEND_VCC_PEAKRATE, "Mcast Send VCC PeakRate" },
245 { LE_CONN_COMPLETION_TIMER, "Connection Completion Timer" },
250 dissect_le_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
253 proto_tree *lane_tree;
256 proto_tree *flags_tree;
258 proto_tree *tlv_tree;
265 if (check_col(pinfo->fd, COL_INFO))
266 col_set_str(pinfo->fd, COL_INFO, "LE Control");
269 ti = proto_tree_add_protocol_format(tree, proto_atm_lane, tvb, offset, 108, "ATM LANE");
270 lane_tree = proto_item_add_subtree(ti, ett_atm_lane);
272 proto_tree_add_text(lane_tree, tvb, offset, 2, "Marker: 0x%04X",
273 tvb_get_ntohs(tvb, offset));
276 proto_tree_add_text(lane_tree, tvb, offset, 1, "Protocol: 0x%02X",
277 tvb_get_guint8(tvb, offset));
280 proto_tree_add_text(lane_tree, tvb, offset, 1, "Version: 0x%02X",
281 tvb_get_guint8(tvb, offset));
284 opcode = tvb_get_ntohs(tvb, offset);
285 proto_tree_add_text(lane_tree, tvb, offset, 2, "Opcode: %s",
286 val_to_str(opcode, le_control_opcode_vals,
287 "Unknown (0x%04X)"));
290 if (opcode == READY_QUERY || opcode == READY_IND) {
291 /* There's nothing more in this packet. */
295 if (opcode & 0x0100) {
296 /* Response; decode status. */
297 proto_tree_add_text(lane_tree, tvb, offset, 2, "Status: %s",
298 val_to_str(tvb_get_ntohs(tvb, offset), le_control_status_vals,
299 "Unknown (0x%04X)"));
303 proto_tree_add_text(lane_tree, tvb, offset, 4, "Transaction ID: 0x%08X",
304 tvb_get_ntohl(tvb, offset));
307 proto_tree_add_text(lane_tree, tvb, offset, 2, "Requester LECID: 0x%04X",
308 tvb_get_ntohs(tvb, offset));
311 flags = tvb_get_ntohs(tvb, offset);
312 tf = proto_tree_add_text(lane_tree, tvb, offset, 2, "Flags: 0x%04X",
314 flags_tree = proto_item_add_subtree(tf, ett_atm_lane_lc_flags);
315 proto_tree_add_text(flags_tree, tvb, offset, 2, "%s",
316 decode_boolean_bitfield(flags, 0x0001, 8*2,
317 "Remote address", "Local address"));
318 proto_tree_add_text(flags_tree, tvb, offset, 2, "%s",
319 decode_boolean_bitfield(flags, 0x0080, 8*2,
320 "Proxy", "Not proxy"));
321 proto_tree_add_text(flags_tree, tvb, offset, 2, "%s",
322 decode_boolean_bitfield(flags, 0x0100, 8*2,
323 "Topology change", "No topology change"));
326 dissect_lan_destination(tvb, offset, "Source", lane_tree);
329 dissect_lan_destination(tvb, offset, "Target", lane_tree);
332 proto_tree_add_text(lane_tree, tvb, offset, 20, "Source ATM Address: %s",
333 tvb_bytes_to_str(tvb, offset, 20));
336 proto_tree_add_text(lane_tree, tvb, offset, 1, "LAN type: %s",
337 val_to_str(tvb_get_guint8(tvb, offset), le_control_lan_type_vals,
338 "Unknown (0x%02X)"));
341 proto_tree_add_text(lane_tree, tvb, offset, 1, "Maximum frame size: %u",
342 tvb_get_guint8(tvb, offset));
345 num_tlvs = tvb_get_guint8(tvb, offset);
346 proto_tree_add_text(lane_tree, tvb, offset, 1, "Number of TLVs: %u",
350 proto_tree_add_text(lane_tree, tvb, offset, 1, "ELAN name size: %u",
351 tvb_get_guint8(tvb, offset));
354 proto_tree_add_text(lane_tree, tvb, offset, 20, "Target ATM Address: %s",
355 tvb_bytes_to_str(tvb, offset, 20));
358 proto_tree_add_text(lane_tree, tvb, offset, 32, "ELAN name: %s",
359 tvb_bytes_to_str(tvb, offset, 32));
362 while (num_tlvs != 0) {
363 tlv_type = tvb_get_ntohl(tvb, offset);
364 tlv_length = tvb_get_guint8(tvb, offset+4);
365 ttlv = proto_tree_add_text(lane_tree, tvb, offset, 5+tlv_length, "TLV type: %s",
366 val_to_str(tlv_type, le_tlv_type_vals, "Unknown (0x%08x)"));
367 tlv_tree = proto_item_add_subtree(ttlv, ett_atm_lane_lc_tlv);
368 proto_tree_add_text(tlv_tree, tvb, offset, 4, "TLV Type: %s",
369 val_to_str(tlv_type, le_tlv_type_vals, "Unknown (0x%08x)"));
370 proto_tree_add_text(tlv_tree, tvb, offset+4, 1, "TLV Length: %u", tlv_length);
371 offset += 5+tlv_length;
378 dissect_lane(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
381 tvbuff_t *next_tvb_le_client;
383 if (check_col(pinfo->fd, COL_PROTOCOL))
384 col_set_str(pinfo->fd, COL_PROTOCOL, "ATM LANE");
385 if (check_col(pinfo->fd, COL_INFO))
386 col_set_str(pinfo->fd, COL_INFO, "ATM LANE");
388 /* Is it LE Control, 802.3, 802.5, or "none of the above"? */
389 switch (pinfo->pseudo_header->ngsniffer_atm.AppHLType) {
391 case AHLT_LANE_LE_CTRL:
392 dissect_le_control(tvb, pinfo, tree);
395 case AHLT_LANE_802_3:
396 case AHLT_LANE_802_3_MC:
397 dissect_le_client(tvb, pinfo, tree);
399 /* Dissect as Ethernet */
400 next_tvb_le_client = tvb_new_subset(tvb, 2, -1, -1);
401 call_dissector(eth_handle, next_tvb_le_client, pinfo, tree);
404 case AHLT_LANE_802_5:
405 case AHLT_LANE_802_5_MC:
406 dissect_le_client(tvb, pinfo, tree);
408 /* Dissect as Token-Ring */
409 next_tvb_le_client = tvb_new_subset(tvb, 2, -1, -1);
410 call_dissector(tr_handle, next_tvb_le_client, pinfo, tree);
414 /* Dump it as raw data. */
415 next_tvb = tvb_new_subset(tvb, 0, -1, -1);
416 dissect_data(next_tvb, 0, pinfo, tree);
422 dissect_ilmi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
424 dissect_snmp_pdu(tvb, 0, pinfo, tree, "ILMI", proto_ilmi, ett_ilmi);
428 static const value_string aal_vals[] = {
429 { ATT_AAL_UNKNOWN, "Unknown AAL" },
430 { ATT_AAL1, "AAL1" },
431 { ATT_AAL3_4, "AAL3/4" },
432 { ATT_AAL5, "AAL5" },
433 { ATT_AAL_USER, "User AAL" },
434 { ATT_AAL_SIGNALLING, "Signalling AAL" },
435 { ATT_OAMCELL, "OAM cell" },
439 /* AAL5 higher-level traffic types */
440 static const value_string aal5_hltype_vals[] = {
441 { ATT_HL_UNKNOWN, "Unknown traffic type" },
442 { ATT_HL_LLCMX, "LLC multiplexed" },
443 { ATT_HL_VCMX, "VC multiplexed" },
444 { ATT_HL_LANE, "LANE" },
445 { ATT_HL_ILMI, "ILMI" },
446 { ATT_HL_FRMR, "Frame Relay" },
447 { ATT_HL_SPANS, "FORE SPANS" },
448 { ATT_HL_IPSILON, "Ipsilon" },
452 /* Traffic subtypes for VC multiplexed traffic */
453 static const value_string vcmx_type_vals[] = {
454 { AHLT_UNKNOWN, "Unknown VC multiplexed traffic type" },
455 { AHLT_VCMX_802_3_FCS, "802.3 FCS" },
456 { AHLT_VCMX_802_4_FCS, "802.4 FCS" },
457 { AHLT_VCMX_802_5_FCS, "802.5 FCS" },
458 { AHLT_VCMX_FDDI_FCS, "FDDI FCS" },
459 { AHLT_VCMX_802_6_FCS, "802.6 FCS" },
460 { AHLT_VCMX_802_3, "802.3" },
461 { AHLT_VCMX_802_4, "802.4" },
462 { AHLT_VCMX_802_5, "802.5" },
463 { AHLT_VCMX_FDDI, "FDDI" },
464 { AHLT_VCMX_802_6, "802.6" },
465 { AHLT_VCMX_FRAGMENTS, "Fragments" },
466 { AHLT_VCMX_BPDU, "BPDU" },
470 /* Traffic subtypes for LANE traffic */
471 static const value_string lane_type_vals[] = {
472 { AHLT_UNKNOWN, "Unknown LANE traffic type" },
473 { AHLT_LANE_LE_CTRL, "LE Control" },
474 { AHLT_LANE_802_3, "802.3" },
475 { AHLT_LANE_802_5, "802.5" },
476 { AHLT_LANE_802_3_MC, "802.3 multicast" },
477 { AHLT_LANE_802_5_MC, "802.5 multicast" },
481 /* Traffic subtypes for Ipsilon traffic */
482 static const value_string ipsilon_type_vals[] = {
483 { AHLT_UNKNOWN, "Unknown Ipsilon traffic type" },
484 { AHLT_IPSILON_FT0, "Flow type 0" },
485 { AHLT_IPSILON_FT1, "Flow type 1" },
486 { AHLT_IPSILON_FT2, "Flow type 2" },
491 * We don't know what kind of traffic this is; try to guess.
492 * We at least know it's AAL5....
495 atm_guess_content(tvbuff_t *tvb, packet_info *pinfo)
497 guint8 byte0, byte1, byte2;
499 if (pinfo->pseudo_header->ngsniffer_atm.Vpi == 0) {
501 * Traffic on some PVCs with a VPI of 0 and certain
502 * VCIs is of particular types.
504 switch (pinfo->pseudo_header->ngsniffer_atm.Vci) {
510 pinfo->pseudo_header->ngsniffer_atm.AppTrafType =
518 pinfo->pseudo_header->ngsniffer_atm.AppTrafType |=
525 * OK, we can't tell what it is based on the VPI/VCI; try
526 * guessing based on the contents.
528 byte0 = tvb_get_guint8(tvb, 0);
529 byte1 = tvb_get_guint8(tvb, 1);
530 byte2 = tvb_get_guint8(tvb, 2);
531 if (byte0 == 0xaa && byte1 == 0xaa && byte2 == 0x03) {
533 * Looks like a SNAP header; assume it's LLC multiplexed
536 pinfo->pseudo_header->ngsniffer_atm.AppTrafType |= ATT_HL_LLCMX;
541 pinfo->pseudo_header->ngsniffer_atm.AppTrafType |= ATT_HL_LANE;
542 if (byte0 == 0xff && byte1 == 0x00) {
544 * Looks like LE Control traffic.
546 pinfo->pseudo_header->ngsniffer_atm.AppHLType =
550 * XXX - Ethernet, or Token Ring?
551 * Assume Ethernet for now; if we see earlier
552 * LANE traffic, we may be able to figure out
553 * the traffic type from that, but there may
554 * still be situations where the user has to
557 pinfo->pseudo_header->ngsniffer_atm.AppHLType =
564 dissect_atm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
566 proto_tree *atm_tree;
571 aal_type = pinfo->pseudo_header->ngsniffer_atm.AppTrafType & ATT_AALTYPE;
572 hl_type = pinfo->pseudo_header->ngsniffer_atm.AppTrafType & ATT_HLTYPE;
573 if (aal_type == ATT_AAL5) {
574 if (hl_type == ATT_HL_UNKNOWN ||
575 pinfo->pseudo_header->ngsniffer_atm.AppHLType == AHLT_UNKNOWN) {
577 * The joys of a connection-oriented link layer; the type of
578 * traffic may be implied by the connection on which it's
579 * traveling, rather than being specified in the packet itself.
581 * For this packet, the program that captured the packet didn't
582 * save the type of traffic, presumably because it didn't know
583 * the traffic type (either it didn't see the connection setup
584 * and wasn't running on one of the endpoints, and wasn't later
585 * told, e.g. by the human running it, what type of traffic was
586 * on that circuit, or was running on one of the endpoints but
587 * was using, to capture the packets, a mechanism that either
588 * doesn't have access to data saying what's going over the
589 * connection or doesn't bother providing that information).
591 * For now, we try to guess the traffic type based on the VPI/VCI
592 * or the packet header; later, we should provide a mechanism
593 * by which the user can specify what sort of traffic is on a
594 * particular circuit.
596 atm_guess_content(tvb, pinfo);
599 * OK, now get the AAL type and high-layer type again.
601 aal_type = pinfo->pseudo_header->ngsniffer_atm.AppTrafType & ATT_AALTYPE;
602 hl_type = pinfo->pseudo_header->ngsniffer_atm.AppTrafType & ATT_HLTYPE;
606 if (check_col(pinfo->fd, COL_PROTOCOL))
607 col_set_str(pinfo->fd, COL_PROTOCOL, "ATM");
609 switch (pinfo->pseudo_header->ngsniffer_atm.channel) {
612 /* Traffic from DCE to DTE. */
613 if (check_col(pinfo->fd, COL_RES_DL_DST))
614 col_set_str(pinfo->fd, COL_RES_DL_DST, "DTE");
615 if (check_col(pinfo->fd, COL_RES_DL_SRC))
616 col_set_str(pinfo->fd, COL_RES_DL_SRC, "DCE");
620 /* Traffic from DTE to DCE. */
621 if (check_col(pinfo->fd, COL_RES_DL_DST))
622 col_set_str(pinfo->fd, COL_RES_DL_DST, "DCE");
623 if (check_col(pinfo->fd, COL_RES_DL_SRC))
624 col_set_str(pinfo->fd, COL_RES_DL_SRC, "DTE");
628 if (check_col(pinfo->fd, COL_INFO)) {
629 if (aal_type == ATT_AAL5) {
630 col_add_fstr(pinfo->fd, COL_INFO, "AAL5 %s",
631 val_to_str(hl_type, aal5_hltype_vals,
632 "Unknown traffic type (%x)"));
634 col_add_str(pinfo->fd, COL_INFO,
635 val_to_str(aal_type, aal_vals, "Unknown AAL (%x)"));
640 ti = proto_tree_add_protocol_format(tree, proto_atm, tvb, 0, 0, "ATM");
641 atm_tree = proto_item_add_subtree(ti, ett_atm);
643 proto_tree_add_text(atm_tree, tvb, 0, 0, "AAL: %s",
644 val_to_str(aal_type, aal_vals, "Unknown AAL (%x)"));
645 if (aal_type == ATT_AAL5) {
646 proto_tree_add_text(atm_tree, tvb, 0, 0, "Traffic type: %s",
647 val_to_str(hl_type, aal5_hltype_vals, "Unknown AAL5 traffic type (%x)"));
651 proto_tree_add_text(atm_tree, tvb, 0, 0, "LLC multiplexed traffic");
655 proto_tree_add_text(atm_tree, tvb, 0, 0, "VC multiplexed traffic type: %s",
656 val_to_str(pinfo->pseudo_header->ngsniffer_atm.AppHLType,
657 vcmx_type_vals, "Unknown VCMX traffic type (%x)"));
661 proto_tree_add_text(atm_tree, tvb, 0, 0, "LANE traffic type: %s",
662 val_to_str(pinfo->pseudo_header->ngsniffer_atm.AppHLType,
663 lane_type_vals, "Unknown LANE traffic type (%x)"));
667 proto_tree_add_text(atm_tree, tvb, 0, 0, "Ipsilon traffic type: %s",
668 val_to_str(pinfo->pseudo_header->ngsniffer_atm.AppHLType,
669 ipsilon_type_vals, "Unknown Ipsilon traffic type (%x)"));
673 proto_tree_add_uint(atm_tree, hf_atm_vpi, tvb, 0, 0,
674 pinfo->pseudo_header->ngsniffer_atm.Vpi);
675 proto_tree_add_uint(atm_tree, hf_atm_vci, tvb, 0, 0,
676 pinfo->pseudo_header->ngsniffer_atm.Vci);
677 switch (pinfo->pseudo_header->ngsniffer_atm.channel) {
680 /* Traffic from DCE to DTE. */
681 proto_tree_add_text(atm_tree, tvb, 0, 0, "Channel: DCE->DTE");
685 /* Traffic from DTE to DCE. */
686 proto_tree_add_text(atm_tree, tvb, 0, 0, "Channel: DTE->DCE");
690 /* Sniffers shouldn't provide anything other than 0 or 1. */
691 proto_tree_add_text(atm_tree, tvb, 0, 0, "Channel: %u",
692 pinfo->pseudo_header->ngsniffer_atm.channel);
695 if (pinfo->pseudo_header->ngsniffer_atm.cells != 0) {
697 * If the cell count is 0, assume it means we don't know how
700 * XXX - also, if this is AAL5 traffic, assume it means we don't
701 * know what was in the AAL5 trailer. We may, however, find
702 * some capture program that can give us the AAL5 trailer
703 * information but not the cell count, in which case we need
704 * some other way of indicating whether we have the AAL5 trailer
707 proto_tree_add_text(atm_tree, tvb, 0, 0, "Cells: %u",
708 pinfo->pseudo_header->ngsniffer_atm.cells);
709 if (aal_type == ATT_AAL5) {
710 proto_tree_add_text(atm_tree, tvb, 0, 0, "AAL5 U2U: %u",
711 pinfo->pseudo_header->ngsniffer_atm.aal5t_u2u);
712 proto_tree_add_text(atm_tree, tvb, 0, 0, "AAL5 len: %u",
713 pinfo->pseudo_header->ngsniffer_atm.aal5t_len);
714 proto_tree_add_text(atm_tree, tvb, 0, 0, "AAL5 checksum: 0x%08X",
715 pinfo->pseudo_header->ngsniffer_atm.aal5t_chksum);
722 case ATT_AAL_SIGNALLING:
723 call_dissector(sscop_handle, tvb, pinfo, tree);
730 /* Dissect as WTAP_ENCAP_ATM_RFC1483 */
731 /* The ATM iptrace capture that we have shows LLC at this point,
732 * so that's what I'm calling */
733 call_dissector(llc_handle, tvb, pinfo, tree);
737 call_dissector(lane_handle, tvb, pinfo, tree);
741 call_dissector(ilmi_handle, tvb, pinfo, tree);
746 /* Dump it as raw data. */
747 dissect_data(tvb, 0, pinfo, tree);
755 /* Dump it as raw data. (Is this a single cell?) */
756 dissect_data(tvb, 0, pinfo, tree);
763 proto_register_atm(void)
765 static hf_register_info hf[] = {
767 { "VPI", "atm.vpi", FT_UINT8, BASE_DEC, NULL, 0x0,
771 { "VCI", "atm.vci", FT_UINT16, BASE_DEC, NULL, 0x0,
774 static gint *ett[] = {
778 &ett_atm_lane_lc_lan_dest,
779 &ett_atm_lane_lc_lan_dest_rd,
780 &ett_atm_lane_lc_flags,
781 &ett_atm_lane_lc_tlv,
783 proto_atm = proto_register_protocol("ATM", "ATM", "atm");
784 proto_register_field_array(proto_atm, hf, array_length(hf));
785 proto_register_subtree_array(ett, array_length(ett));
787 proto_ilmi = proto_register_protocol("ILMI", "ILMI", "ilmi");
789 register_dissector("ilmi", dissect_ilmi, proto_ilmi);
791 proto_atm_lane = proto_register_protocol("ATM LAN Emulation",
794 register_dissector("lane", dissect_lane, proto_atm_lane);
798 proto_reg_handoff_atm(void)
801 * Get handles for the Ethernet, Token Ring, LLC, SSCOP, LANE,
802 * and ILMI dissectors.
804 eth_handle = find_dissector("eth");
805 tr_handle = find_dissector("tr");
806 llc_handle = find_dissector("llc");
807 sscop_handle = find_dissector("sscop");
808 lane_handle = find_dissector("lane");
809 ilmi_handle = find_dissector("ilmi");
811 dissector_add("wtap_encap", WTAP_ENCAP_ATM_SNIFFER, dissect_atm,