97 |
# include "arch/epstruct.h" |
# include "arch/epstruct.h" |
98 |
#endif |
#endif |
99 |
|
|
100 |
#define IPH_V(hdr) (NTOHS((hdr)->_v_hl_tos) >> 12) |
#define IPH_V(hdr) (ntohs((hdr)->_v_hl_tos) >> 12) |
101 |
#define IPH_HL(hdr) ((NTOHS((hdr)->_v_hl_tos) >> 8) & 0x0f) |
#define IPH_HL(hdr) ((ntohs((hdr)->_v_hl_tos) >> 8) & 0x0f) |
102 |
#define IPH_TOS(hdr) (HTONS((NTOHS((hdr)->_v_hl_tos) & 0xff))) |
#define IPH_TOS(hdr) (htons((ntohs((hdr)->_v_hl_tos) & 0xff))) |
103 |
#define IPH_LEN(hdr) ((hdr)->_len) |
#define IPH_LEN(hdr) ((hdr)->_len) |
104 |
#define IPH_ID(hdr) ((hdr)->_id) |
#define IPH_ID(hdr) ((hdr)->_id) |
105 |
#define IPH_OFFSET(hdr) ((hdr)->_offset) |
#define IPH_OFFSET(hdr) ((hdr)->_offset) |
106 |
#define IPH_TTL(hdr) (NTOHS((hdr)->_ttl_proto) >> 8) |
#define IPH_TTL(hdr) (ntohs((hdr)->_ttl_proto) >> 8) |
107 |
#define IPH_PROTO(hdr) (NTOHS((hdr)->_ttl_proto) & 0xff) |
#define IPH_PROTO(hdr) (ntohs((hdr)->_ttl_proto) & 0xff) |
108 |
#define IPH_CHKSUM(hdr) ((hdr)->_chksum) |
#define IPH_CHKSUM(hdr) ((hdr)->_chksum) |
109 |
|
|
110 |
#define IPH_VHLTOS_SET(hdr, v, hl, tos) (hdr)->_v_hl_tos = (HTONS(((v) << 12) | ((hl) << 8) | (tos))) |
#define IPH_VHLTOS_SET(hdr, v, hl, tos) (hdr)->_v_hl_tos = (htons(((v) << 12) | ((hl) << 8) | (tos))) |
111 |
#define IPH_LEN_SET(hdr, len) (hdr)->_len = (len) |
#define IPH_LEN_SET(hdr, len) (hdr)->_len = (len) |
112 |
#define IPH_ID_SET(hdr, id) (hdr)->_id = (id) |
#define IPH_ID_SET(hdr, id) (hdr)->_id = (id) |
113 |
#define IPH_OFFSET_SET(hdr, off) (hdr)->_offset = (off) |
#define IPH_OFFSET_SET(hdr, off) (hdr)->_offset = (off) |
114 |
#define IPH_TTL_SET(hdr, ttl) (hdr)->_ttl_proto = (HTONS(IPH_PROTO(hdr) | ((ttl) << 8))) |
#define IPH_TTL_SET(hdr, ttl) (hdr)->_ttl_proto = (htons(IPH_PROTO(hdr) | ((ttl) << 8))) |
115 |
#define IPH_PROTO_SET(hdr, proto) (hdr)->_ttl_proto = (HTONS((proto) | (IPH_TTL(hdr) << 8))) |
#define IPH_PROTO_SET(hdr, proto) (hdr)->_ttl_proto = (htons((proto) | (IPH_TTL(hdr) << 8))) |
116 |
#define IPH_CHKSUM_SET(hdr, chksum) (hdr)->_chksum = (chksum) |
#define IPH_CHKSUM_SET(hdr, chksum) (hdr)->_chksum = (chksum) |
117 |
|
|
118 |
#if IP_DEBUG |
#if IP_DEBUG |