2 * Routines for ATM packet disassembly
4 * $Id: packet-atm.c,v 1.41 2002/03/31 21:23:47 guy 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.
29 #ifdef HAVE_SYS_TYPES_H
30 # include <sys/types.h>
35 #include <epan/packet.h>
37 #include <epan/resolv.h>
39 #include "packet-snmp.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
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, 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 = NULL;
256 proto_tree *flags_tree;
258 proto_tree *tlv_tree;
265 if (check_col(pinfo->cinfo, COL_INFO))
266 col_set_str(pinfo->cinfo, 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));
278 proto_tree_add_text(lane_tree, tvb, offset, 1, "Protocol: 0x%02X",
279 tvb_get_guint8(tvb, offset));
284 proto_tree_add_text(lane_tree, tvb, offset, 1, "Version: 0x%02X",
285 tvb_get_guint8(tvb, offset));
289 opcode = tvb_get_ntohs(tvb, offset);
290 if (check_col(pinfo->cinfo, COL_INFO)) {
291 col_append_fstr(pinfo->cinfo, COL_INFO, ": %s",
292 val_to_str(opcode, le_control_opcode_vals,
293 "Unknown opcode (0x%04X)"));
296 proto_tree_add_text(lane_tree, tvb, offset, 2, "Opcode: %s",
297 val_to_str(opcode, le_control_opcode_vals,
298 "Unknown (0x%04X)"));
302 if (opcode == READY_QUERY || opcode == READY_IND) {
303 /* There's nothing more in this packet. */
308 if (opcode & 0x0100) {
309 /* Response; decode status. */
310 proto_tree_add_text(lane_tree, tvb, offset, 2, "Status: %s",
311 val_to_str(tvb_get_ntohs(tvb, offset), le_control_status_vals,
312 "Unknown (0x%04X)"));
316 proto_tree_add_text(lane_tree, tvb, offset, 4, "Transaction ID: 0x%08X",
317 tvb_get_ntohl(tvb, offset));
320 proto_tree_add_text(lane_tree, tvb, offset, 2, "Requester LECID: 0x%04X",
321 tvb_get_ntohs(tvb, offset));
324 flags = tvb_get_ntohs(tvb, offset);
325 tf = proto_tree_add_text(lane_tree, tvb, offset, 2, "Flags: 0x%04X",
327 flags_tree = proto_item_add_subtree(tf, ett_atm_lane_lc_flags);
328 proto_tree_add_text(flags_tree, tvb, offset, 2, "%s",
329 decode_boolean_bitfield(flags, 0x0001, 8*2,
330 "Remote address", "Local address"));
331 proto_tree_add_text(flags_tree, tvb, offset, 2, "%s",
332 decode_boolean_bitfield(flags, 0x0080, 8*2,
333 "Proxy", "Not proxy"));
334 proto_tree_add_text(flags_tree, tvb, offset, 2, "%s",
335 decode_boolean_bitfield(flags, 0x0100, 8*2,
336 "Topology change", "No topology change"));
339 dissect_lan_destination(tvb, offset, "Source", lane_tree);
342 dissect_lan_destination(tvb, offset, "Target", lane_tree);
345 proto_tree_add_text(lane_tree, tvb, offset, 20, "Source ATM Address: %s",
346 tvb_bytes_to_str(tvb, offset, 20));
349 proto_tree_add_text(lane_tree, tvb, offset, 1, "LAN type: %s",
350 val_to_str(tvb_get_guint8(tvb, offset), le_control_lan_type_vals,
351 "Unknown (0x%02X)"));
354 proto_tree_add_text(lane_tree, tvb, offset, 1, "Maximum frame size: %u",
355 tvb_get_guint8(tvb, offset));
358 num_tlvs = tvb_get_guint8(tvb, offset);
359 proto_tree_add_text(lane_tree, tvb, offset, 1, "Number of TLVs: %u",
363 proto_tree_add_text(lane_tree, tvb, offset, 1, "ELAN name size: %u",
364 tvb_get_guint8(tvb, offset));
367 proto_tree_add_text(lane_tree, tvb, offset, 20, "Target ATM Address: %s",
368 tvb_bytes_to_str(tvb, offset, 20));
371 proto_tree_add_text(lane_tree, tvb, offset, 32, "ELAN name: %s",
372 tvb_bytes_to_str(tvb, offset, 32));
375 while (num_tlvs != 0) {
376 tlv_type = tvb_get_ntohl(tvb, offset);
377 tlv_length = tvb_get_guint8(tvb, offset+4);
378 ttlv = proto_tree_add_text(lane_tree, tvb, offset, 5+tlv_length, "TLV type: %s",
379 val_to_str(tlv_type, le_tlv_type_vals, "Unknown (0x%08x)"));
380 tlv_tree = proto_item_add_subtree(ttlv, ett_atm_lane_lc_tlv);
381 proto_tree_add_text(tlv_tree, tvb, offset, 4, "TLV Type: %s",
382 val_to_str(tlv_type, le_tlv_type_vals, "Unknown (0x%08x)"));
383 proto_tree_add_text(tlv_tree, tvb, offset+4, 1, "TLV Length: %u", tlv_length);
384 offset += 5+tlv_length;
391 dissect_lane(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
394 tvbuff_t *next_tvb_le_client;
396 if (check_col(pinfo->cinfo, COL_PROTOCOL))
397 col_set_str(pinfo->cinfo, COL_PROTOCOL, "ATM LANE");
399 /* Is it LE Control, 802.3, 802.5, or "none of the above"? */
400 switch (pinfo->pseudo_header->ngsniffer_atm.AppHLType) {
402 case AHLT_LANE_LE_CTRL:
403 dissect_le_control(tvb, pinfo, tree);
406 case AHLT_LANE_802_3:
407 case AHLT_LANE_802_3_MC:
408 if (check_col(pinfo->cinfo, COL_INFO))
409 col_set_str(pinfo->cinfo, COL_INFO, "LE Client - Ethernet/802.3");
410 dissect_le_client(tvb, tree);
412 /* Dissect as Ethernet */
413 next_tvb_le_client = tvb_new_subset(tvb, 2, -1, -1);
414 call_dissector(eth_handle, next_tvb_le_client, pinfo, tree);
417 case AHLT_LANE_802_5:
418 case AHLT_LANE_802_5_MC:
419 if (check_col(pinfo->cinfo, COL_INFO))
420 col_set_str(pinfo->cinfo, COL_INFO, "LE Client - 802.5");
421 dissect_le_client(tvb, tree);
423 /* Dissect as Token-Ring */
424 next_tvb_le_client = tvb_new_subset(tvb, 2, -1, -1);
425 call_dissector(tr_handle, next_tvb_le_client, pinfo, tree);
429 /* Dump it as raw data. */
430 if (check_col(pinfo->cinfo, COL_INFO))
431 col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown LANE traffic type %x",
432 pinfo->pseudo_header->ngsniffer_atm.AppHLType);
433 next_tvb = tvb_new_subset(tvb, 0, -1, -1);
434 call_dissector(data_handle,next_tvb, pinfo, tree);
440 dissect_ilmi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
442 dissect_snmp_pdu(tvb, 0, pinfo, tree, "ILMI", proto_ilmi, ett_ilmi);
446 static const value_string aal_vals[] = {
447 { ATT_AAL_UNKNOWN, "Unknown AAL" },
448 { ATT_AAL1, "AAL1" },
449 { ATT_AAL3_4, "AAL3/4" },
450 { ATT_AAL5, "AAL5" },
451 { ATT_AAL_USER, "User AAL" },
452 { ATT_AAL_SIGNALLING, "Signalling AAL" },
453 { ATT_OAMCELL, "OAM cell" },
457 /* AAL5 higher-level traffic types */
458 static const value_string aal5_hltype_vals[] = {
459 { ATT_HL_UNKNOWN, "Unknown traffic type" },
460 { ATT_HL_LLCMX, "LLC multiplexed" },
461 { ATT_HL_VCMX, "VC multiplexed" },
462 { ATT_HL_LANE, "LANE" },
463 { ATT_HL_ILMI, "ILMI" },
464 { ATT_HL_FRMR, "Frame Relay" },
465 { ATT_HL_SPANS, "FORE SPANS" },
466 { ATT_HL_IPSILON, "Ipsilon" },
470 /* Traffic subtypes for VC multiplexed traffic */
471 static const value_string vcmx_type_vals[] = {
472 { AHLT_UNKNOWN, "Unknown VC multiplexed traffic type" },
473 { AHLT_VCMX_802_3_FCS, "802.3 FCS" },
474 { AHLT_VCMX_802_4_FCS, "802.4 FCS" },
475 { AHLT_VCMX_802_5_FCS, "802.5 FCS" },
476 { AHLT_VCMX_FDDI_FCS, "FDDI FCS" },
477 { AHLT_VCMX_802_6_FCS, "802.6 FCS" },
478 { AHLT_VCMX_802_3, "802.3" },
479 { AHLT_VCMX_802_4, "802.4" },
480 { AHLT_VCMX_802_5, "802.5" },
481 { AHLT_VCMX_FDDI, "FDDI" },
482 { AHLT_VCMX_802_6, "802.6" },
483 { AHLT_VCMX_FRAGMENTS, "Fragments" },
484 { AHLT_VCMX_BPDU, "BPDU" },
488 /* Traffic subtypes for LANE traffic */
489 static const value_string lane_type_vals[] = {
490 { AHLT_UNKNOWN, "Unknown LANE traffic type" },
491 { AHLT_LANE_LE_CTRL, "LE Control" },
492 { AHLT_LANE_802_3, "802.3" },
493 { AHLT_LANE_802_5, "802.5" },
494 { AHLT_LANE_802_3_MC, "802.3 multicast" },
495 { AHLT_LANE_802_5_MC, "802.5 multicast" },
499 /* Traffic subtypes for Ipsilon traffic */
500 static const value_string ipsilon_type_vals[] = {
501 { AHLT_UNKNOWN, "Unknown Ipsilon traffic type" },
502 { AHLT_IPSILON_FT0, "Flow type 0" },
503 { AHLT_IPSILON_FT1, "Flow type 1" },
504 { AHLT_IPSILON_FT2, "Flow type 2" },
509 * We don't know what kind of traffic this is; try to guess.
510 * We at least know it's AAL5....
513 atm_guess_content(tvbuff_t *tvb, packet_info *pinfo)
515 guint8 byte0, byte1, byte2;
517 if (pinfo->pseudo_header->ngsniffer_atm.Vpi == 0) {
519 * Traffic on some PVCs with a VPI of 0 and certain
520 * VCIs is of particular types.
522 switch (pinfo->pseudo_header->ngsniffer_atm.Vci) {
528 pinfo->pseudo_header->ngsniffer_atm.AppTrafType =
536 pinfo->pseudo_header->ngsniffer_atm.AppTrafType |=
543 * OK, we can't tell what it is based on the VPI/VCI; try
544 * guessing based on the contents.
546 byte0 = tvb_get_guint8(tvb, 0);
547 byte1 = tvb_get_guint8(tvb, 1);
548 byte2 = tvb_get_guint8(tvb, 2);
549 if (byte0 == 0xaa && byte1 == 0xaa && byte2 == 0x03) {
551 * Looks like a SNAP header; assume it's LLC multiplexed
554 pinfo->pseudo_header->ngsniffer_atm.AppTrafType |= ATT_HL_LLCMX;
559 pinfo->pseudo_header->ngsniffer_atm.AppTrafType |= ATT_HL_LANE;
560 if (byte0 == 0xff && byte1 == 0x00) {
562 * Looks like LE Control traffic.
564 pinfo->pseudo_header->ngsniffer_atm.AppHLType =
568 * XXX - Ethernet, or Token Ring?
569 * Assume Ethernet for now; if we see earlier
570 * LANE traffic, we may be able to figure out
571 * the traffic type from that, but there may
572 * still be situations where the user has to
575 pinfo->pseudo_header->ngsniffer_atm.AppHLType =
582 dissect_atm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
584 proto_tree *atm_tree;
589 aal_type = pinfo->pseudo_header->ngsniffer_atm.AppTrafType & ATT_AALTYPE;
590 hl_type = pinfo->pseudo_header->ngsniffer_atm.AppTrafType & ATT_HLTYPE;
591 if (aal_type == ATT_AAL5) {
592 if (hl_type == ATT_HL_UNKNOWN ||
593 pinfo->pseudo_header->ngsniffer_atm.AppHLType == AHLT_UNKNOWN) {
595 * The joys of a connection-oriented link layer; the type of
596 * traffic may be implied by the connection on which it's
597 * traveling, rather than being specified in the packet itself.
599 * For this packet, the program that captured the packet didn't
600 * save the type of traffic, presumably because it didn't know
601 * the traffic type (either it didn't see the connection setup
602 * and wasn't running on one of the endpoints, and wasn't later
603 * told, e.g. by the human running it, what type of traffic was
604 * on that circuit, or was running on one of the endpoints but
605 * was using, to capture the packets, a mechanism that either
606 * doesn't have access to data saying what's going over the
607 * connection or doesn't bother providing that information).
609 * For now, we try to guess the traffic type based on the VPI/VCI
610 * or the packet header; later, we should provide a mechanism
611 * by which the user can specify what sort of traffic is on a
612 * particular circuit.
614 atm_guess_content(tvb, pinfo);
617 * OK, now get the AAL type and high-layer type again.
619 aal_type = pinfo->pseudo_header->ngsniffer_atm.AppTrafType & ATT_AALTYPE;
620 hl_type = pinfo->pseudo_header->ngsniffer_atm.AppTrafType & ATT_HLTYPE;
624 if (check_col(pinfo->cinfo, COL_PROTOCOL))
625 col_set_str(pinfo->cinfo, COL_PROTOCOL, "ATM");
627 switch (pinfo->pseudo_header->ngsniffer_atm.channel) {
630 /* Traffic from DCE to DTE. */
631 if (check_col(pinfo->cinfo, COL_RES_DL_DST))
632 col_set_str(pinfo->cinfo, COL_RES_DL_DST, "DTE");
633 if (check_col(pinfo->cinfo, COL_RES_DL_SRC))
634 col_set_str(pinfo->cinfo, COL_RES_DL_SRC, "DCE");
638 /* Traffic from DTE to DCE. */
639 if (check_col(pinfo->cinfo, COL_RES_DL_DST))
640 col_set_str(pinfo->cinfo, COL_RES_DL_DST, "DCE");
641 if (check_col(pinfo->cinfo, COL_RES_DL_SRC))
642 col_set_str(pinfo->cinfo, COL_RES_DL_SRC, "DTE");
646 if (check_col(pinfo->cinfo, COL_INFO)) {
647 if (aal_type == ATT_AAL5) {
648 col_add_fstr(pinfo->cinfo, COL_INFO, "AAL5 %s",
649 val_to_str(hl_type, aal5_hltype_vals,
650 "Unknown traffic type (%x)"));
652 col_add_str(pinfo->cinfo, COL_INFO,
653 val_to_str(aal_type, aal_vals, "Unknown AAL (%x)"));
658 ti = proto_tree_add_protocol_format(tree, proto_atm, tvb, 0, 0, "ATM");
659 atm_tree = proto_item_add_subtree(ti, ett_atm);
661 proto_tree_add_text(atm_tree, tvb, 0, 0, "AAL: %s",
662 val_to_str(aal_type, aal_vals, "Unknown AAL (%x)"));
663 if (aal_type == ATT_AAL5) {
664 proto_tree_add_text(atm_tree, tvb, 0, 0, "Traffic type: %s",
665 val_to_str(hl_type, aal5_hltype_vals, "Unknown AAL5 traffic type (%x)"));
669 proto_tree_add_text(atm_tree, tvb, 0, 0, "LLC multiplexed traffic");
673 proto_tree_add_text(atm_tree, tvb, 0, 0, "VC multiplexed traffic type: %s",
674 val_to_str(pinfo->pseudo_header->ngsniffer_atm.AppHLType,
675 vcmx_type_vals, "Unknown VCMX traffic type (%x)"));
679 proto_tree_add_text(atm_tree, tvb, 0, 0, "LANE traffic type: %s",
680 val_to_str(pinfo->pseudo_header->ngsniffer_atm.AppHLType,
681 lane_type_vals, "Unknown LANE traffic type (%x)"));
685 proto_tree_add_text(atm_tree, tvb, 0, 0, "Ipsilon traffic type: %s",
686 val_to_str(pinfo->pseudo_header->ngsniffer_atm.AppHLType,
687 ipsilon_type_vals, "Unknown Ipsilon traffic type (%x)"));
691 proto_tree_add_uint(atm_tree, hf_atm_vpi, tvb, 0, 0,
692 pinfo->pseudo_header->ngsniffer_atm.Vpi);
693 proto_tree_add_uint(atm_tree, hf_atm_vci, tvb, 0, 0,
694 pinfo->pseudo_header->ngsniffer_atm.Vci);
695 switch (pinfo->pseudo_header->ngsniffer_atm.channel) {
698 /* Traffic from DCE to DTE. */
699 proto_tree_add_text(atm_tree, tvb, 0, 0, "Channel: DCE->DTE");
703 /* Traffic from DTE to DCE. */
704 proto_tree_add_text(atm_tree, tvb, 0, 0, "Channel: DTE->DCE");
708 /* Sniffers shouldn't provide anything other than 0 or 1. */
709 proto_tree_add_text(atm_tree, tvb, 0, 0, "Channel: %u",
710 pinfo->pseudo_header->ngsniffer_atm.channel);
713 if (pinfo->pseudo_header->ngsniffer_atm.cells != 0) {
715 * If the cell count is 0, assume it means we don't know how
718 * XXX - also, if this is AAL5 traffic, assume it means we don't
719 * know what was in the AAL5 trailer. We may, however, find
720 * some capture program that can give us the AAL5 trailer
721 * information but not the cell count, in which case we need
722 * some other way of indicating whether we have the AAL5 trailer
725 proto_tree_add_text(atm_tree, tvb, 0, 0, "Cells: %u",
726 pinfo->pseudo_header->ngsniffer_atm.cells);
727 if (aal_type == ATT_AAL5) {
728 proto_tree_add_text(atm_tree, tvb, 0, 0, "AAL5 U2U: %u",
729 pinfo->pseudo_header->ngsniffer_atm.aal5t_u2u);
730 proto_tree_add_text(atm_tree, tvb, 0, 0, "AAL5 len: %u",
731 pinfo->pseudo_header->ngsniffer_atm.aal5t_len);
732 proto_tree_add_text(atm_tree, tvb, 0, 0, "AAL5 checksum: 0x%08X",
733 pinfo->pseudo_header->ngsniffer_atm.aal5t_chksum);
740 case ATT_AAL_SIGNALLING:
741 call_dissector(sscop_handle, tvb, pinfo, tree);
748 /* Dissect as WTAP_ENCAP_ATM_RFC1483 */
749 /* The ATM iptrace capture that we have shows LLC at this point,
750 * so that's what I'm calling */
751 call_dissector(llc_handle, tvb, pinfo, tree);
755 call_dissector(lane_handle, tvb, pinfo, tree);
759 call_dissector(ilmi_handle, tvb, pinfo, tree);
764 /* Dump it as raw data. */
765 call_dissector(data_handle,tvb, pinfo, tree);
773 /* Dump it as raw data. (Is this a single cell?) */
774 call_dissector(data_handle,tvb, pinfo, tree);
781 proto_register_atm(void)
783 static hf_register_info hf[] = {
785 { "VPI", "atm.vpi", FT_UINT8, BASE_DEC, NULL, 0x0,
789 { "VCI", "atm.vci", FT_UINT16, BASE_DEC, NULL, 0x0,
792 static gint *ett[] = {
796 &ett_atm_lane_lc_lan_dest,
797 &ett_atm_lane_lc_lan_dest_rd,
798 &ett_atm_lane_lc_flags,
799 &ett_atm_lane_lc_tlv,
801 proto_atm = proto_register_protocol("ATM", "ATM", "atm");
802 proto_register_field_array(proto_atm, hf, array_length(hf));
803 proto_register_subtree_array(ett, array_length(ett));
805 proto_ilmi = proto_register_protocol("ILMI", "ILMI", "ilmi");
807 register_dissector("ilmi", dissect_ilmi, proto_ilmi);
809 proto_atm_lane = proto_register_protocol("ATM LAN Emulation",
812 register_dissector("lane", dissect_lane, proto_atm_lane);
816 proto_reg_handoff_atm(void)
818 dissector_handle_t atm_handle;
821 * Get handles for the Ethernet, Token Ring, LLC, SSCOP, LANE,
822 * and ILMI dissectors.
824 eth_handle = find_dissector("eth");
825 tr_handle = find_dissector("tr");
826 llc_handle = find_dissector("llc");
827 sscop_handle = find_dissector("sscop");
828 lane_handle = find_dissector("lane");
829 ilmi_handle = find_dissector("ilmi");
830 data_handle = find_dissector("data");
832 atm_handle = create_dissector_handle(dissect_atm, proto_atm);
834 dissector_add("wtap_encap", WTAP_ENCAP_ATM_SNIFFER, atm_handle);