2 ipv4.h -- missing IPv4 related definitions
3 Copyright (C) 2005 Ivo Timmermans
4 2006-2012 Guus Sliepen <guus@tinc-vpn.org>
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License along
17 with this program; if not, write to the Free Software Foundation, Inc.,
18 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 #ifndef __TINC_IPV4_H__
22 #define __TINC_IPV4_H__
29 #define IPPROTO_ICMP 1
32 #ifndef ICMP_DEST_UNREACH
33 #define ICMP_DEST_UNREACH 3
36 #ifndef ICMP_FRAG_NEEDED
37 #define ICMP_FRAG_NEEDED 4
40 #ifndef ICMP_NET_UNKNOWN
41 #define ICMP_NET_UNKNOWN 6
44 #ifndef ICMP_TIME_EXCEEDED
45 #define ICMP_TIME_EXCEEDED 11
49 #define ICMP_EXC_TTL 0
52 #ifndef ICMP_NET_UNREACH
53 #define ICMP_NET_UNREACH 0
57 #define ICMP_NET_ANO 9
64 #ifndef HAVE_STRUCT_IP
66 #if __BYTE_ORDER == __LITTLE_ENDIAN
83 struct in_addr ip_src, ip_dst;
84 } __attribute__ ((__gcc_struct__, __packed__));
88 #define IP_OFFMASK 0x1fff
91 #ifndef HAVE_STRUCT_ICMP
98 struct in_addr ih_gwaddr;
108 uint16_t ipm_nextmtu;
112 uint8_t irt_num_addrs;
114 uint16_t irt_lifetime;
117 #define icmp_pptr icmp_hun.ih_pptr
118 #define icmp_gwaddr icmp_hun.ih_gwaddr
119 #define icmp_id icmp_hun.ih_idseq.icd_id
120 #define icmp_seq icmp_hun.ih_idseq.icd_seq
121 #define icmp_void icmp_hun.ih_void
122 #define icmp_pmvoid icmp_hun.ih_pmtu.ipm_void
123 #define icmp_nextmtu icmp_hun.ih_pmtu.ipm_nextmtu
124 #define icmp_num_addrs icmp_hun.ih_rtradv.irt_num_addrs
125 #define icmp_wpa icmp_hun.ih_rtradv.irt_wpa
126 #define icmp_lifetime icmp_hun.ih_rtradv.irt_lifetime
139 #define icmp_otime icmp_dun.id_ts.its_otime
140 #define icmp_rtime icmp_dun.id_ts.its_rtime
141 #define icmp_ttime icmp_dun.id_ts.its_ttime
142 #define icmp_ip icmp_dun.id_ip.idi_ip
143 #define icmp_radv icmp_dun.id_radv
144 #define icmp_mask icmp_dun.id_mask
145 #define icmp_data icmp_dun.id_data
146 } __attribute__ ((__gcc_struct__, __packed__));
149 #endif /* __TINC_IPV4_H__ */