2 * Routines for ATM packet disassembly
4 * $Id: packet-atm.c,v 1.28 2000/11/29 05:16:15 gram Exp $
6 * Ethereal - Network traffic analyzer
7 * By Gerald Combs <gerald@zing.org>
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-eth.h"
41 #include "packet-llc.h"
42 #include "packet-snmp.h"
43 #include "packet-sscop.h"
44 #include "packet-tr.h"
46 static int proto_atm = -1;
47 static int hf_atm_vpi = -1;
48 static int hf_atm_vci = -1;
49 static int proto_atm_lane = -1;
50 static int proto_ilmi = -1;
52 static gint ett_atm = -1;
53 static gint ett_atm_lane = -1;
54 static gint ett_atm_lane_lc_lan_dest = -1;
55 static gint ett_atm_lane_lc_lan_dest_rd = -1;
56 static gint ett_atm_lane_lc_flags = -1;
57 static gint ett_atm_lane_lc_tlv = -1;
58 static gint ett_ilmi = -1;
63 * http://www.atmforum.org/atmforum/specs/approved.html
65 * for a number of ATM Forum specifications, e.g. the LAN Emulation
66 * over ATM 1.0 spec, whence I got most of this.
69 /* LE Control opcodes */
70 #define LE_CONFIGURE_REQUEST 0x0001
71 #define LE_CONFIGURE_RESPONSE 0x0101
72 #define LE_JOIN_REQUEST 0x0002
73 #define LE_JOIN_RESPONSE 0x0102
74 #define READY_QUERY 0x0003
75 #define READY_IND 0x0103
76 #define LE_REGISTER_REQUEST 0x0004
77 #define LE_REGISTER_RESPONSE 0x0104
78 #define LE_UNREGISTER_REQUEST 0x0005
79 #define LE_UNREGISTER_RESPONSE 0x0105
80 #define LE_ARP_REQUEST 0x0006
81 #define LE_ARP_RESPONSE 0x0106
82 #define LE_FLUSH_REQUEST 0x0007
83 #define LE_FLUSH_RESPONSE 0x0107
84 #define LE_NARP_REQUEST 0x0008
85 #define LE_TOPOLOGY_REQUEST 0x0009
87 static const value_string le_control_opcode_vals[] = {
88 { LE_CONFIGURE_REQUEST, "LE_CONFIGURE_REQUEST" },
89 { LE_CONFIGURE_RESPONSE, "LE_CONFIGURE_RESPONSE" },
90 { LE_JOIN_REQUEST, "LE_JOIN_REQUEST" },
91 { LE_JOIN_RESPONSE, "LE_JOIN_RESPONSE" },
92 { READY_QUERY, "READY_QUERY" },
93 { READY_IND, "READY_IND" },
94 { LE_REGISTER_REQUEST, "LE_REGISTER_REQUEST" },
95 { LE_REGISTER_RESPONSE, "LE_REGISTER_RESPONSE" },
96 { LE_UNREGISTER_REQUEST, "LE_UNREGISTER_REQUEST" },
97 { LE_UNREGISTER_RESPONSE, "LE_UNREGISTER_RESPONSE" },
98 { LE_ARP_REQUEST, "LE_ARP_REQUEST" },
99 { LE_ARP_RESPONSE, "LE_ARP_RESPONSE" },
100 { LE_FLUSH_REQUEST, "LE_FLUSH_REQUEST" },
101 { LE_FLUSH_RESPONSE, "LE_FLUSH_RESPONSE" },
102 { LE_NARP_REQUEST, "LE_NARP_REQUEST" },
103 { LE_TOPOLOGY_REQUEST, "LE_TOPOLOGY_REQUEST" },
107 /* LE Control statuses */
108 static const value_string le_control_status_vals[] = {
110 { 1, "Version not supported" },
111 { 2, "Invalid request parameters" },
112 { 4, "Duplicate LAN destination registration" },
113 { 5, "Duplicate ATM address" },
114 { 6, "Insufficient resources to grant request" },
115 { 7, "Access denied" },
116 { 8, "Invalid REQUESTOR-ID" },
117 { 9, "Invalid LAN destination" },
118 { 10, "Invalid ATM address" },
119 { 20, "No configuraton" },
120 { 21, "LE_CONFIGURE error" },
121 { 22, "Insufficient information" },
125 /* LE Control LAN destination tags */
126 #define TAG_NOT_PRESENT 0x0000
127 #define TAG_MAC_ADDRESS 0x0001
128 #define TAG_ROUTE_DESCRIPTOR 0x0002
130 static const value_string le_control_landest_tag_vals[] = {
131 { TAG_NOT_PRESENT, "Not present" },
132 { TAG_MAC_ADDRESS, "MAC address" },
133 { TAG_ROUTE_DESCRIPTOR, "Route descriptor" },
137 /* LE Control LAN types */
138 #define LANT_UNSPEC 0x00
139 #define LANT_802_3 0x01
140 #define LANT_802_5 0x02
142 static const value_string le_control_lan_type_vals[] = {
143 { LANT_UNSPEC, "Unspecified" },
144 { LANT_802_3, "Ethernet/802.3" },
145 { LANT_802_5, "802.5" },
150 dissect_le_client(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
153 proto_tree *lane_tree;
156 ti = proto_tree_add_protocol_format(tree, proto_atm_lane, tvb, 0, 2, "ATM LANE");
157 lane_tree = proto_item_add_subtree(ti, ett_atm_lane);
159 proto_tree_add_text(lane_tree, tvb, 0, 2, "LE Client: 0x%04X",
160 tvb_get_ntohs(tvb, 0));
165 dissect_lan_destination(tvbuff_t *tvb, int offset, const char *type, proto_tree *tree)
168 proto_tree *dest_tree;
172 guint16 route_descriptor;
174 td = proto_tree_add_text(tree, tvb, offset, 8, "%s LAN destination",
176 dest_tree = proto_item_add_subtree(td, ett_atm_lane_lc_lan_dest);
177 tag = tvb_get_ntohs(tvb, offset);
178 proto_tree_add_text(dest_tree, tvb, offset, 2, "Tag: %s",
179 val_to_str(tag, le_control_landest_tag_vals,
180 "Unknown (0x%04X)"));
185 case TAG_MAC_ADDRESS:
186 proto_tree_add_text(dest_tree, tvb, offset, 6, "MAC address: %s",
187 ether_to_str(tvb_get_ptr(tvb, offset, 6)));
190 case TAG_ROUTE_DESCRIPTOR:
192 route_descriptor = tvb_get_ntohs(tvb, offset);
193 trd = proto_tree_add_text(dest_tree, tvb, offset, 2, "Route descriptor: 0x%02X",
195 rd_tree = proto_item_add_subtree(td, ett_atm_lane_lc_lan_dest_rd);
196 proto_tree_add_text(rd_tree, tvb, offset, 2,
197 decode_numeric_bitfield(route_descriptor, 0xFFF0, 2*8,
199 proto_tree_add_text(rd_tree, tvb, offset, 2,
200 decode_numeric_bitfield(route_descriptor, 0x000F, 2*8,
201 "Bridge number = %u"));
207 * TLV values in LE Control frames.
209 #define TLV_TYPE(oui, ident) (((oui) << 8) | (ident))
211 #define LE_CONTROL_TIMEOUT TLV_TYPE(OUI_ATM_FORUM, 0x01)
212 #define LE_MAX_UNK_FRAME_COUNT TLV_TYPE(OUI_ATM_FORUM, 0x02)
213 #define LE_MAX_UNK_FRAME_TIME TLV_TYPE(OUI_ATM_FORUM, 0x03)
214 #define LE_VCC_TIMEOUT_PERIOD TLV_TYPE(OUI_ATM_FORUM, 0x04)
215 #define LE_MAX_RETRY_COUNT TLV_TYPE(OUI_ATM_FORUM, 0x05)
216 #define LE_AGING_TIME TLV_TYPE(OUI_ATM_FORUM, 0x06)
217 #define LE_FORWARD_DELAY_TIME TLV_TYPE(OUI_ATM_FORUM, 0x07)
218 #define LE_EXPECTED_ARP_RESPONSE_TIME TLV_TYPE(OUI_ATM_FORUM, 0x08)
219 #define LE_FLUSH_TIMEOUT TLV_TYPE(OUI_ATM_FORUM, 0x09)
220 #define LE_PATH_SWITCHING_DELAY TLV_TYPE(OUI_ATM_FORUM, 0x0A)
221 #define LE_LOCAL_SEGMENT_ID TLV_TYPE(OUI_ATM_FORUM, 0x0B)
222 #define LE_MCAST_SEND_VCC_TYPE TLV_TYPE(OUI_ATM_FORUM, 0x0C)
223 #define LE_MCAST_SEND_VCC_AVGRATE TLV_TYPE(OUI_ATM_FORUM, 0x0D)
224 #define LE_MCAST_SEND_VCC_PEAKRATE TLV_TYPE(OUI_ATM_FORUM, 0x0E)
225 #define LE_CONN_COMPLETION_TIMER TLV_TYPE(OUI_ATM_FORUM, 0x0F)
227 static const value_string le_tlv_type_vals[] = {
228 { LE_CONTROL_TIMEOUT, "Control Time-out" },
229 { LE_MAX_UNK_FRAME_COUNT, "Maximum Unknown Frame Count" },
230 { LE_MAX_UNK_FRAME_TIME, "Maximum Unknown Frame Time" },
231 { LE_VCC_TIMEOUT_PERIOD, "VCC Time-out" },
232 { LE_MAX_RETRY_COUNT, "Maximum Retry Count" },
233 { LE_AGING_TIME, "Aging Time" },
234 { LE_FORWARD_DELAY_TIME, "Forwarding Delay Time" },
235 { LE_EXPECTED_ARP_RESPONSE_TIME, "Expected LE_ARP Response Time" },
236 { LE_FLUSH_TIMEOUT, "Flush Time-out" },
237 { LE_PATH_SWITCHING_DELAY, "Path Switching Delay" },
238 { LE_LOCAL_SEGMENT_ID, "Local Segment ID" },
239 { LE_MCAST_SEND_VCC_TYPE, "Mcast Send VCC Type" },
240 { LE_MCAST_SEND_VCC_AVGRATE, "Mcast Send VCC AvgRate" },
241 { LE_MCAST_SEND_VCC_PEAKRATE, "Mcast Send VCC PeakRate" },
242 { LE_CONN_COMPLETION_TIMER, "Connection Completion Timer" },
247 dissect_le_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
250 proto_tree *lane_tree;
253 proto_tree *flags_tree;
255 proto_tree *tlv_tree;
262 if (check_col(pinfo->fd, COL_INFO))
263 col_set_str(pinfo->fd, COL_INFO, "LE Control");
266 ti = proto_tree_add_protocol_format(tree, proto_atm_lane, tvb, offset, 108, "ATM LANE");
267 lane_tree = proto_item_add_subtree(ti, ett_atm_lane);
269 proto_tree_add_text(lane_tree, tvb, offset, 2, "Marker: 0x%04X",
270 tvb_get_ntohs(tvb, offset));
273 proto_tree_add_text(lane_tree, tvb, offset, 1, "Protocol: 0x%02X",
274 tvb_get_guint8(tvb, offset));
277 proto_tree_add_text(lane_tree, tvb, offset, 1, "Version: 0x%02X",
278 tvb_get_guint8(tvb, offset));
281 opcode = tvb_get_ntohs(tvb, offset);
282 proto_tree_add_text(lane_tree, tvb, offset, 2, "Opcode: %s",
283 val_to_str(opcode, le_control_opcode_vals,
284 "Unknown (0x%04X)"));
287 if (opcode == READY_QUERY || opcode == READY_IND) {
288 /* There's nothing more in this packet. */
292 if (opcode & 0x0100) {
293 /* Response; decode status. */
294 proto_tree_add_text(lane_tree, tvb, offset, 2, "Status: %s",
295 val_to_str(tvb_get_ntohs(tvb, offset), le_control_status_vals,
296 "Unknown (0x%04X)"));
300 proto_tree_add_text(lane_tree, tvb, offset, 4, "Transaction ID: 0x%08X",
301 tvb_get_ntohl(tvb, offset));
304 proto_tree_add_text(lane_tree, tvb, offset, 2, "Requester LECID: 0x%04X",
305 tvb_get_ntohs(tvb, offset));
308 flags = tvb_get_ntohs(tvb, offset);
309 tf = proto_tree_add_text(lane_tree, tvb, offset, 2, "Flags: 0x%04X",
311 flags_tree = proto_item_add_subtree(tf, ett_atm_lane_lc_flags);
312 proto_tree_add_text(flags_tree, tvb, offset, 2, "%s",
313 decode_boolean_bitfield(flags, 0x0001, 8*2,
314 "Remote address", "Local address"));
315 proto_tree_add_text(flags_tree, tvb, offset, 2, "%s",
316 decode_boolean_bitfield(flags, 0x0080, 8*2,
317 "Proxy", "Not proxy"));
318 proto_tree_add_text(flags_tree, tvb, offset, 2, "%s",
319 decode_boolean_bitfield(flags, 0x0100, 8*2,
320 "Topology change", "No topology change"));
323 dissect_lan_destination(tvb, offset, "Source", lane_tree);
326 dissect_lan_destination(tvb, offset, "Target", lane_tree);
329 proto_tree_add_text(lane_tree, tvb, offset, 20, "Source ATM Address: %s",
330 tvb_bytes_to_str(tvb, offset, 20));
333 proto_tree_add_text(lane_tree, tvb, offset, 1, "LAN type: %s",
334 val_to_str(tvb_get_guint8(tvb, offset), le_control_lan_type_vals,
335 "Unknown (0x%02X)"));
338 proto_tree_add_text(lane_tree, tvb, offset, 1, "Maximum frame size: %u",
339 tvb_get_guint8(tvb, offset));
342 num_tlvs = tvb_get_guint8(tvb, offset);
343 proto_tree_add_text(lane_tree, tvb, offset, 1, "Number of TLVs: %u",
347 proto_tree_add_text(lane_tree, tvb, offset, 1, "ELAN name size: %u",
348 tvb_get_guint8(tvb, offset));
351 proto_tree_add_text(lane_tree, tvb, offset, 20, "Target ATM Address: %s",
352 tvb_bytes_to_str(tvb, offset, 20));
355 proto_tree_add_text(lane_tree, tvb, offset, 32, "ELAN name: %s",
356 tvb_bytes_to_str(tvb, offset, 32));
359 while (num_tlvs != 0) {
360 tlv_type = tvb_get_ntohl(tvb, offset);
361 tlv_length = tvb_get_guint8(tvb, offset+4);
362 ttlv = proto_tree_add_text(lane_tree, tvb, offset, 5+tlv_length, "TLV type: %s",
363 val_to_str(tlv_type, le_tlv_type_vals, "Unknown (0x%08x)"));
364 tlv_tree = proto_item_add_subtree(ttlv, ett_atm_lane_lc_tlv);
365 proto_tree_add_text(tlv_tree, tvb, offset, 4, "TLV Type: %s",
366 val_to_str(tlv_type, le_tlv_type_vals, "Unknown (0x%08x)"));
367 proto_tree_add_text(tlv_tree, tvb, offset+4, 1, "TLV Length: %u", tlv_length);
368 offset += 5+tlv_length;
375 dissect_lane(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
378 tvbuff_t *next_tvb_le_client;
380 CHECK_DISPLAY_AS_DATA(proto_atm_lane, tvb, pinfo, tree);
382 pinfo->current_proto = "ATM LANE";
384 if (check_col(pinfo->fd, COL_PROTOCOL))
385 col_set_str(pinfo->fd, COL_PROTOCOL, "ATM LANE");
386 if (check_col(pinfo->fd, COL_INFO))
387 col_set_str(pinfo->fd, COL_INFO, "ATM LANE");
389 /* Is it LE Control, 802.3, 802.5, or "none of the above"? */
390 switch (pinfo->pseudo_header->ngsniffer_atm.AppHLType) {
392 case AHLT_LANE_LE_CTRL:
393 dissect_le_control(tvb, pinfo, tree);
396 case AHLT_LANE_802_3:
397 case AHLT_LANE_802_3_MC:
398 dissect_le_client(tvb, pinfo, tree);
400 /* Dissect as Ethernet */
401 next_tvb_le_client = tvb_new_subset(tvb, 2, -1, -1);
402 dissect_eth(next_tvb_le_client, pinfo, tree);
405 case AHLT_LANE_802_5:
406 case AHLT_LANE_802_5_MC:
407 dissect_le_client(tvb, pinfo, tree);
409 /* Dissect as Token-Ring */
410 next_tvb_le_client = tvb_new_subset(tvb, 2, -1, -1);
411 dissect_tr(next_tvb_le_client, pinfo, tree);
415 /* Dump it as raw data. */
416 next_tvb = tvb_new_subset(tvb, 0, -1, -1);
417 dissect_data(next_tvb, 0, pinfo, tree);
423 static const value_string aal_vals[] = {
424 { ATT_AAL_UNKNOWN, "Unknown AAL" },
425 { ATT_AAL1, "AAL1" },
426 { ATT_AAL3_4, "AAL3/4" },
427 { ATT_AAL5, "AAL5" },
428 { ATT_AAL_USER, "User AAL" },
429 { ATT_AAL_SIGNALLING, "Signalling AAL" },
430 { ATT_OAMCELL, "OAM cell" },
434 /* AAL5 higher-level traffic types */
435 static const value_string aal5_hltype_vals[] = {
436 { ATT_HL_UNKNOWN, "Unknown traffic type" },
437 { ATT_HL_LLCMX, "LLC multiplexed" },
438 { ATT_HL_VCMX, "VC multiplexed" },
439 { ATT_HL_LANE, "LANE" },
440 { ATT_HL_ILMI, "ILMI" },
441 { ATT_HL_FRMR, "Frame Relay" },
442 { ATT_HL_SPANS, "FORE SPANS" },
443 { ATT_HL_IPSILON, "Ipsilon" },
447 /* Traffic subtypes for VC multiplexed traffic */
448 static const value_string vcmx_type_vals[] = {
449 { AHLT_UNKNOWN, "Unknown VC multiplexed traffic type" },
450 { AHLT_VCMX_802_3_FCS, "802.3 FCS" },
451 { AHLT_VCMX_802_4_FCS, "802.4 FCS" },
452 { AHLT_VCMX_802_5_FCS, "802.5 FCS" },
453 { AHLT_VCMX_FDDI_FCS, "FDDI FCS" },
454 { AHLT_VCMX_802_6_FCS, "802.6 FCS" },
455 { AHLT_VCMX_802_3, "802.3" },
456 { AHLT_VCMX_802_4, "802.4" },
457 { AHLT_VCMX_802_5, "802.5" },
458 { AHLT_VCMX_FDDI, "FDDI" },
459 { AHLT_VCMX_802_6, "802.6" },
460 { AHLT_VCMX_FRAGMENTS, "Fragments" },
461 { AHLT_VCMX_BPDU, "BPDU" },
465 /* Traffic subtypes for LANE traffic */
466 static const value_string lane_type_vals[] = {
467 { AHLT_UNKNOWN, "Unknown LANE traffic type" },
468 { AHLT_LANE_LE_CTRL, "LE Control" },
469 { AHLT_LANE_802_3, "802.3" },
470 { AHLT_LANE_802_5, "802.5" },
471 { AHLT_LANE_802_3_MC, "802.3 multicast" },
472 { AHLT_LANE_802_5_MC, "802.5 multicast" },
476 /* Traffic subtypes for Ipsilon traffic */
477 static const value_string ipsilon_type_vals[] = {
478 { AHLT_UNKNOWN, "Unknown Ipsilon traffic type" },
479 { AHLT_IPSILON_FT0, "Flow type 0" },
480 { AHLT_IPSILON_FT1, "Flow type 1" },
481 { AHLT_IPSILON_FT2, "Flow type 2" },
486 * We don't know what kind of traffic this is; try to guess.
487 * We at least know it's AAL5....
490 atm_guess_content(tvbuff_t *tvb, packet_info *pinfo)
492 guint8 byte0, byte1, byte2;
494 if (pinfo->pseudo_header->ngsniffer_atm.Vpi == 0) {
496 * Traffic on some PVCs with a VPI of 0 and certain
497 * VCIs is of particular types.
499 switch (pinfo->pseudo_header->ngsniffer_atm.Vci) {
505 pinfo->pseudo_header->ngsniffer_atm.AppTrafType =
513 pinfo->pseudo_header->ngsniffer_atm.AppTrafType |=
520 * OK, we can't tell what it is based on the VPI/VCI; try
521 * guessing based on the contents.
523 byte0 = tvb_get_guint8(tvb, 0);
524 byte1 = tvb_get_guint8(tvb, 1);
525 byte2 = tvb_get_guint8(tvb, 2);
526 if (byte0 == 0xaa && byte1 == 0xaa && byte2 == 0x03) {
528 * Looks like a SNAP header; assume it's LLC multiplexed
531 pinfo->pseudo_header->ngsniffer_atm.AppTrafType |= ATT_HL_LLCMX;
536 pinfo->pseudo_header->ngsniffer_atm.AppTrafType |= ATT_HL_LANE;
537 if (byte0 == 0xff && byte1 == 0x00) {
539 * Looks like LE Control traffic.
541 pinfo->pseudo_header->ngsniffer_atm.AppHLType =
545 * XXX - Ethernet, or Token Ring?
546 * Assume Ethernet for now; if we see earlier
547 * LANE traffic, we may be able to figure out
548 * the traffic type from that, but there may
549 * still be situations where the user has to
552 pinfo->pseudo_header->ngsniffer_atm.AppHLType =
559 dissect_atm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
561 proto_tree *atm_tree;
568 CHECK_DISPLAY_AS_DATA(proto_atm, tvb, pinfo, tree);
570 pinfo->current_proto = "ATM";
572 aal_type = pinfo->pseudo_header->ngsniffer_atm.AppTrafType & ATT_AALTYPE;
573 hl_type = pinfo->pseudo_header->ngsniffer_atm.AppTrafType & ATT_HLTYPE;
574 if (aal_type == ATT_AAL5) {
575 if (hl_type == ATT_HL_UNKNOWN ||
576 pinfo->pseudo_header->ngsniffer_atm.AppHLType == AHLT_UNKNOWN) {
578 * The joys of a connection-oriented link layer; the type of
579 * traffic may be implied by the connection on which it's
580 * traveling, rather than being specified in the packet itself.
582 * For this packet, the program that captured the packet didn't
583 * save the type of traffic, presumably because it didn't know
584 * the traffic type (either it didn't see the connection setup
585 * and wasn't running on one of the endpoints, and wasn't later
586 * told, e.g. by the human running it, what type of traffic was
587 * on that circuit, or was running on one of the endpoints but
588 * was using, to capture the packets, a mechanism that either
589 * doesn't have access to data saying what's going over the
590 * connection or doesn't bother providing that information).
592 * For now, we try to guess the traffic type based on the VPI/VCI
593 * or the packet header; later, we should provide a mechanism
594 * by which the user can specify what sort of traffic is on a
595 * particular circuit.
597 atm_guess_content(tvb, pinfo);
600 * OK, now get the AAL type and high-layer type again.
602 aal_type = pinfo->pseudo_header->ngsniffer_atm.AppTrafType & ATT_AALTYPE;
603 hl_type = pinfo->pseudo_header->ngsniffer_atm.AppTrafType & ATT_HLTYPE;
607 if (check_col(pinfo->fd, COL_PROTOCOL))
608 col_set_str(pinfo->fd, COL_PROTOCOL, "ATM");
610 switch (pinfo->pseudo_header->ngsniffer_atm.channel) {
613 /* Traffic from DCE to DTE. */
614 if (check_col(pinfo->fd, COL_RES_DL_DST))
615 col_set_str(pinfo->fd, COL_RES_DL_DST, "DTE");
616 if (check_col(pinfo->fd, COL_RES_DL_SRC))
617 col_set_str(pinfo->fd, COL_RES_DL_SRC, "DCE");
621 /* Traffic from DTE to DCE. */
622 if (check_col(pinfo->fd, COL_RES_DL_DST))
623 col_set_str(pinfo->fd, COL_RES_DL_DST, "DCE");
624 if (check_col(pinfo->fd, COL_RES_DL_SRC))
625 col_set_str(pinfo->fd, COL_RES_DL_SRC, "DTE");
629 if (check_col(pinfo->fd, COL_INFO)) {
630 if (aal_type == ATT_AAL5) {
631 col_add_fstr(pinfo->fd, COL_INFO, "AAL5 %s",
632 val_to_str(hl_type, aal5_hltype_vals,
633 "Unknown traffic type (%x)"));
635 col_add_str(pinfo->fd, COL_INFO,
636 val_to_str(aal_type, aal_vals, "Unknown AAL (%x)"));
641 ti = proto_tree_add_protocol_format(tree, proto_atm, tvb, 0, 0, "ATM");
642 atm_tree = proto_item_add_subtree(ti, ett_atm);
644 proto_tree_add_text(atm_tree, tvb, 0, 0, "AAL: %s",
645 val_to_str(aal_type, aal_vals, "Unknown AAL (%x)"));
646 if (aal_type == ATT_AAL5) {
647 proto_tree_add_text(atm_tree, tvb, 0, 0, "Traffic type: %s",
648 val_to_str(hl_type, aal5_hltype_vals, "Unknown AAL5 traffic type (%x)"));
652 proto_tree_add_text(atm_tree, tvb, 0, 0, "LLC multiplexed traffic");
656 proto_tree_add_text(atm_tree, tvb, 0, 0, "VC multiplexed traffic type: %s",
657 val_to_str(pinfo->pseudo_header->ngsniffer_atm.AppHLType,
658 vcmx_type_vals, "Unknown VCMX traffic type (%x)"));
662 proto_tree_add_text(atm_tree, tvb, 0, 0, "LANE traffic type: %s",
663 val_to_str(pinfo->pseudo_header->ngsniffer_atm.AppHLType,
664 lane_type_vals, "Unknown LANE traffic type (%x)"));
668 proto_tree_add_text(atm_tree, tvb, 0, 0, "Ipsilon traffic type: %s",
669 val_to_str(pinfo->pseudo_header->ngsniffer_atm.AppHLType,
670 ipsilon_type_vals, "Unknown Ipsilon traffic type (%x)"));
674 proto_tree_add_uint(atm_tree, hf_atm_vpi, tvb, 0, 0,
675 pinfo->pseudo_header->ngsniffer_atm.Vpi);
676 proto_tree_add_uint(atm_tree, hf_atm_vci, tvb, 0, 0,
677 pinfo->pseudo_header->ngsniffer_atm.Vci);
678 switch (pinfo->pseudo_header->ngsniffer_atm.channel) {
681 /* Traffic from DCE to DTE. */
682 proto_tree_add_text(atm_tree, tvb, 0, 0, "Channel: DCE->DTE");
686 /* Traffic from DTE to DCE. */
687 proto_tree_add_text(atm_tree, tvb, 0, 0, "Channel: DTE->DCE");
691 /* Sniffers shouldn't provide anything other than 0 or 1. */
692 proto_tree_add_text(atm_tree, tvb, 0, 0, "Channel: %u",
693 pinfo->pseudo_header->ngsniffer_atm.channel);
696 if (pinfo->pseudo_header->ngsniffer_atm.cells != 0) {
698 * If the cell count is 0, assume it means we don't know how
701 * XXX - also, if this is AAL5 traffic, assume it means we don't
702 * know what was in the AAL5 trailer. We may, however, find
703 * some capture program that can give us the AAL5 trailer
704 * information but not the cell count, in which case we need
705 * some other way of indicating whether we have the AAL5 trailer
708 proto_tree_add_text(atm_tree, tvb, 0, 0, "Cells: %u",
709 pinfo->pseudo_header->ngsniffer_atm.cells);
710 if (aal_type == ATT_AAL5) {
711 proto_tree_add_text(atm_tree, tvb, 0, 0, "AAL5 U2U: %u",
712 pinfo->pseudo_header->ngsniffer_atm.aal5t_u2u);
713 proto_tree_add_text(atm_tree, tvb, 0, 0, "AAL5 len: %u",
714 pinfo->pseudo_header->ngsniffer_atm.aal5t_len);
715 proto_tree_add_text(atm_tree, tvb, 0, 0, "AAL5 checksum: 0x%08X",
716 pinfo->pseudo_header->ngsniffer_atm.aal5t_chksum);
723 case ATT_AAL_SIGNALLING:
724 dissect_sscop(tvb, pinfo, tree);
731 /* Dissect as WTAP_ENCAP_ATM_RFC1483 */
732 /* The ATM iptrace capture that we have shows LLC at this point,
733 * so that's what I'm calling */
734 dissect_llc(tvb, &pi, tree);
738 dissect_lane(tvb, pinfo, tree);
742 CHECK_DISPLAY_AS_DATA(proto_ilmi, tvb, pinfo, tree);
743 tvb_compat(tvb, &pd, &offset);
744 dissect_snmp_pdu(pd, offset, pinfo->fd, tree, "ILMI", proto_ilmi, ett_ilmi);
749 /* Dump it as raw data. */
750 dissect_data(tvb, 0, pinfo, tree);
758 /* Dump it as raw data. (Is this a single cell?) */
759 dissect_data(tvb, 0, pinfo, tree);
766 proto_register_atm(void)
768 static hf_register_info hf[] = {
770 { "VPI", "atm.vpi", FT_UINT8, BASE_DEC, NULL, 0x0,
774 { "VCI", "atm.vci", FT_UINT16, BASE_DEC, NULL, 0x0,
777 static gint *ett[] = {
781 &ett_atm_lane_lc_lan_dest,
782 &ett_atm_lane_lc_lan_dest_rd,
783 &ett_atm_lane_lc_flags,
784 &ett_atm_lane_lc_tlv,
786 proto_atm = proto_register_protocol("ATM", "atm");
787 proto_register_field_array(proto_atm, hf, array_length(hf));
788 proto_ilmi = proto_register_protocol("ILMI", "ilmi");
789 proto_atm_lane = proto_register_protocol("ATM LANE", "lane");
790 proto_register_subtree_array(ett, array_length(ett));
794 proto_reg_handoff_atm(void)
796 dissector_add("wtap_encap", WTAP_ENCAP_ATM_SNIFFER, dissect_atm);