Changeset 387d299 for libpacketdump/eth_2048.c
- Timestamp:
- 07/04/14 11:37:25 (7 years ago)
- Branches:
- 4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, libtrace4, master, ndag_format, pfring, rc-4.0.1, rc-4.0.2, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance, ringtimestampfixes
- Children:
- d14e23d
- Parents:
- 9ad7a35
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libpacketdump/eth_2048.c
r66ad025 r387d299 10 10 #include <netdb.h> 11 11 12 #define DISPLAY_EXP(x,fmt,exp) \13 if ((unsigned int)len>=((char*)&ip->x-(char*)ip+sizeof(ip->x))) \14 printf(fmt,exp); \15 else \16 return;17 18 #define DISPLAY(x,fmt) DISPLAY_EXP(x,fmt,ip->x)19 20 #define DISPLAYS(x,fmt) DISPLAY_EXP(x,fmt,htons(ip->x))21 #define DISPLAYIP(x,fmt) DISPLAY_EXP(x,fmt,inet_ntoa(*(struct in_addr*)&ip->x))22 23 12 DLLEXPORT void decode(int link_type UNUSED,const char *packet,unsigned len) 24 13 { … … 29 18 } 30 19 //DISPLAY(ip_tos," TOS %02x") 31 DISPLAY_EXP(ip _tos," DSCP %02x",ip->ip_tos >> 2)32 DISPLAY_EXP(ip _tos," ECN %x",ip->ip_tos & 0x2)33 DISPLAYS(ip _len," Total Length %i")20 DISPLAY_EXP(ip, ip_tos," DSCP %02x",ip->ip_tos >> 2); 21 DISPLAY_EXP(ip, ip_tos," ECN %x",ip->ip_tos & 0x2); 22 DISPLAYS(ip, ip_len," Total Length %i"); 34 23 printf("\n IP:"); 35 DISPLAYS(ip _id," Id %u");24 DISPLAYS(ip, ip_id," Id %u"); 36 25 37 26 if ((unsigned int)len >= ((char *)&ip->ip_ttl - (char *)ip - 2)) { … … 42 31 } 43 32 //printf("\n IP:"); 44 DISPLAY(ip _ttl,"\n IP: TTL %i");33 DISPLAY(ip, ip_ttl,"\n IP: TTL %i"); 45 34 if ((unsigned int)len>=((char*)&ip->ip_p-(char*)ip+sizeof(ip->ip_p))) { 46 35 struct protoent *ent=getprotobynumber(ip->ip_p); … … 55 44 return; 56 45 } 57 DISPLAYS(ip _sum," Checksum %i\n");58 DISPLAYIP(ip _src," IP: Source %s ");59 DISPLAYIP(ip _dst,"Destination %s\n");46 DISPLAYS(ip, ip_sum," Checksum %i\n"); 47 DISPLAYIP(ip, ip_src," IP: Source %s "); 48 DISPLAYIP(ip, ip_dst,"Destination %s\n"); 60 49 decode_next(packet+ip->ip_hl*4,len-ip->ip_hl*4,"ip",ip->ip_p); 61 50 return;
Note: See TracChangeset
for help on using the changeset viewer.