I have a problem to understand how I can use this macro to get the lenght of the IP header. I have a file called framehdr.h and I have included that file in my main.c. The struct in the framehdr.h file look like this:
struct ip_hdr {
    unsigned char vhl;     /* Version and header length */
    unsigned char tos;     /* Type of service */
    unsigned short len;    /* Total length */
    unsigned short id;     /* Identification */
    unsigned short off;    /* Fragment offset field */
    unsigned char ttl;     /* Time to live */
    unsigned char p;       /* Protocol */
    unsigned short ip_sum; /* Checksum */
    unsigned int src, dst; /* Source and dest address */
};
I can manually get the lentgh by adding all the sizes like this:
unsigned int sizeIP = sizeof(testOne.vhl) + sizeof(testOne.tos)    +
                      sizeof(testOne.len) + sizeof(testOne.id)     + 
                      sizeof(testOne.off) + sizeof(testOne.ttl)    + 
                      sizeof(testOne.p)   + sizeof(testOne.ip_sum) +
                      sizeof(testOne.src) + sizeof(testOne.dst);
But I'm suppose to use the macro that look like this to get the size:
#define IP_HL(ip) ((((ip)->vhl) & 0x0f) * 4)
What does this macro return? Is it a digit so I can store it in a int and then print it or how does it work?
 
     
    