aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2016-01-12 21:21:42 -0800
committerGuy Harris <guy@alum.mit.edu>2016-01-13 05:22:12 +0000
commitd286243d0d7f83e39b5ac3aec4524eea3294147f (patch)
treedc7918b75b5b25c16c2d8a64264b8c2af4ff11f9 /wiretap
parentb7dc77312720bb1bfa3698f3b48e21c991c49632 (diff)
Dissect the MC and AAL2 headers as 32-bit words.
That's how they're extracted in the libwiretap module, and that's how they're shown in the ERF spec. This gets rid of some compiler warnings about type-punning. Merge some reserved bit fields to match what's in the ERF spec. Renumber others. Process the AAL2 and MC headers differently; yes, they're both big-endian 32-bit values, but that makes the code a bit clearer, and, heck, the optimizer may well combine the two sequences of code. Change-Id: Ief7f976e77e8f2fba1685ad5a50ee677a8070ae7 Reviewed-on: https://code.wireshark.org/review/13251 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'wiretap')
-rw-r--r--wiretap/erf.c16
-rw-r--r--wiretap/erf.h4
-rw-r--r--wiretap/wtap.h1
3 files changed, 20 insertions, 1 deletions
diff --git a/wiretap/erf.c b/wiretap/erf.c
index 3d572e4881..bb41f3c145 100644
--- a/wiretap/erf.c
+++ b/wiretap/erf.c
@@ -339,6 +339,7 @@ static gboolean erf_read_header(FILE_T fh,
{
union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header;
guint32 mc_hdr;
+ guint32 aal2_hdr;
guint8 erf_exhdr[8];
guint64 erf_exhdr_sw;
guint8 type = 0;
@@ -463,7 +464,6 @@ static gboolean erf_read_header(FILE_T fh,
case ERF_TYPE_MC_AAL5:
case ERF_TYPE_MC_AAL2:
case ERF_TYPE_COLOR_MC_HDLC_POS:
- case ERF_TYPE_AAL2: /* not an MC type but has a similar 'AAL2 ext' header */
if (!wtap_read_bytes(fh, &mc_hdr, sizeof(mc_hdr), err, err_info))
return FALSE;
if (bytes_read != NULL)
@@ -473,6 +473,16 @@ static gboolean erf_read_header(FILE_T fh,
pseudo_header->erf.subhdr.mc_hdr = g_ntohl(mc_hdr);
break;
+ case ERF_TYPE_AAL2:
+ if (!wtap_read_bytes(fh, &aal2_hdr, sizeof(aal2_hdr), err, err_info))
+ return FALSE;
+ if (bytes_read != NULL)
+ *bytes_read += (guint32)sizeof(aal2_hdr);
+ *packet_size -= (guint32)sizeof(aal2_hdr);
+ skiplen += (guint32)sizeof(aal2_hdr);
+ pseudo_header->erf.subhdr.aal2_hdr = g_ntohl(aal2_hdr);
+ break;
+
case ERF_TYPE_IP_COUNTER:
case ERF_TYPE_TCP_FLOW_COUNTER:
/* unsupported, continue with default: */
@@ -546,6 +556,10 @@ static gboolean erf_write_phdr(wtap_dumper *wdh, int encap, const union wtap_pse
phtonl(&erf_subhdr[0], pseudo_header->erf.subhdr.mc_hdr);
subhdr_size += (int)sizeof(struct erf_mc_hdr);
break;
+ case ERF_TYPE_AAL2:
+ phtonl(&erf_subhdr[0], pseudo_header->erf.subhdr.aal2_hdr);
+ subhdr_size += (int)sizeof(struct erf_aal2_hdr);
+ break;
case ERF_TYPE_ETH:
case ERF_TYPE_COLOR_ETH:
case ERF_TYPE_DSM_COLOR_ETH:
diff --git a/wiretap/erf.h b/wiretap/erf.h
index 7922f5016f..894235c7ad 100644
--- a/wiretap/erf.h
+++ b/wiretap/erf.h
@@ -115,6 +115,10 @@ typedef struct erf_mc_hdr {
guint32 mc;
} erf_mc_header_t;
+typedef struct erf_aal2_hdr {
+ guint32 aal2;
+} erf_aal2_header_t;
+
typedef struct erf_eth_hdr {
guint16 eth;
} erf_eth_header_t;
diff --git a/wiretap/wtap.h b/wiretap/wtap.h
index 0335607b2a..39707abc15 100644
--- a/wiretap/wtap.h
+++ b/wiretap/wtap.h
@@ -940,6 +940,7 @@ struct erf_mc_phdr {
{
guint16 eth_hdr;
guint32 mc_hdr;
+ guint32 aal2_hdr;
} subhdr;
};