2 * Routines for ATM packet disassembly
4 * $Id: packet-atm.c,v 1.20 2000/05/19 23:06:08 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-atm.h"
41 #include "packet-eth.h"
42 #include "packet-llc.h"
43 #include "packet-snmp.h"
44 #include "packet-sscop.h"
45 #include "packet-tr.h"
47 static int proto_atm = -1;
48 static int hf_atm_vpi = -1;
49 static int hf_atm_vci = -1;
50 static int proto_atm_lane = -1;
51 static int proto_ilmi = -1;
53 static gint ett_atm = -1;
54 static gint ett_atm_lane = -1;
55 static gint ett_atm_lane_lc_lan_dest = -1;
56 static gint ett_atm_lane_lc_lan_dest_rd = -1;
57 static gint ett_atm_lane_lc_flags = -1;
58 static gint ett_atm_lane_lc_tlv = -1;
59 static gint ett_ilmi = -1;
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(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
154 proto_tree *lane_tree;
157 ti = proto_tree_add_protocol_format(tree, proto_atm_lane, NullTVB, offset, 2, "ATM LANE");
158 lane_tree = proto_item_add_subtree(ti, ett_atm_lane);
160 proto_tree_add_text(lane_tree, NullTVB, offset, 2, "LE Client: 0x%04X",
161 pntohs(&pd[offset]));
166 dissect_lan_destination(const u_char *pd, int offset, const char *type, proto_tree *tree)
169 proto_tree *dest_tree;
173 guint16 route_descriptor;
175 td = proto_tree_add_text(tree, NullTVB, offset, 8, "%s LAN destination",
177 dest_tree = proto_item_add_subtree(td, ett_atm_lane_lc_lan_dest);
178 tag = pntohs(&pd[offset]);
179 proto_tree_add_text(dest_tree, NullTVB, 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, NullTVB, offset, 6, "MAC address: %s",
188 ether_to_str((u_char *)&pd[offset]));
191 case TAG_ROUTE_DESCRIPTOR:
193 route_descriptor = pntohs(&pd[offset]);
194 trd = proto_tree_add_text(dest_tree, NullTVB, 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, NullTVB, offset, 2,
198 decode_numeric_bitfield(route_descriptor, 0xFFF0, 2*8,
200 proto_tree_add_text(rd_tree, NullTVB, 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(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
251 proto_tree *lane_tree;
253 proto_tree *flags_tree;
255 proto_tree *tlv_tree;
262 if (check_col(fd, COL_INFO))
263 col_add_str(fd, COL_INFO, "LE Control");
266 ti = proto_tree_add_protocol_format(tree, proto_atm_lane, NullTVB, offset, 108, "ATM LANE");
267 lane_tree = proto_item_add_subtree(ti, ett_atm_lane);
269 proto_tree_add_text(lane_tree, NullTVB, offset, 2, "Marker: 0x%04X",
270 pntohs(&pd[offset]));
273 proto_tree_add_text(lane_tree, NullTVB, offset, 1, "Protocol: 0x%02X",
277 proto_tree_add_text(lane_tree, NullTVB, offset, 1, "Version: 0x%02X",
281 opcode = pntohs(&pd[offset]);
282 proto_tree_add_text(lane_tree, NullTVB, 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, NullTVB, offset, 2, "Status: %s",
295 val_to_str(pntohs(&pd[offset]), le_control_status_vals,
296 "Unknown (0x%04X)"));
300 proto_tree_add_text(lane_tree, NullTVB, offset, 4, "Transaction ID: 0x%08X",
301 pntohl(&pd[offset]));
304 proto_tree_add_text(lane_tree, NullTVB, offset, 2, "Requester LECID: 0x%04X",
305 pntohs(&pd[offset]));
308 flags = pntohs(&pd[offset]);
309 tf = proto_tree_add_text(lane_tree, NullTVB, offset, 2, "Flags: 0x%04X",
310 pntohs(&pd[offset]));
311 flags_tree = proto_item_add_subtree(tf, ett_atm_lane_lc_flags);
312 proto_tree_add_text(flags_tree, NullTVB, offset, 2, "%s",
313 decode_boolean_bitfield(flags, 0x0001, 8*2,
314 "Remote address", "Local address"));
315 proto_tree_add_text(flags_tree, NullTVB, offset, 2, "%s",
316 decode_boolean_bitfield(flags, 0x0080, 8*2,
317 "Proxy", "Not proxy"));
318 proto_tree_add_text(flags_tree, NullTVB, offset, 2, "%s",
319 decode_boolean_bitfield(flags, 0x0100, 8*2,
320 "Topology change", "No topology change"));
323 dissect_lan_destination(pd, offset, "Source", lane_tree);
326 dissect_lan_destination(pd, offset, "Target", lane_tree);
329 proto_tree_add_text(lane_tree, NullTVB, offset, 20, "Source ATM Address: %s",
330 bytes_to_str(&pd[offset], 20));
333 proto_tree_add_text(lane_tree, NullTVB, offset, 1, "LAN type: %s",
334 val_to_str(pd[offset], le_control_lan_type_vals,
335 "Unknown (0x%02X)"));
338 proto_tree_add_text(lane_tree, NullTVB, offset, 1, "Maximum frame size: %u",
342 num_tlvs = pd[offset];
343 proto_tree_add_text(lane_tree, NullTVB, offset, 1, "Number of TLVs: %u",
347 proto_tree_add_text(lane_tree, NullTVB, offset, 1, "ELAN name size: %u",
351 proto_tree_add_text(lane_tree, NullTVB, offset, 20, "Target ATM Address: %s",
352 bytes_to_str(&pd[offset], 20));
355 proto_tree_add_text(lane_tree, NullTVB, offset, 32, "ELAN name: %s",
356 bytes_to_str(&pd[offset], 32));
359 while (num_tlvs != 0) {
360 tlv_type = pntohl(&pd[offset]);
361 tlv_length = pd[offset+4];
362 ttlv = proto_tree_add_text(lane_tree, NullTVB, 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, NullTVB, 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, NullTVB, offset+4, 1, "TLV Length: %u", tlv_length);
368 offset += 5+tlv_length;
375 dissect_lane(const union wtap_pseudo_header *pseudo_header, const u_char *pd,
376 int offset, frame_data *fd, proto_tree *tree)
379 tvbuff_t *next_tvb_le_client;
382 if (check_col(fd, COL_PROTOCOL))
383 col_add_str(fd, COL_PROTOCOL, "ATM LANE");
384 if (check_col(fd, COL_INFO))
385 col_add_str(fd, COL_INFO, "ATM LANE");
387 /* Is it LE Control, 802.3, 802.5, or "none of the above"? */
388 switch (pseudo_header->ngsniffer_atm.AppHLType) {
390 case AHLT_LANE_LE_CTRL:
391 dissect_le_control(pd, offset, fd, tree);
394 case AHLT_LANE_802_3:
395 case AHLT_LANE_802_3_MC:
396 dissect_le_client(pd, offset, fd, tree);
398 /* Dissect as Ethernet */
399 next_tvb_le_client = tvb_new_subset(pi.compat_top_tvb, offset+2, -1, -1);
400 dissect_eth(next_tvb_le_client, &pi, tree);
403 case AHLT_LANE_802_5:
404 case AHLT_LANE_802_5_MC:
405 dissect_le_client(pd, offset, fd, tree);
407 /* Dissect as Token-Ring */
408 next_tvb_le_client = tvb_new_subset(pi.compat_top_tvb, offset+2, -1, -1);
409 dissect_tr(next_tvb_le_client, &pi, tree);
413 /* Dump it as raw data. */
414 next_tvb = tvb_new_subset(pi.compat_top_tvb, offset, -1, -1);
415 dissect_data_tvb(next_tvb, &pi, tree);
421 static const value_string aal_vals[] = {
422 { ATT_AAL_UNKNOWN, "Unknown AAL" },
423 { ATT_AAL1, "AAL1" },
424 { ATT_AAL3_4, "AAL3/4" },
425 { ATT_AAL5, "AAL5" },
426 { ATT_AAL_USER, "User AAL" },
427 { ATT_AAL_SIGNALLING, "Signalling AAL" },
428 { ATT_OAMCELL, "OAM cell" },
432 /* AAL5 higher-level traffic types */
433 static const value_string aal5_hltype_vals[] = {
434 { ATT_HL_UNKNOWN, "Unknown traffic type" },
435 { ATT_HL_LLCMX, "LLC multiplexed" },
436 { ATT_HL_VCMX, "VC multiplexed" },
437 { ATT_HL_LANE, "LANE" },
438 { ATT_HL_ILMI, "ILMI" },
439 { ATT_HL_FRMR, "Frame Relay" },
440 { ATT_HL_SPANS, "FORE SPANS" },
441 { ATT_HL_IPSILON, "Ipsilon" },
445 /* Traffic subtypes for VC multiplexed traffic */
446 static const value_string vcmx_type_vals[] = {
447 { AHLT_UNKNOWN, "Unknown VC multiplexed traffic type" },
448 { AHLT_VCMX_802_3_FCS, "802.3 FCS" },
449 { AHLT_VCMX_802_4_FCS, "802.4 FCS" },
450 { AHLT_VCMX_802_5_FCS, "802.5 FCS" },
451 { AHLT_VCMX_FDDI_FCS, "FDDI FCS" },
452 { AHLT_VCMX_802_6_FCS, "802.6 FCS" },
453 { AHLT_VCMX_802_3, "802.3" },
454 { AHLT_VCMX_802_4, "802.4" },
455 { AHLT_VCMX_802_5, "802.5" },
456 { AHLT_VCMX_FDDI, "FDDI" },
457 { AHLT_VCMX_802_6, "802.6" },
458 { AHLT_VCMX_FRAGMENTS, "Fragments" },
459 { AHLT_VCMX_BPDU, "BPDU" },
463 /* Traffic subtypes for LANE traffic */
464 static const value_string lane_type_vals[] = {
465 { AHLT_UNKNOWN, "Unknown LANE traffic type" },
466 { AHLT_LANE_LE_CTRL, "LE Control" },
467 { AHLT_LANE_802_3, "802.3" },
468 { AHLT_LANE_802_5, "802.5" },
469 { AHLT_LANE_802_3_MC, "802.3 multicast" },
470 { AHLT_LANE_802_5_MC, "802.5 multicast" },
474 /* Traffic subtypes for Ipsilon traffic */
475 static const value_string ipsilon_type_vals[] = {
476 { AHLT_UNKNOWN, "Unknown Ipsilon traffic type" },
477 { AHLT_IPSILON_FT0, "Flow type 0" },
478 { AHLT_IPSILON_FT1, "Flow type 1" },
479 { AHLT_IPSILON_FT2, "Flow type 2" },
484 * We don't know what kind of traffic this is; try to guess.
485 * We at least know it's AAL5....
488 atm_guess_content(union wtap_pseudo_header *pseudo_header, const u_char *pd,
491 if (pseudo_header->ngsniffer_atm.Vpi == 0) {
493 * Traffic on some PVCs with a VPI of 0 and certain
494 * VCIs is of particular types.
496 switch (pseudo_header->ngsniffer_atm.Vci) {
502 pseudo_header->ngsniffer_atm.AppTrafType =
510 pseudo_header->ngsniffer_atm.AppTrafType |=
517 * OK, we can't tell what it is based on the VPI/VCI; try
518 * guessing based on the contents.
520 if (pd[0] == 0xaa && pd[1] == 0xaa && pd[2] == 0x03) {
522 * Looks like a SNAP header; assume it's LLC multiplexed
525 pseudo_header->ngsniffer_atm.AppTrafType |= ATT_HL_LLCMX;
530 pseudo_header->ngsniffer_atm.AppTrafType |= ATT_HL_LANE;
531 if (pd[0] == 0xff && pd[1] == 0x00) {
533 * Looks like LE Control traffic.
535 pseudo_header->ngsniffer_atm.AppHLType =
539 * XXX - Ethernet, or Token Ring?
540 * Assume Ethernet for now; if we see earlier
541 * LANE traffic, we may be able to figure out
542 * the traffic type from that, but there may
543 * still be situations where the user has to
546 pseudo_header->ngsniffer_atm.AppHLType =
553 dissect_atm(union wtap_pseudo_header *pseudo_header, const u_char *pd,
554 frame_data *fd, proto_tree *tree)
557 proto_tree *atm_tree;
563 aal_type = pseudo_header->ngsniffer_atm.AppTrafType & ATT_AALTYPE;
564 hl_type = pseudo_header->ngsniffer_atm.AppTrafType & ATT_HLTYPE;
565 if (aal_type == ATT_AAL5) {
566 if (hl_type == ATT_HL_UNKNOWN ||
567 pseudo_header->ngsniffer_atm.AppHLType == AHLT_UNKNOWN) {
569 * The joys of a connection-oriented link layer; the type of
570 * traffic may be implied by the connection on which it's
571 * traveling, rather than being specified in the packet itself.
573 * For this packet, the program that captured the packet didn't
574 * save the type of traffic, presumably because it didn't know
575 * the traffic type (either it didn't see the connection setup
576 * and wasn't running on one of the endpoints, and wasn't later
577 * told, e.g. by the human running it, what type of traffic was
578 * on that circuit, or was running on one of the endpoints but
579 * was using, to capture the packets, a mechanism that either
580 * doesn't have access to data saying what's going over the
581 * connection or doesn't bother providing that information).
583 * For now, we try to guess the traffic type based on the VPI/VCI
584 * or the packet header; later, we should provide a mechanism
585 * by which the user can specify what sort of traffic is on a
586 * particular circuit.
588 atm_guess_content(pseudo_header, pd, fd);
591 * OK, now get the AAL type and high-layer type again.
593 aal_type = pseudo_header->ngsniffer_atm.AppTrafType & ATT_AALTYPE;
594 hl_type = pseudo_header->ngsniffer_atm.AppTrafType & ATT_HLTYPE;
598 if (check_col(fd, COL_PROTOCOL))
599 col_add_str(fd, COL_PROTOCOL, "ATM");
601 switch (pseudo_header->ngsniffer_atm.channel) {
604 /* Traffic from DCE to DTE. */
605 if (check_col(fd, COL_RES_DL_DST))
606 col_add_str(fd, COL_RES_DL_DST, "DTE");
607 if (check_col(fd, COL_RES_DL_SRC))
608 col_add_str(fd, COL_RES_DL_SRC, "DCE");
612 /* Traffic from DTE to DCE. */
613 if (check_col(fd, COL_RES_DL_DST))
614 col_add_str(fd, COL_RES_DL_DST, "DCE");
615 if (check_col(fd, COL_RES_DL_SRC))
616 col_add_str(fd, COL_RES_DL_SRC, "DTE");
620 if (check_col(fd, COL_INFO)) {
621 if (aal_type == ATT_AAL5) {
622 col_add_fstr(fd, COL_INFO, "AAL5 %s",
623 val_to_str(hl_type, aal5_hltype_vals,
624 "Unknown traffic type (%x)"));
626 col_add_str(fd, COL_INFO,
627 val_to_str(aal_type, aal_vals, "Unknown AAL (%x)"));
632 ti = proto_tree_add_protocol_format(tree, proto_atm, NullTVB, 0, 0, "ATM");
633 atm_tree = proto_item_add_subtree(ti, ett_atm);
635 proto_tree_add_text(atm_tree, NullTVB, 0, 0, "AAL: %s",
636 val_to_str(aal_type, aal_vals, "Unknown AAL (%x)"));
637 if (aal_type == ATT_AAL5) {
638 proto_tree_add_text(atm_tree, NullTVB, 0, 0, "Traffic type: %s",
639 val_to_str(hl_type, aal5_hltype_vals, "Unknown AAL5 traffic type (%x)"));
643 proto_tree_add_text(atm_tree, NullTVB, 0, 0, "LLC multiplexed traffic");
647 proto_tree_add_text(atm_tree, NullTVB, 0, 0, "VC multiplexed traffic type: %s",
648 val_to_str(pseudo_header->ngsniffer_atm.AppHLType,
649 vcmx_type_vals, "Unknown VCMX traffic type (%x)"));
653 proto_tree_add_text(atm_tree, NullTVB, 0, 0, "LANE traffic type: %s",
654 val_to_str(pseudo_header->ngsniffer_atm.AppHLType,
655 lane_type_vals, "Unknown LANE traffic type (%x)"));
659 proto_tree_add_text(atm_tree, NullTVB, 0, 0, "Ipsilon traffic type: %s",
660 val_to_str(pseudo_header->ngsniffer_atm.AppHLType,
661 ipsilon_type_vals, "Unknown Ipsilon traffic type (%x)"));
665 proto_tree_add_item(atm_tree, hf_atm_vpi, NullTVB, 0, 0,
666 pseudo_header->ngsniffer_atm.Vpi);
667 proto_tree_add_item(atm_tree, hf_atm_vci, NullTVB, 0, 0,
668 pseudo_header->ngsniffer_atm.Vci);
669 switch (pseudo_header->ngsniffer_atm.channel) {
672 /* Traffic from DCE to DTE. */
673 proto_tree_add_text(atm_tree, NullTVB, 0, 0, "Channel: DCE->DTE");
677 /* Traffic from DTE to DCE. */
678 proto_tree_add_text(atm_tree, NullTVB, 0, 0, "Channel: DTE->DCE");
682 /* Sniffers shouldn't provide anything other than 0 or 1. */
683 proto_tree_add_text(atm_tree, NullTVB, 0, 0, "Channel: %u",
684 pseudo_header->ngsniffer_atm.channel);
687 if (pseudo_header->ngsniffer_atm.cells != 0) {
689 * If the cell count is 0, assume it means we don't know how
692 * XXX - also, if this is AAL5 traffic, assume it means we don't
693 * know what was in the AAL5 trailer. We may, however, find
694 * some capture program that can give us the AAL5 trailer
695 * information but not the cell count, in which case we need
696 * some other way of indicating whether we have the AAL5 trailer
699 proto_tree_add_text(atm_tree, NullTVB, 0, 0, "Cells: %u",
700 pseudo_header->ngsniffer_atm.cells);
701 if (aal_type == ATT_AAL5) {
702 proto_tree_add_text(atm_tree, NullTVB, 0, 0, "AAL5 U2U: %u",
703 pseudo_header->ngsniffer_atm.aal5t_u2u);
704 proto_tree_add_text(atm_tree, NullTVB, 0, 0, "AAL5 len: %u",
705 pseudo_header->ngsniffer_atm.aal5t_len);
706 proto_tree_add_text(atm_tree, NullTVB, 0, 0, "AAL5 checksum: 0x%08X",
707 pseudo_header->ngsniffer_atm.aal5t_chksum);
714 case ATT_AAL_SIGNALLING:
715 dissect_sscop(pd, offset, fd, tree);
722 /* Dissect as WTAP_ENCAP_ATM_RFC1483 */
723 /* The ATM iptrace capture that we have hows LLC at this point,
724 * so that's what I'm calling */
725 next_tvb = tvb_new_subset(pi.compat_top_tvb, offset, -1, -1);
726 dissect_llc(next_tvb, &pi, tree);
730 dissect_lane(pseudo_header, pd, offset, fd, tree);
734 dissect_snmp_pdu(pd, offset, fd, tree, "ILMI", proto_ilmi, ett_ilmi);
739 /* Dump it as raw data. */
740 dissect_data(pd, offset, fd, tree);
748 /* Dump it as raw data. (Is this a single cell?) */
749 dissect_data(pd, offset, fd, tree);
756 proto_register_atm(void)
758 static hf_register_info hf[] = {
760 { "VPI", "atm.vpi", FT_UINT8, BASE_DEC, NULL, 0x0,
764 { "VCI", "atm.vci", FT_UINT16, BASE_DEC, NULL, 0x0,
767 static gint *ett[] = {
771 &ett_atm_lane_lc_lan_dest,
772 &ett_atm_lane_lc_lan_dest_rd,
773 &ett_atm_lane_lc_flags,
774 &ett_atm_lane_lc_tlv,
776 proto_atm = proto_register_protocol("ATM", "atm");
777 proto_register_field_array(proto_atm, hf, array_length(hf));
778 proto_ilmi = proto_register_protocol("ILMI", "ilmi");
779 proto_atm_lane = proto_register_protocol("ATM LANE", "lane");
780 proto_register_subtree_array(ett, array_length(ett));