dcerpc-netlogon: improve NetrLogonGetCapabilities dissection
[wireshark-sm.git] / wiretap / atm.c
blob793cfbad79d348ee2310b4baeb8c17901fe5ccf1
1 /* atm.c
3 * Wiretap Library
4 * Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu>
6 * SPDX-License-Identifier: GPL-2.0-or-later
7 */
9 #include "config.h"
10 #include "atm.h"
11 #include "wtap-int.h"
14 * Routines to use with ATM capture file types that don't include information
15 * about the *type* of ATM traffic (or, at least, where we haven't found
16 * that information).
18 * We assume the traffic is AAL5, unless it's VPI 0/VCI 5, in which case
19 * we assume it's the signalling AAL.
22 void
23 atm_guess_traffic_type(wtap_rec *rec, const uint8_t *pd)
26 * Start out assuming nothing other than that it's AAL5.
28 rec->rec_header.packet_header.pseudo_header.atm.aal = AAL_5;
29 rec->rec_header.packet_header.pseudo_header.atm.type = TRAF_UNKNOWN;
30 rec->rec_header.packet_header.pseudo_header.atm.subtype = TRAF_ST_UNKNOWN;
32 if (rec->rec_header.packet_header.pseudo_header.atm.vpi == 0) {
34 * Traffic on some PVCs with a VPI of 0 and certain
35 * VCIs is of particular types.
37 switch (rec->rec_header.packet_header.pseudo_header.atm.vci) {
39 case 5:
41 * Signalling AAL.
43 rec->rec_header.packet_header.pseudo_header.atm.aal = AAL_SIGNALLING;
44 return;
46 case 16:
48 * ILMI.
50 rec->rec_header.packet_header.pseudo_header.atm.type = TRAF_ILMI;
51 return;
56 * OK, we can't tell what it is based on the VPI/VCI; try
57 * guessing based on the contents, if we have enough data
58 * to guess.
61 if (rec->rec_header.packet_header.caplen >= 3) {
62 if (pd[0] == 0xaa && pd[1] == 0xaa && pd[2] == 0x03) {
64 * Looks like a SNAP header; assume it's LLC
65 * multiplexed RFC 1483 traffic.
67 rec->rec_header.packet_header.pseudo_header.atm.type = TRAF_LLCMX;
68 } else if ((rec->rec_header.packet_header.pseudo_header.atm.aal5t_len && rec->rec_header.packet_header.pseudo_header.atm.aal5t_len < 16) ||
69 rec->rec_header.packet_header.caplen < 16) {
71 * As this cannot be a LANE Ethernet frame (less
72 * than 2 bytes of LANE header + 14 bytes of
73 * Ethernet header) we can try it as a SSCOP frame.
75 rec->rec_header.packet_header.pseudo_header.atm.aal = AAL_SIGNALLING;
76 } else if (pd[0] == 0x83 || pd[0] == 0x81) {
78 * MTP3b headers often encapsulate
79 * a SCCP or MTN in the 3G network.
80 * This should cause 0x83 or 0x81
81 * in the first byte.
83 rec->rec_header.packet_header.pseudo_header.atm.aal = AAL_SIGNALLING;
84 } else {
86 * Assume it's LANE.
88 rec->rec_header.packet_header.pseudo_header.atm.type = TRAF_LANE;
89 atm_guess_lane_type(rec, pd);
91 } else {
93 * Not only VCI 5 is used for signaling. It might be
94 * one of these VCIs.
96 rec->rec_header.packet_header.pseudo_header.atm.aal = AAL_SIGNALLING;
100 void
101 atm_guess_lane_type(wtap_rec *rec, const uint8_t *pd)
103 if (rec->rec_header.packet_header.caplen >= 2) {
104 if (pd[0] == 0xff && pd[1] == 0x00) {
106 * Looks like LE Control traffic.
108 rec->rec_header.packet_header.pseudo_header.atm.subtype = TRAF_ST_LANE_LE_CTRL;
109 } else {
111 * XXX - Ethernet, or Token Ring?
112 * Assume Ethernet for now; if we see earlier
113 * LANE traffic, we may be able to figure out
114 * the traffic type from that, but there may
115 * still be situations where the user has to
116 * tell us.
118 rec->rec_header.packet_header.pseudo_header.atm.subtype = TRAF_ST_LANE_802_3;
124 * Editor modelines - https://www.wireshark.org/tools/modelines.html
126 * Local variables:
127 * c-basic-offset: 8
128 * tab-width: 8
129 * indent-tabs-mode: t
130 * End:
132 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
133 * :indentSize=8:tabSize=8:noTabs=false: