2 * Routines for ATM packet disassembly
4 * $Id: packet-atm.c,v 1.32 2001/01/21 20:16:01 guy 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-snmp.h"
41 #include "packet-sscop.h"
43 static int proto_atm = -1;
44 static int hf_atm_vpi = -1;
45 static int hf_atm_vci = -1;
46 static int proto_atm_lane = -1;
47 static int proto_ilmi = -1;
49 static gint ett_atm = -1;
50 static gint ett_atm_lane = -1;
51 static gint ett_atm_lane_lc_lan_dest = -1;
52 static gint ett_atm_lane_lc_lan_dest_rd = -1;
53 static gint ett_atm_lane_lc_flags = -1;
54 static gint ett_atm_lane_lc_tlv = -1;
55 static gint ett_ilmi = -1;
57 static dissector_handle_t eth_handle;
58 static dissector_handle_t tr_handle;
59 static dissector_handle_t llc_handle;
64 * http://www.atmforum.org/atmforum/specs/approved.html
66 * for a number of ATM Forum specifications, e.g. the LAN Emulation
67 * over ATM 1.0 spec, whence I got most of this.
70 /* LE Control opcodes */
71 #define LE_CONFIGURE_REQUEST 0x0001
72 #define LE_CONFIGURE_RESPONSE 0x0101
73 #define LE_JOIN_REQUEST 0x0002
74 #define LE_JOIN_RESPONSE 0x0102
75 #define READY_QUERY 0x0003
76 #define READY_IND 0x0103
77 #define LE_REGISTER_REQUEST 0x0004
78 #define LE_REGISTER_RESPONSE 0x0104
79 #define LE_UNREGISTER_REQUEST 0x0005
80 #define LE_UNREGISTER_RESPONSE 0x0105
81 #define LE_ARP_REQUEST 0x0006
82 #define LE_ARP_RESPONSE 0x0106
83 #define LE_FLUSH_REQUEST 0x0007
84 #define LE_FLUSH_RESPONSE 0x0107
85 #define LE_NARP_REQUEST 0x0008
86 #define LE_TOPOLOGY_REQUEST 0x0009
88 static const value_string le_control_opcode_vals[] = {
89 { LE_CONFIGURE_REQUEST, "LE_CONFIGURE_REQUEST" },
90 { LE_CONFIGURE_RESPONSE, "LE_CONFIGURE_RESPONSE" },
91 { LE_JOIN_REQUEST, "LE_JOIN_REQUEST" },
92 { LE_JOIN_RESPONSE, "LE_JOIN_RESPONSE" },
93 { READY_QUERY, "READY_QUERY" },
94 { READY_IND, "READY_IND" },
95 { LE_REGISTER_REQUEST, "LE_REGISTER_REQUEST" },
96 { LE_REGISTER_RESPONSE, "LE_REGISTER_RESPONSE" },
97 { LE_UNREGISTER_REQUEST, "LE_UNREGISTER_REQUEST" },
98 { LE_UNREGISTER_RESPONSE, "LE_UNREGISTER_RESPONSE" },
99 { LE_ARP_REQUEST, "LE_ARP_REQUEST" },
100 { LE_ARP_RESPONSE, "LE_ARP_RESPONSE" },
101 { LE_FLUSH_REQUEST, "LE_FLUSH_REQUEST" },
102 { LE_FLUSH_RESPONSE, "LE_FLUSH_RESPONSE" },
103 { LE_NARP_REQUEST, "LE_NARP_REQUEST" },
104 { LE_TOPOLOGY_REQUEST, "LE_TOPOLOGY_REQUEST" },
108 /* LE Control statuses */
109 static const value_string le_control_status_vals[] = {
111 { 1, "Version not supported" },
112 { 2, "Invalid request parameters" },
113 { 4, "Duplicate LAN destination registration" },
114 { 5, "Duplicate ATM address" },
115 { 6, "Insufficient resources to grant request" },
116 { 7, "Access denied" },
117 { 8, "Invalid REQUESTOR-ID" },
118 { 9, "Invalid LAN destination" },
119 { 10, "Invalid ATM address" },
120 { 20, "No configuraton" },
121 { 21, "LE_CONFIGURE error" },
122 { 22, "Insufficient information" },
126 /* LE Control LAN destination tags */
127 #define TAG_NOT_PRESENT 0x0000
128 #define TAG_MAC_ADDRESS 0x0001
129 #define TAG_ROUTE_DESCRIPTOR 0x0002
131 static const value_string le_control_landest_tag_vals[] = {
132 { TAG_NOT_PRESENT, "Not present" },
133 { TAG_MAC_ADDRESS, "MAC address" },
134 { TAG_ROUTE_DESCRIPTOR, "Route descriptor" },
138 /* LE Control LAN types */
139 #define LANT_UNSPEC 0x00
140 #define LANT_802_3 0x01
141 #define LANT_802_5 0x02
143 static const value_string le_control_lan_type_vals[] = {
144 { LANT_UNSPEC, "Unspecified" },
145 { LANT_802_3, "Ethernet/802.3" },
146 { LANT_802_5, "802.5" },
151 dissect_le_client(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
154 proto_tree *lane_tree;
157 ti = proto_tree_add_protocol_format(tree, proto_atm_lane, tvb, 0, 2, "ATM LANE");
158 lane_tree = proto_item_add_subtree(ti, ett_atm_lane);
160 proto_tree_add_text(lane_tree, tvb, 0, 2, "LE Client: 0x%04X",
161 tvb_get_ntohs(tvb, 0));
166 dissect_lan_destination(tvbuff_t *tvb, int offset, const char *type, proto_tree *tree)
169 proto_tree *dest_tree;
173 guint16 route_descriptor;
175 td = proto_tree_add_text(tree, tvb, offset, 8, "%s LAN destination",
177 dest_tree = proto_item_add_subtree(td, ett_atm_lane_lc_lan_dest);
178 tag = tvb_get_ntohs(tvb, offset);
179 proto_tree_add_text(dest_tree, tvb, offset, 2, "Tag: %s",
180 val_to_str(tag, le_control_landest_tag_vals,
181 "Unknown (0x%04X)"));
186 case TAG_MAC_ADDRESS:
187 proto_tree_add_text(dest_tree, tvb, offset, 6, "MAC address: %s",
188 ether_to_str(tvb_get_ptr(tvb, offset, 6)));
191 case TAG_ROUTE_DESCRIPTOR:
193 route_descriptor = tvb_get_ntohs(tvb, offset);
194 trd = proto_tree_add_text(dest_tree, tvb, offset, 2, "Route descriptor: 0x%02X",
196 rd_tree = proto_item_add_subtree(td, ett_atm_lane_lc_lan_dest_rd);
197 proto_tree_add_text(rd_tree, tvb, offset, 2,
198 decode_numeric_bitfield(route_descriptor, 0xFFF0, 2*8,
200 proto_tree_add_text(rd_tree, tvb, offset, 2,
201 decode_numeric_bitfield(route_descriptor, 0x000F, 2*8,
202 "Bridge number = %u"));
208 * TLV values in LE Control frames.
210 #define TLV_TYPE(oui, ident) (((oui) << 8) | (ident))
212 #define LE_CONTROL_TIMEOUT TLV_TYPE(OUI_ATM_FORUM, 0x01)
213 #define LE_MAX_UNK_FRAME_COUNT TLV_TYPE(OUI_ATM_FORUM, 0x02)
214 #define LE_MAX_UNK_FRAME_TIME TLV_TYPE(OUI_ATM_FORUM, 0x03)
215 #define LE_VCC_TIMEOUT_PERIOD TLV_TYPE(OUI_ATM_FORUM, 0x04)
216 #define LE_MAX_RETRY_COUNT TLV_TYPE(OUI_ATM_FORUM, 0x05)
217 #define LE_AGING_TIME TLV_TYPE(OUI_ATM_FORUM, 0x06)
218 #define LE_FORWARD_DELAY_TIME TLV_TYPE(OUI_ATM_FORUM, 0x07)
219 #define LE_EXPECTED_ARP_RESPONSE_TIME TLV_TYPE(OUI_ATM_FORUM, 0x08)
220 #define LE_FLUSH_TIMEOUT TLV_TYPE(OUI_ATM_FORUM, 0x09)
221 #define LE_PATH_SWITCHING_DELAY TLV_TYPE(OUI_ATM_FORUM, 0x0A)
222 #define LE_LOCAL_SEGMENT_ID TLV_TYPE(OUI_ATM_FORUM, 0x0B)
223 #define LE_MCAST_SEND_VCC_TYPE TLV_TYPE(OUI_ATM_FORUM, 0x0C)
224 #define LE_MCAST_SEND_VCC_AVGRATE TLV_TYPE(OUI_ATM_FORUM, 0x0D)
225 #define LE_MCAST_SEND_VCC_PEAKRATE TLV_TYPE(OUI_ATM_FORUM, 0x0E)
226 #define LE_CONN_COMPLETION_TIMER TLV_TYPE(OUI_ATM_FORUM, 0x0F)
228 static const value_string le_tlv_type_vals[] = {
229 { LE_CONTROL_TIMEOUT, "Control Time-out" },
230 { LE_MAX_UNK_FRAME_COUNT, "Maximum Unknown Frame Count" },
231 { LE_MAX_UNK_FRAME_TIME, "Maximum Unknown Frame Time" },
232 { LE_VCC_TIMEOUT_PERIOD, "VCC Time-out" },
233 { LE_MAX_RETRY_COUNT, "Maximum Retry Count" },
234 { LE_AGING_TIME, "Aging Time" },
235 { LE_FORWARD_DELAY_TIME, "Forwarding Delay Time" },
236 { LE_EXPECTED_ARP_RESPONSE_TIME, "Expected LE_ARP Response Time" },
237 { LE_FLUSH_TIMEOUT, "Flush Time-out" },
238 { LE_PATH_SWITCHING_DELAY, "Path Switching Delay" },
239 { LE_LOCAL_SEGMENT_ID, "Local Segment ID" },
240 { LE_MCAST_SEND_VCC_TYPE, "Mcast Send VCC Type" },
241 { LE_MCAST_SEND_VCC_AVGRATE, "Mcast Send VCC AvgRate" },
242 { LE_MCAST_SEND_VCC_PEAKRATE, "Mcast Send VCC PeakRate" },
243 { LE_CONN_COMPLETION_TIMER, "Connection Completion Timer" },
248 dissect_le_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
251 proto_tree *lane_tree;
254 proto_tree *flags_tree;
256 proto_tree *tlv_tree;
263 if (check_col(pinfo->fd, COL_INFO))
264 col_set_str(pinfo->fd, COL_INFO, "LE Control");
267 ti = proto_tree_add_protocol_format(tree, proto_atm_lane, tvb, offset, 108, "ATM LANE");
268 lane_tree = proto_item_add_subtree(ti, ett_atm_lane);
270 proto_tree_add_text(lane_tree, tvb, offset, 2, "Marker: 0x%04X",
271 tvb_get_ntohs(tvb, offset));
274 proto_tree_add_text(lane_tree, tvb, offset, 1, "Protocol: 0x%02X",
275 tvb_get_guint8(tvb, offset));
278 proto_tree_add_text(lane_tree, tvb, offset, 1, "Version: 0x%02X",
279 tvb_get_guint8(tvb, offset));
282 opcode = tvb_get_ntohs(tvb, offset);
283 proto_tree_add_text(lane_tree, tvb, offset, 2, "Opcode: %s",
284 val_to_str(opcode, le_control_opcode_vals,
285 "Unknown (0x%04X)"));
288 if (opcode == READY_QUERY || opcode == READY_IND) {
289 /* There's nothing more in this packet. */
293 if (opcode & 0x0100) {
294 /* Response; decode status. */
295 proto_tree_add_text(lane_tree, tvb, offset, 2, "Status: %s",
296 val_to_str(tvb_get_ntohs(tvb, offset), le_control_status_vals,
297 "Unknown (0x%04X)"));
301 proto_tree_add_text(lane_tree, tvb, offset, 4, "Transaction ID: 0x%08X",
302 tvb_get_ntohl(tvb, offset));
305 proto_tree_add_text(lane_tree, tvb, offset, 2, "Requester LECID: 0x%04X",
306 tvb_get_ntohs(tvb, offset));
309 flags = tvb_get_ntohs(tvb, offset);
310 tf = proto_tree_add_text(lane_tree, tvb, offset, 2, "Flags: 0x%04X",
312 flags_tree = proto_item_add_subtree(tf, ett_atm_lane_lc_flags);
313 proto_tree_add_text(flags_tree, tvb, offset, 2, "%s",
314 decode_boolean_bitfield(flags, 0x0001, 8*2,
315 "Remote address", "Local address"));
316 proto_tree_add_text(flags_tree, tvb, offset, 2, "%s",
317 decode_boolean_bitfield(flags, 0x0080, 8*2,
318 "Proxy", "Not proxy"));
319 proto_tree_add_text(flags_tree, tvb, offset, 2, "%s",
320 decode_boolean_bitfield(flags, 0x0100, 8*2,
321 "Topology change", "No topology change"));
324 dissect_lan_destination(tvb, offset, "Source", lane_tree);
327 dissect_lan_destination(tvb, offset, "Target", lane_tree);
330 proto_tree_add_text(lane_tree, tvb, offset, 20, "Source ATM Address: %s",
331 tvb_bytes_to_str(tvb, offset, 20));
334 proto_tree_add_text(lane_tree, tvb, offset, 1, "LAN type: %s",
335 val_to_str(tvb_get_guint8(tvb, offset), le_control_lan_type_vals,
336 "Unknown (0x%02X)"));
339 proto_tree_add_text(lane_tree, tvb, offset, 1, "Maximum frame size: %u",
340 tvb_get_guint8(tvb, offset));
343 num_tlvs = tvb_get_guint8(tvb, offset);
344 proto_tree_add_text(lane_tree, tvb, offset, 1, "Number of TLVs: %u",
348 proto_tree_add_text(lane_tree, tvb, offset, 1, "ELAN name size: %u",
349 tvb_get_guint8(tvb, offset));
352 proto_tree_add_text(lane_tree, tvb, offset, 20, "Target ATM Address: %s",
353 tvb_bytes_to_str(tvb, offset, 20));
356 proto_tree_add_text(lane_tree, tvb, offset, 32, "ELAN name: %s",
357 tvb_bytes_to_str(tvb, offset, 32));
360 while (num_tlvs != 0) {
361 tlv_type = tvb_get_ntohl(tvb, offset);
362 tlv_length = tvb_get_guint8(tvb, offset+4);
363 ttlv = proto_tree_add_text(lane_tree, tvb, offset, 5+tlv_length, "TLV type: %s",
364 val_to_str(tlv_type, le_tlv_type_vals, "Unknown (0x%08x)"));
365 tlv_tree = proto_item_add_subtree(ttlv, ett_atm_lane_lc_tlv);
366 proto_tree_add_text(tlv_tree, tvb, offset, 4, "TLV Type: %s",
367 val_to_str(tlv_type, le_tlv_type_vals, "Unknown (0x%08x)"));
368 proto_tree_add_text(tlv_tree, tvb, offset+4, 1, "TLV Length: %u", tlv_length);
369 offset += 5+tlv_length;
376 dissect_lane(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
379 tvbuff_t *next_tvb_le_client;
381 CHECK_DISPLAY_AS_DATA(proto_atm_lane, tvb, pinfo, tree);
383 pinfo->current_proto = "ATM LANE";
385 if (check_col(pinfo->fd, COL_PROTOCOL))
386 col_set_str(pinfo->fd, COL_PROTOCOL, "ATM LANE");
387 if (check_col(pinfo->fd, COL_INFO))
388 col_set_str(pinfo->fd, COL_INFO, "ATM LANE");
390 /* Is it LE Control, 802.3, 802.5, or "none of the above"? */
391 switch (pinfo->pseudo_header->ngsniffer_atm.AppHLType) {
393 case AHLT_LANE_LE_CTRL:
394 dissect_le_control(tvb, pinfo, tree);
397 case AHLT_LANE_802_3:
398 case AHLT_LANE_802_3_MC:
399 dissect_le_client(tvb, pinfo, tree);
401 /* Dissect as Ethernet */
402 next_tvb_le_client = tvb_new_subset(tvb, 2, -1, -1);
403 call_dissector(eth_handle, next_tvb_le_client, pinfo, tree);
406 case AHLT_LANE_802_5:
407 case AHLT_LANE_802_5_MC:
408 dissect_le_client(tvb, pinfo, tree);
410 /* Dissect as Token-Ring */
411 next_tvb_le_client = tvb_new_subset(tvb, 2, -1, -1);
412 call_dissector(tr_handle, next_tvb_le_client, pinfo, tree);
416 /* Dump it as raw data. */
417 next_tvb = tvb_new_subset(tvb, 0, -1, -1);
418 dissect_data(next_tvb, 0, pinfo, tree);
424 static const value_string aal_vals[] = {
425 { ATT_AAL_UNKNOWN, "Unknown AAL" },
426 { ATT_AAL1, "AAL1" },
427 { ATT_AAL3_4, "AAL3/4" },
428 { ATT_AAL5, "AAL5" },
429 { ATT_AAL_USER, "User AAL" },
430 { ATT_AAL_SIGNALLING, "Signalling AAL" },
431 { ATT_OAMCELL, "OAM cell" },
435 /* AAL5 higher-level traffic types */
436 static const value_string aal5_hltype_vals[] = {
437 { ATT_HL_UNKNOWN, "Unknown traffic type" },
438 { ATT_HL_LLCMX, "LLC multiplexed" },
439 { ATT_HL_VCMX, "VC multiplexed" },
440 { ATT_HL_LANE, "LANE" },
441 { ATT_HL_ILMI, "ILMI" },
442 { ATT_HL_FRMR, "Frame Relay" },
443 { ATT_HL_SPANS, "FORE SPANS" },
444 { ATT_HL_IPSILON, "Ipsilon" },
448 /* Traffic subtypes for VC multiplexed traffic */
449 static const value_string vcmx_type_vals[] = {
450 { AHLT_UNKNOWN, "Unknown VC multiplexed traffic type" },
451 { AHLT_VCMX_802_3_FCS, "802.3 FCS" },
452 { AHLT_VCMX_802_4_FCS, "802.4 FCS" },
453 { AHLT_VCMX_802_5_FCS, "802.5 FCS" },
454 { AHLT_VCMX_FDDI_FCS, "FDDI FCS" },
455 { AHLT_VCMX_802_6_FCS, "802.6 FCS" },
456 { AHLT_VCMX_802_3, "802.3" },
457 { AHLT_VCMX_802_4, "802.4" },
458 { AHLT_VCMX_802_5, "802.5" },
459 { AHLT_VCMX_FDDI, "FDDI" },
460 { AHLT_VCMX_802_6, "802.6" },
461 { AHLT_VCMX_FRAGMENTS, "Fragments" },
462 { AHLT_VCMX_BPDU, "BPDU" },
466 /* Traffic subtypes for LANE traffic */
467 static const value_string lane_type_vals[] = {
468 { AHLT_UNKNOWN, "Unknown LANE traffic type" },
469 { AHLT_LANE_LE_CTRL, "LE Control" },
470 { AHLT_LANE_802_3, "802.3" },
471 { AHLT_LANE_802_5, "802.5" },
472 { AHLT_LANE_802_3_MC, "802.3 multicast" },
473 { AHLT_LANE_802_5_MC, "802.5 multicast" },
477 /* Traffic subtypes for Ipsilon traffic */
478 static const value_string ipsilon_type_vals[] = {
479 { AHLT_UNKNOWN, "Unknown Ipsilon traffic type" },
480 { AHLT_IPSILON_FT0, "Flow type 0" },
481 { AHLT_IPSILON_FT1, "Flow type 1" },
482 { AHLT_IPSILON_FT2, "Flow type 2" },
487 * We don't know what kind of traffic this is; try to guess.
488 * We at least know it's AAL5....
491 atm_guess_content(tvbuff_t *tvb, packet_info *pinfo)
493 guint8 byte0, byte1, byte2;
495 if (pinfo->pseudo_header->ngsniffer_atm.Vpi == 0) {
497 * Traffic on some PVCs with a VPI of 0 and certain
498 * VCIs is of particular types.
500 switch (pinfo->pseudo_header->ngsniffer_atm.Vci) {
506 pinfo->pseudo_header->ngsniffer_atm.AppTrafType =
514 pinfo->pseudo_header->ngsniffer_atm.AppTrafType |=
521 * OK, we can't tell what it is based on the VPI/VCI; try
522 * guessing based on the contents.
524 byte0 = tvb_get_guint8(tvb, 0);
525 byte1 = tvb_get_guint8(tvb, 1);
526 byte2 = tvb_get_guint8(tvb, 2);
527 if (byte0 == 0xaa && byte1 == 0xaa && byte2 == 0x03) {
529 * Looks like a SNAP header; assume it's LLC multiplexed
532 pinfo->pseudo_header->ngsniffer_atm.AppTrafType |= ATT_HL_LLCMX;
537 pinfo->pseudo_header->ngsniffer_atm.AppTrafType |= ATT_HL_LANE;
538 if (byte0 == 0xff && byte1 == 0x00) {
540 * Looks like LE Control traffic.
542 pinfo->pseudo_header->ngsniffer_atm.AppHLType =
546 * XXX - Ethernet, or Token Ring?
547 * Assume Ethernet for now; if we see earlier
548 * LANE traffic, we may be able to figure out
549 * the traffic type from that, but there may
550 * still be situations where the user has to
553 pinfo->pseudo_header->ngsniffer_atm.AppHLType =
560 dissect_atm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
562 proto_tree *atm_tree;
569 CHECK_DISPLAY_AS_DATA(proto_atm, tvb, pinfo, tree);
571 pinfo->current_proto = "ATM";
573 aal_type = pinfo->pseudo_header->ngsniffer_atm.AppTrafType & ATT_AALTYPE;
574 hl_type = pinfo->pseudo_header->ngsniffer_atm.AppTrafType & ATT_HLTYPE;
575 if (aal_type == ATT_AAL5) {
576 if (hl_type == ATT_HL_UNKNOWN ||
577 pinfo->pseudo_header->ngsniffer_atm.AppHLType == AHLT_UNKNOWN) {
579 * The joys of a connection-oriented link layer; the type of
580 * traffic may be implied by the connection on which it's
581 * traveling, rather than being specified in the packet itself.
583 * For this packet, the program that captured the packet didn't
584 * save the type of traffic, presumably because it didn't know
585 * the traffic type (either it didn't see the connection setup
586 * and wasn't running on one of the endpoints, and wasn't later
587 * told, e.g. by the human running it, what type of traffic was
588 * on that circuit, or was running on one of the endpoints but
589 * was using, to capture the packets, a mechanism that either
590 * doesn't have access to data saying what's going over the
591 * connection or doesn't bother providing that information).
593 * For now, we try to guess the traffic type based on the VPI/VCI
594 * or the packet header; later, we should provide a mechanism
595 * by which the user can specify what sort of traffic is on a
596 * particular circuit.
598 atm_guess_content(tvb, pinfo);
601 * OK, now get the AAL type and high-layer type again.
603 aal_type = pinfo->pseudo_header->ngsniffer_atm.AppTrafType & ATT_AALTYPE;
604 hl_type = pinfo->pseudo_header->ngsniffer_atm.AppTrafType & ATT_HLTYPE;
608 if (check_col(pinfo->fd, COL_PROTOCOL))
609 col_set_str(pinfo->fd, COL_PROTOCOL, "ATM");
611 switch (pinfo->pseudo_header->ngsniffer_atm.channel) {
614 /* Traffic from DCE to DTE. */
615 if (check_col(pinfo->fd, COL_RES_DL_DST))
616 col_set_str(pinfo->fd, COL_RES_DL_DST, "DTE");
617 if (check_col(pinfo->fd, COL_RES_DL_SRC))
618 col_set_str(pinfo->fd, COL_RES_DL_SRC, "DCE");
622 /* Traffic from DTE to DCE. */
623 if (check_col(pinfo->fd, COL_RES_DL_DST))
624 col_set_str(pinfo->fd, COL_RES_DL_DST, "DCE");
625 if (check_col(pinfo->fd, COL_RES_DL_SRC))
626 col_set_str(pinfo->fd, COL_RES_DL_SRC, "DTE");
630 if (check_col(pinfo->fd, COL_INFO)) {
631 if (aal_type == ATT_AAL5) {
632 col_add_fstr(pinfo->fd, COL_INFO, "AAL5 %s",
633 val_to_str(hl_type, aal5_hltype_vals,
634 "Unknown traffic type (%x)"));
636 col_add_str(pinfo->fd, COL_INFO,
637 val_to_str(aal_type, aal_vals, "Unknown AAL (%x)"));
642 ti = proto_tree_add_protocol_format(tree, proto_atm, tvb, 0, 0, "ATM");
643 atm_tree = proto_item_add_subtree(ti, ett_atm);
645 proto_tree_add_text(atm_tree, tvb, 0, 0, "AAL: %s",
646 val_to_str(aal_type, aal_vals, "Unknown AAL (%x)"));
647 if (aal_type == ATT_AAL5) {
648 proto_tree_add_text(atm_tree, tvb, 0, 0, "Traffic type: %s",
649 val_to_str(hl_type, aal5_hltype_vals, "Unknown AAL5 traffic type (%x)"));
653 proto_tree_add_text(atm_tree, tvb, 0, 0, "LLC multiplexed traffic");
657 proto_tree_add_text(atm_tree, tvb, 0, 0, "VC multiplexed traffic type: %s",
658 val_to_str(pinfo->pseudo_header->ngsniffer_atm.AppHLType,
659 vcmx_type_vals, "Unknown VCMX traffic type (%x)"));
663 proto_tree_add_text(atm_tree, tvb, 0, 0, "LANE traffic type: %s",
664 val_to_str(pinfo->pseudo_header->ngsniffer_atm.AppHLType,
665 lane_type_vals, "Unknown LANE traffic type (%x)"));
669 proto_tree_add_text(atm_tree, tvb, 0, 0, "Ipsilon traffic type: %s",
670 val_to_str(pinfo->pseudo_header->ngsniffer_atm.AppHLType,
671 ipsilon_type_vals, "Unknown Ipsilon traffic type (%x)"));
675 proto_tree_add_uint(atm_tree, hf_atm_vpi, tvb, 0, 0,
676 pinfo->pseudo_header->ngsniffer_atm.Vpi);
677 proto_tree_add_uint(atm_tree, hf_atm_vci, tvb, 0, 0,
678 pinfo->pseudo_header->ngsniffer_atm.Vci);
679 switch (pinfo->pseudo_header->ngsniffer_atm.channel) {
682 /* Traffic from DCE to DTE. */
683 proto_tree_add_text(atm_tree, tvb, 0, 0, "Channel: DCE->DTE");
687 /* Traffic from DTE to DCE. */
688 proto_tree_add_text(atm_tree, tvb, 0, 0, "Channel: DTE->DCE");
692 /* Sniffers shouldn't provide anything other than 0 or 1. */
693 proto_tree_add_text(atm_tree, tvb, 0, 0, "Channel: %u",
694 pinfo->pseudo_header->ngsniffer_atm.channel);
697 if (pinfo->pseudo_header->ngsniffer_atm.cells != 0) {
699 * If the cell count is 0, assume it means we don't know how
702 * XXX - also, if this is AAL5 traffic, assume it means we don't
703 * know what was in the AAL5 trailer. We may, however, find
704 * some capture program that can give us the AAL5 trailer
705 * information but not the cell count, in which case we need
706 * some other way of indicating whether we have the AAL5 trailer
709 proto_tree_add_text(atm_tree, tvb, 0, 0, "Cells: %u",
710 pinfo->pseudo_header->ngsniffer_atm.cells);
711 if (aal_type == ATT_AAL5) {
712 proto_tree_add_text(atm_tree, tvb, 0, 0, "AAL5 U2U: %u",
713 pinfo->pseudo_header->ngsniffer_atm.aal5t_u2u);
714 proto_tree_add_text(atm_tree, tvb, 0, 0, "AAL5 len: %u",
715 pinfo->pseudo_header->ngsniffer_atm.aal5t_len);
716 proto_tree_add_text(atm_tree, tvb, 0, 0, "AAL5 checksum: 0x%08X",
717 pinfo->pseudo_header->ngsniffer_atm.aal5t_chksum);
724 case ATT_AAL_SIGNALLING:
725 dissect_sscop(tvb, pinfo, tree);
732 /* Dissect as WTAP_ENCAP_ATM_RFC1483 */
733 /* The ATM iptrace capture that we have shows LLC at this point,
734 * so that's what I'm calling */
735 call_dissector(llc_handle, tvb, pinfo, tree);
739 dissect_lane(tvb, pinfo, tree);
743 CHECK_DISPLAY_AS_DATA(proto_ilmi, tvb, pinfo, tree);
744 tvb_compat(tvb, &pd, &offset);
745 dissect_snmp_pdu(pd, offset, pinfo->fd, tree, "ILMI", proto_ilmi, ett_ilmi);
750 /* Dump it as raw data. */
751 dissect_data(tvb, 0, pinfo, tree);
759 /* Dump it as raw data. (Is this a single cell?) */
760 dissect_data(tvb, 0, pinfo, tree);
767 proto_register_atm(void)
769 static hf_register_info hf[] = {
771 { "VPI", "atm.vpi", FT_UINT8, BASE_DEC, NULL, 0x0,
775 { "VCI", "atm.vci", FT_UINT16, BASE_DEC, NULL, 0x0,
778 static gint *ett[] = {
782 &ett_atm_lane_lc_lan_dest,
783 &ett_atm_lane_lc_lan_dest_rd,
784 &ett_atm_lane_lc_flags,
785 &ett_atm_lane_lc_tlv,
787 proto_atm = proto_register_protocol("ATM", "ATM", "atm");
788 proto_register_field_array(proto_atm, hf, array_length(hf));
789 proto_ilmi = proto_register_protocol("ILMI", "ILMI", "ilmi");
790 proto_atm_lane = proto_register_protocol("ATM LAN Emulation",
792 proto_register_subtree_array(ett, array_length(ett));
796 proto_reg_handoff_atm(void)
799 * Get handles for the Ethernet, Token Ring, and LLC dissectors.
801 eth_handle = find_dissector("eth");
802 tr_handle = find_dissector("tr");
803 llc_handle = find_dissector("llc");
805 dissector_add("wtap_encap", WTAP_ENCAP_ATM_SNIFFER, dissect_atm,