aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/atm.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2018-02-08 16:19:12 -0800
committerGuy Harris <guy@alum.mit.edu>2018-02-09 00:29:51 +0000
commit1f5f63f8ef98bfe9c4d734674cee0df64855555d (patch)
tree133dd3563cc8d2d29dd85d4d43cd9a4636283192 /wiretap/atm.c
parente4c5efafb7da2d25b7d47fe2dac3b1556c0b67b0 (diff)
Generalize wtap_pkthdr into a structure for packet and non-packet records.
Separate the stuff that any record could have from the stuff that only particular record types have; put the latter into a union, and put all that into a wtap_rec structure. Add some record-type checks as necessary. Change-Id: Id6b3486858f826fce4b096c59231f463e44bfaa2 Reviewed-on: https://code.wireshark.org/review/25696 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'wiretap/atm.c')
-rw-r--r--wiretap/atm.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/wiretap/atm.c b/wiretap/atm.c
index cd7d2955e8..599dbf5576 100644
--- a/wiretap/atm.c
+++ b/wiretap/atm.c
@@ -20,34 +20,34 @@
*/
void
-atm_guess_traffic_type(struct wtap_pkthdr *phdr, const guint8 *pd)
+atm_guess_traffic_type(wtap_rec *rec, const guint8 *pd)
{
/*
* Start out assuming nothing other than that it's AAL5.
*/
- phdr->pseudo_header.atm.aal = AAL_5;
- phdr->pseudo_header.atm.type = TRAF_UNKNOWN;
- phdr->pseudo_header.atm.subtype = TRAF_ST_UNKNOWN;
+ rec->rec_header.packet_header.pseudo_header.atm.aal = AAL_5;
+ rec->rec_header.packet_header.pseudo_header.atm.type = TRAF_UNKNOWN;
+ rec->rec_header.packet_header.pseudo_header.atm.subtype = TRAF_ST_UNKNOWN;
- if (phdr->pseudo_header.atm.vpi == 0) {
+ if (rec->rec_header.packet_header.pseudo_header.atm.vpi == 0) {
/*
* Traffic on some PVCs with a VPI of 0 and certain
* VCIs is of particular types.
*/
- switch (phdr->pseudo_header.atm.vci) {
+ switch (rec->rec_header.packet_header.pseudo_header.atm.vci) {
case 5:
/*
* Signalling AAL.
*/
- phdr->pseudo_header.atm.aal = AAL_SIGNALLING;
+ rec->rec_header.packet_header.pseudo_header.atm.aal = AAL_SIGNALLING;
return;
case 16:
/*
* ILMI.
*/
- phdr->pseudo_header.atm.type = TRAF_ILMI;
+ rec->rec_header.packet_header.pseudo_header.atm.type = TRAF_ILMI;
return;
}
}
@@ -58,21 +58,21 @@ atm_guess_traffic_type(struct wtap_pkthdr *phdr, const guint8 *pd)
* to guess.
*/
- if (phdr->caplen >= 3) {
+ if (rec->rec_header.packet_header.caplen >= 3) {
if (pd[0] == 0xaa && pd[1] == 0xaa && pd[2] == 0x03) {
/*
* Looks like a SNAP header; assume it's LLC
* multiplexed RFC 1483 traffic.
*/
- phdr->pseudo_header.atm.type = TRAF_LLCMX;
- } else if ((phdr->pseudo_header.atm.aal5t_len && phdr->pseudo_header.atm.aal5t_len < 16) ||
- phdr->caplen < 16) {
+ rec->rec_header.packet_header.pseudo_header.atm.type = TRAF_LLCMX;
+ } else if ((rec->rec_header.packet_header.pseudo_header.atm.aal5t_len && rec->rec_header.packet_header.pseudo_header.atm.aal5t_len < 16) ||
+ rec->rec_header.packet_header.caplen < 16) {
/*
* As this cannot be a LANE Ethernet frame (less
* than 2 bytes of LANE header + 14 bytes of
* Ethernet header) we can try it as a SSCOP frame.
*/
- phdr->pseudo_header.atm.aal = AAL_SIGNALLING;
+ rec->rec_header.packet_header.pseudo_header.atm.aal = AAL_SIGNALLING;
} else if (pd[0] == 0x83 || pd[0] == 0x81) {
/*
* MTP3b headers often encapsulate
@@ -80,32 +80,32 @@ atm_guess_traffic_type(struct wtap_pkthdr *phdr, const guint8 *pd)
* This should cause 0x83 or 0x81
* in the first byte.
*/
- phdr->pseudo_header.atm.aal = AAL_SIGNALLING;
+ rec->rec_header.packet_header.pseudo_header.atm.aal = AAL_SIGNALLING;
} else {
/*
* Assume it's LANE.
*/
- phdr->pseudo_header.atm.type = TRAF_LANE;
- atm_guess_lane_type(phdr, pd);
+ rec->rec_header.packet_header.pseudo_header.atm.type = TRAF_LANE;
+ atm_guess_lane_type(rec, pd);
}
} else {
/*
* Not only VCI 5 is used for signaling. It might be
* one of these VCIs.
*/
- phdr->pseudo_header.atm.aal = AAL_SIGNALLING;
+ rec->rec_header.packet_header.pseudo_header.atm.aal = AAL_SIGNALLING;
}
}
void
-atm_guess_lane_type(struct wtap_pkthdr *phdr, const guint8 *pd)
+atm_guess_lane_type(wtap_rec *rec, const guint8 *pd)
{
- if (phdr->caplen >= 2) {
+ if (rec->rec_header.packet_header.caplen >= 2) {
if (pd[0] == 0xff && pd[1] == 0x00) {
/*
* Looks like LE Control traffic.
*/
- phdr->pseudo_header.atm.subtype = TRAF_ST_LANE_LE_CTRL;
+ rec->rec_header.packet_header.pseudo_header.atm.subtype = TRAF_ST_LANE_LE_CTRL;
} else {
/*
* XXX - Ethernet, or Token Ring?
@@ -115,7 +115,7 @@ atm_guess_lane_type(struct wtap_pkthdr *phdr, const guint8 *pd)
* still be situations where the user has to
* tell us.
*/
- phdr->pseudo_header.atm.subtype = TRAF_ST_LANE_802_3;
+ rec->rec_header.packet_header.pseudo_header.atm.subtype = TRAF_ST_LANE_802_3;
}
}
}