Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libpacketdump/ip_33.c

    rc7062df r387d299  
    66#include <netinet/tcp.h>
    77#include <netinet/in.h>
    8 
    9 #define STRUCT dccp
    10 
    11 #define SAFE(x) \
    12         ((unsigned int)len>=((char*)&STRUCT->x-(char*)STRUCT+sizeof(STRUCT->x)))
    13 #define DISPLAY_EXP(x,fmt,exp) \
    14         if (SAFE(x)) \
    15                 printf(fmt,exp); \
    16         else \
    17                 return;
    18 
    19 #define DISPLAY(x,fmt) DISPLAY_EXP(x,fmt,STRUCT->x)
    20 
    21 #define DISPLAYS(x,fmt) DISPLAY_EXP(x,fmt,htons(STRUCT->x))
    22 #define DISPLAYL(x,fmt) DISPLAY_EXP(x,fmt,htonl(STRUCT->x))
    23 #define DISPLAYIP(x,fmt) DISPLAY_EXP(x,fmt,inet_ntoa(*(struct in_addr*)&STRUCT->x))
    248
    259struct dccphdr {
     
    5034{
    5135        struct dccphdr *dccp = (struct dccphdr*)packet;
    52         DISPLAYS(source," DCCP: Source %i");
    53         DISPLAYS(dest," Dest %i");
     36        DISPLAYS(dccp, source," DCCP: Source %i");
     37        DISPLAYS(dccp, dest," Dest %i");
    5438        if (len>4) {
    5539                printf("\n DCCP: Type %i",dccp->type);
     
    6953        else
    7054                return;
    71         DISPLAY(doff," DCCP: Dataoff: %i\n");
     55        DISPLAY(dccp, doff," DCCP: Dataoff: %i\n");
    7256        if (len>9)
    7357                printf(" DCCP: NDP %i CsLen: %i\n",dccp->ndp,dccp->cslen);
     
    7559                return;
    7660        }
    77         DISPLAY(check," DCCP: Checksum: %i\n");
     61        /* Should this be byteswapped??? */
     62        DISPLAY(dccp, check," DCCP: Checksum: %i\n");
    7863        if (htons(dccp->source) < htons(dccp->dest))
    7964                decode_next(packet+dccp->doff*4,len-dccp->doff*4,"dccp",htons(dccp->source));
Note: See TracChangeset for help on using the changeset viewer.