aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/netscaler.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2015-02-25 13:04:59 -0800
committerGuy Harris <guy@alum.mit.edu>2015-02-25 21:05:26 +0000
commit0692d75455550ae6392a57c8323d8757a72f7dd2 (patch)
tree05e1153851661457e19b98ced2b5ab440810d876 /wiretap/netscaler.c
parent1a3dd349233a4ee3e69295c8e79f9a216027037e (diff)
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: I3513371057601b44821d89ebaa7565ab370a67f5 Reviewed-on: https://code.wireshark.org/review/7393 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'wiretap/netscaler.c')
-rw-r--r--wiretap/netscaler.c30
1 files changed, 17 insertions, 13 deletions
diff --git a/wiretap/netscaler.c b/wiretap/netscaler.c
index a85d2e5941..91656d3619 100644
--- a/wiretap/netscaler.c
+++ b/wiretap/netscaler.c
@@ -485,17 +485,6 @@ typedef struct nspr_pktracepart_v26
__TNV1L(phdr,enumprefix,structprefix,structname,nicno,phd.ph_DevNo)\
__TNDO(phdr,enumprefix,structname,eth)
-#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)\
@@ -900,6 +889,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];\
@@ -913,7 +915,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);\
ws_buffer_assure_space(wth->frame_buffer, (phdr)->caplen);\
memcpy(ws_buffer_start_ptr(wth->frame_buffer), type, (phdr)->caplen);\
*data_offset = nstrace->xxx_offset + nstrace_buf_offset;\
@@ -1309,7 +1312,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)