The structure of IP.

In the header file <netinet/ip.h> structure defined in IP is that
  1. struct ip
  2. {
  3. #if __BYTE_ORDER == __LITTLE_ENDIAN
  4. unsigned int ip_hl:4; /* header length */
  5. unsigned int ip_v:4; /* version */
  6. #endif
  7. #if __BYTE_ORDER == __BIG_ENDIAN
  8. unsigned int ip_v:4; /* version */
  9. unsigned int ip_hl:4; /* header length */
  10. #endif

  11. Omission of other fields...
  12. }
I wonder why byte order different will let ip_v field and the ip_hl field location swap? Byte order is not only affects between byte order please?

Started by Ritchie at January 01, 2017 - 7:46 AM

Guess: byte order about a domain Is it right? No specification? This is strongly related with GCC? GCC provides the implementing method

Posted by Arvin at January 07, 2017 - 8:00 AM

Guess: byte order about a domain Is it right? No specification? This is strongly related with GCC? GCC provides the implementing method

Posted by Arvin at January 09, 2017 - 8:43 AM