5 ipv4.h -- missing IPv4 related definitions
6 Copyright (C) 2005 Ivo Timmermans
7 2006-2012 Guus Sliepen <guus@tinc-vpn.org>
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License along
20 with this program; if not, write to the Free Software Foundation, Inc.,
21 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
31 #define IPPROTO_ICMP 1
34 #ifndef ICMP_DEST_UNREACH
35 #define ICMP_DEST_UNREACH 3
38 #ifndef ICMP_FRAG_NEEDED
39 #define ICMP_FRAG_NEEDED 4
42 #ifndef ICMP_NET_UNKNOWN
43 #define ICMP_NET_UNKNOWN 6
46 #ifndef ICMP_TIME_EXCEEDED
47 #define ICMP_TIME_EXCEEDED 11
51 #define ICMP_EXC_TTL 0
54 #ifndef ICMP_NET_UNREACH
55 #define ICMP_NET_UNREACH 0
59 #define ICMP_NET_ANO 9
66 #ifndef HAVE_STRUCT_IP
67 #if __BYTE_ORDER == __LITTLE_ENDIAN
68 #define IP_NIBBLE1 ip_hl
69 #define IP_NIBBLE2 ip_v
71 #define IP_NIBBLE1 ip_v
72 #define IP_NIBBLE2 ip_hl
75 uint8_t IP_NIBBLE1: 4;
76 uint8_t IP_NIBBLE2: 4;
84 struct in_addr ip_src, ip_dst;
93 STATIC_ASSERT(sizeof(struct ip) == 20, "ip has incorrect size");
96 #define IP_OFFMASK 0x1fff
99 #ifndef HAVE_STRUCT_ICMP
106 struct in_addr ih_gwaddr;
116 uint16_t ipm_nextmtu;
120 uint8_t irt_num_addrs;
122 uint16_t irt_lifetime;
138 #define icmp_pptr icmp_hun.ih_pptr
139 #define icmp_gwaddr icmp_hun.ih_gwaddr
140 #define icmp_id icmp_hun.ih_idseq.icd_id
141 #define icmp_seq icmp_hun.ih_idseq.icd_seq
142 #define icmp_void icmp_hun.ih_void
143 #define icmp_pmvoid icmp_hun.ih_pmtu.ipm_void
144 #define icmp_nextmtu icmp_hun.ih_pmtu.ipm_nextmtu
145 #define icmp_num_addrs icmp_hun.ih_rtradv.irt_num_addrs
146 #define icmp_wpa icmp_hun.ih_rtradv.irt_wpa
147 #define icmp_lifetime icmp_hun.ih_rtradv.irt_lifetime
148 #define icmp_otime icmp_dun.id_ts.its_otime
149 #define icmp_rtime icmp_dun.id_ts.its_rtime
150 #define icmp_ttime icmp_dun.id_ts.its_ttime
151 #define icmp_ip icmp_dun.id_ip.idi_ip
152 #define icmp_radv icmp_dun.id_radv
153 #define icmp_mask icmp_dun.id_mask
154 #define icmp_data icmp_dun.id_data
157 STATIC_ASSERT(sizeof(struct icmp) == 28, "icmp has incorrect size");