diff options
author | Guy Harris <guy@alum.mit.edu> | 2015-02-25 13:04:59 -0800 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2015-02-25 21:07:59 +0000 |
commit | acbd5ac7207f4aa0fed85fe11f59cff10017cf56 (patch) | |
tree | 158cc80b356265727a6a1cf2f076eb2cba01b54e /wiretap | |
parent | 572ce102c33c932d470a75ddb2bb660866816458 (diff) | |
download | wireshark-acbd5ac7207f4aa0fed85fe11f59cff10017cf56.tar.gz |
Make the V10 path a bit more like the other paths.
Provide {FULL,PART}SIZEDEFV10 macros, similar to what's provided for the
other versions, containing the code to set the packet length and
captured data length, and use the TRACE_V10_REC_LEN_OFF() macro directly
after that to set the various length and offset values in the
pseudo-header.
Change-Id: I28e7986f29f4ef4f3542098f16e6f7dfa6cec691
Reviewed-on: https://code.wireshark.org/review/7394
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'wiretap')
-rw-r--r-- | wiretap/netscaler.c | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/wiretap/netscaler.c b/wiretap/netscaler.c index 60cfd6e115..059198d331 100644 --- a/wiretap/netscaler.c +++ b/wiretap/netscaler.c @@ -507,17 +507,6 @@ typedef struct nspr_pktracepart_v26 __TNV1L(phdr,enumprefix,structprefix,structname,nicno,phd.ph_DevNo)\ __TNO(phdr,enumprefix,structprefix,structname,eth,Data) -#define TRACE_FULL_V10_REC_LEN_OFF(phdr,enumprefix,structprefix,structname) \ - (phdr)->len = pletoh16(&(fp)->nsprRecordSize);\ - (phdr)->caplen = (phdr)->len;\ - TRACE_V10_REC_LEN_OFF(phdr,enumprefix,structprefix,structname) - -#define TRACE_PART_V10_REC_LEN_OFF(phdr,enumprefix,structprefix,structname) \ - (phdr)->presence_flags |= WTAP_HAS_CAP_LEN;\ - (phdr)->len = pletoh16(&pp->pp_PktSizeOrg) + nspr_pktracepart_v10_s;\ - (phdr)->caplen = pletoh16(&pp->nsprRecordSize);\ - TRACE_V10_REC_LEN_OFF(phdr,enumprefix,structprefix,structname) - #define TRACE_V20_REC_LEN_OFF(phdr,enumprefix,structprefix,structname) \ __TNO(phdr,enumprefix,structprefix,structname,dir,RecordType)\ __TNL(phdr,enumprefix,structprefix,structname,dir,RecordType)\ @@ -926,6 +915,19 @@ static gboolean nstrace_set_start_time(wtap *wth) /* ** Netscaler trace format read routines. */ +#define PARTSIZEDEFV10(phdr,pp,ver) \ + do {\ + (phdr)->presence_flags |= WTAP_HAS_CAP_LEN;\ + (phdr)->len = pletoh16(&pp->pp_PktSizeOrg) + nspr_pktracepart_v##ver##_s;\ + (phdr)->caplen = pletoh16(&pp->nsprRecordSize);\ + }while(0) + +#define FULLSIZEDEFV10(phdr,fp,ver) \ + do {\ + (phdr)->len = pletoh16(&(fp)->nsprRecordSize);\ + (phdr)->caplen = (phdr)->len;\ + }while(0) + #define PACKET_DESCRIBE(phdr,FULLPART,fullpart,ver,type,HEADERVER) \ do {\ nspr_pktrace##fullpart##_v##ver##_t *type = (nspr_pktrace##fullpart##_v##ver##_t *) &nstrace_buf[nstrace_buf_offset];\ @@ -939,7 +941,8 @@ static gboolean nstrace_set_start_time(wtap *wth) nsg_creltime += ns_hrtime2nsec(pletoh32(&type->type##_RelTimeHr));\ (phdr)->ts.secs = nstrace->nspm_curtime + (guint32) (nsg_creltime / 1000000000);\ (phdr)->ts.nsecs = (guint32) (nsg_creltime % 1000000000);\ - TRACE_##FULLPART##_V##ver##_REC_LEN_OFF(phdr,v##ver##_##fullpart,type,pktrace##fullpart##_v##ver);\ + FULLPART##SIZEDEFV##ver((phdr),type,ver);\ + TRACE_V##ver##_REC_LEN_OFF((phdr),v##ver##_##fullpart,type,pktrace##fullpart##_v##ver);\ buffer_assure_space(wth->frame_buffer, (phdr)->caplen);\ memcpy(buffer_start_ptr(wth->frame_buffer), type, (phdr)->caplen);\ *data_offset = nstrace->xxx_offset + nstrace_buf_offset;\ @@ -1335,7 +1338,8 @@ static gboolean nstrace_read_v30(wtap *wth, int *err, gchar **err_info, gint64 * * the previous packet.\ */\ (phdr)->presence_flags = 0;\ - TRACE_##FULLPART##_V##ver##_REC_LEN_OFF(phdr,v##ver##_##fullpart,type,pktrace##fullpart##_v##ver);\ + FULLPART##SIZEDEFV##ver((phdr),type,ver);\ + TRACE_V##ver##_REC_LEN_OFF(phdr,v##ver##_##fullpart,type,pktrace##fullpart##_v##ver);\ (phdr)->pseudo_header.nstr.rec_type = NSPR_HEADER_VERSION##HEADERVER;\ }while(0) |