/* ip.h */ /* EMACS_MODES: c !fill */ /* * This file contains the structure definitions for internet headers. */ /* Packet Data Length */ #define INETLEN 576 /* max. size of inet pkt in bytes */ struct in_name { char in_net; /* Network number */ char in_hhost; /* High part of host id */ char in_mhost; char in_lhost; /* Low part of host id */ }; struct ip { int ip_ihl : 4; /* IN header length in 32 bit words */ int ip_ver : 4; /* Header version */ char ip_tsrv; /* Type of service */ unshort ip_len; /* Total pkt length including header */ unshort ip_id; /* ID to help fragmentation */ unshort ip_foff : 13; /* Fragment offset */ unshort ip_flgs : 3; /* Flags */ char ip_time; /* Life time of packet in seconds */ char ip_prot; /* Protocol number */ unshort ip_chksum; /* Header checksum */ struct in_name ip_src; /* Source name */ struct in_name ip_dest; /* Destination name */ }; /* Constants to fill in Internet Header */ #define IPHSIZ sizeof( struct ip ) /* internet header size */ #define IP_VER 4 /* internet version */ #define IP_IHL 5 /* IN header length in longwords */ #define IP_TSRV 0 /* default type of service */ #define IP_ID 0 /* ==> kernel fills IN id */ #define IP_FLGS 0 /* no fragmentation yet */ #define IP_FOFF 0 /* no fragmentation yet */ #define IP_TIME 255 /* max. possible time to live */ #define CHKSUM 0 /* initial checksum value */ #define MININSIZ 8 /* min. size of IN data area */ /* Macros to swap bytes */ #ifndef BIGINDIAN #define short_to_net(s) (swab (s)) #define long_to_net(l) (((long)(swab (*(unshort *)(&l))) << 16) | \ (swab (*(((unshort *)&l) + 1)))) #else #define short_to_net(s) (s) #define long_to_net(l) (l) #endif /* Externals */ extern struct in_name myhost;