Changeset 010fafb for libpacketdump
- Timestamp:
- 10/31/05 15:46:09 (17 years ago)
- Branches:
- 4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, getfragoff, help, 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:
- 1851624
- Parents:
- 950d54a
- Location:
- libpacketdump
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
libpacketdump/eth_2048.cc
r950d54a r010fafb 10 10 #include <netinet/ip.h> 11 11 #include <arpa/inet.h> 12 #include <netdb.h> 12 13 13 14 #define DISPLAY_EXP(x,fmt,exp) \ … … 37 38 //printf("\n IP:"); 38 39 DISPLAY(ttl," TTL %i"); 39 DISPLAY(protocol," Proto %i"); 40 if ((unsigned int)len>=((char*)&ip->protocol-(char*)ip+sizeof(ip->protocol))) { 41 struct protoent *ent=getprotobynumber(ip->protocol); 42 if (ent) { 43 printf(" Proto %i (%s)",ip->protocol,ent->p_name); 44 } 45 else { 46 printf(" Proto %i",ip->protocol); 47 } 48 } else { 49 printf("\n"); 50 return; 51 } 40 52 DISPLAYS(check," Checksum %i\n"); 41 53 DISPLAYIP(saddr," IP: Source %s "); -
libpacketdump/ip_17.cc
r950d54a r010fafb 6 6 #include <netinet/udp.h> 7 7 #include <netinet/in.h> 8 #include <netdb.h> 8 9 9 10 #define STRUCT udp … … 29 30 struct udphdr *udp = (struct udphdr*)packet; 30 31 printf(" UDP:"); 31 DISPLAYS(source," Source %i") 32 DISPLAYS(dest," Dest %i") 32 if (SAFE(source)) { 33 struct servent *ent=getservbyport(udp->source,"udp"); 34 if(ent) { 35 printf(" Source %i (%s)",htons(udp->source),ent->s_name); 36 } else { 37 printf(" Source %i",htons(udp->source)); 38 } 39 } 40 else { 41 printf("\n"); 42 return; 43 } 44 if (SAFE(dest)) { 45 struct servent *ent=getservbyport(udp->dest,"udp"); 46 if(ent) { 47 printf(" Dest %i (%s)",htons(udp->dest),ent->s_name); 48 } else { 49 printf(" Dest %i",htons(udp->dest)); 50 } 51 } 52 else { 53 printf("\n"); 54 return; 55 } 33 56 printf("\n UDP:"); 34 57 DISPLAYS(len," Len %u"); -
libpacketdump/ip_6.cc
r950d54a r010fafb 7 7 #include <netinet/in.h> 8 8 #include <assert.h> 9 #include <netdb.h> 9 10 10 11 #define SAFE(x) \ … … 53 54 struct tcphdr *tcp = (struct tcphdr*)packet; 54 55 printf(" TCP:"); 55 DISPLAYS(source," Source %i") 56 DISPLAYS(dest," Dest %i") 56 if (SAFE(source)) { 57 struct servent *ent=getservbyport(tcp->source,"tcp"); 58 if(ent) { 59 printf(" Source %i (%s)",htons(tcp->source),ent->s_name); 60 } else { 61 printf(" Source %i",htons(tcp->source)); 62 } 63 } 64 else { 65 printf("\n"); 66 return; 67 } 68 if (SAFE(dest)) { 69 struct servent *ent=getservbyport(tcp->dest,"tcp"); 70 if(ent) { 71 printf(" Dest %i (%s)",htons(tcp->dest),ent->s_name); 72 } else { 73 printf(" Dest %i",htons(tcp->dest)); 74 } 75 } 76 else { 77 printf("\n"); 78 return; 79 } 57 80 printf("\n TCP:"); 58 81 DISPLAYL(seq," Seq %u");
Note: See TracChangeset
for help on using the changeset viewer.