blob: 788a6d9027df5d431c919f4aff6d34751fb2f74f [file] [log] [blame]
Ben Cheng655a7c02013-10-16 16:09:24 -07001/****************************************************************************
2 ****************************************************************************
3 ***
4 *** This header was automatically generated from a Linux kernel header
5 *** of the same name, to make information necessary for userspace to
6 *** call into the kernel available to libc. It contains only constants,
7 *** structures, and macros generated from the original header, and thus,
8 *** contains no copyrightable information.
9 ***
10 *** To edit the content of this header, modify the corresponding
11 *** source file (e.g. under external/kernel-headers/original/) then
12 *** run bionic/libc/kernel/tools/update_all.py
13 ***
14 *** Any manual change here will be lost the next time this script will
15 *** be run. You've been warned!
16 ***
17 ****************************************************************************
18 ****************************************************************************/
19#ifndef _UAPI_LINUX_IN_H
20#define _UAPI_LINUX_IN_H
Elliott Hughes64f355f2017-08-30 16:10:24 -070021#include <bits/ip_msfilter.h>
22#include <bits/ip_mreq_source.h>
23#include <bits/in_addr.h>
Ben Cheng655a7c02013-10-16 16:09:24 -070024#include <linux/types.h>
Christopher Ferris05d08e92016-02-04 13:16:38 -080025#include <linux/libc-compat.h>
Christopher Ferris05d08e92016-02-04 13:16:38 -080026#include <linux/socket.h>
27#if __UAPI_DEF_IN_IPPROTO
Ben Cheng655a7c02013-10-16 16:09:24 -070028enum {
Tao Baod7db5942015-01-28 10:07:51 -080029 IPPROTO_IP = 0,
Christopher Ferris38062f92014-07-09 15:33:25 -070030#define IPPROTO_IP IPPROTO_IP
Tao Baod7db5942015-01-28 10:07:51 -080031 IPPROTO_ICMP = 1,
Christopher Ferris38062f92014-07-09 15:33:25 -070032#define IPPROTO_ICMP IPPROTO_ICMP
Tao Baod7db5942015-01-28 10:07:51 -080033 IPPROTO_IGMP = 2,
Christopher Ferris38062f92014-07-09 15:33:25 -070034#define IPPROTO_IGMP IPPROTO_IGMP
Tao Baod7db5942015-01-28 10:07:51 -080035 IPPROTO_IPIP = 4,
Christopher Ferris38062f92014-07-09 15:33:25 -070036#define IPPROTO_IPIP IPPROTO_IPIP
Tao Baod7db5942015-01-28 10:07:51 -080037 IPPROTO_TCP = 6,
Christopher Ferris38062f92014-07-09 15:33:25 -070038#define IPPROTO_TCP IPPROTO_TCP
Tao Baod7db5942015-01-28 10:07:51 -080039 IPPROTO_EGP = 8,
Christopher Ferris38062f92014-07-09 15:33:25 -070040#define IPPROTO_EGP IPPROTO_EGP
Tao Baod7db5942015-01-28 10:07:51 -080041 IPPROTO_PUP = 12,
Christopher Ferris38062f92014-07-09 15:33:25 -070042#define IPPROTO_PUP IPPROTO_PUP
Tao Baod7db5942015-01-28 10:07:51 -080043 IPPROTO_UDP = 17,
Christopher Ferris38062f92014-07-09 15:33:25 -070044#define IPPROTO_UDP IPPROTO_UDP
Tao Baod7db5942015-01-28 10:07:51 -080045 IPPROTO_IDP = 22,
Christopher Ferris38062f92014-07-09 15:33:25 -070046#define IPPROTO_IDP IPPROTO_IDP
Tao Baod7db5942015-01-28 10:07:51 -080047 IPPROTO_TP = 29,
Christopher Ferris38062f92014-07-09 15:33:25 -070048#define IPPROTO_TP IPPROTO_TP
Tao Baod7db5942015-01-28 10:07:51 -080049 IPPROTO_DCCP = 33,
Christopher Ferris38062f92014-07-09 15:33:25 -070050#define IPPROTO_DCCP IPPROTO_DCCP
Tao Baod7db5942015-01-28 10:07:51 -080051 IPPROTO_IPV6 = 41,
Christopher Ferris38062f92014-07-09 15:33:25 -070052#define IPPROTO_IPV6 IPPROTO_IPV6
Tao Baod7db5942015-01-28 10:07:51 -080053 IPPROTO_RSVP = 46,
Christopher Ferris38062f92014-07-09 15:33:25 -070054#define IPPROTO_RSVP IPPROTO_RSVP
Tao Baod7db5942015-01-28 10:07:51 -080055 IPPROTO_GRE = 47,
Christopher Ferris38062f92014-07-09 15:33:25 -070056#define IPPROTO_GRE IPPROTO_GRE
Tao Baod7db5942015-01-28 10:07:51 -080057 IPPROTO_ESP = 50,
Christopher Ferris38062f92014-07-09 15:33:25 -070058#define IPPROTO_ESP IPPROTO_ESP
Tao Baod7db5942015-01-28 10:07:51 -080059 IPPROTO_AH = 51,
Christopher Ferris38062f92014-07-09 15:33:25 -070060#define IPPROTO_AH IPPROTO_AH
Tao Baod7db5942015-01-28 10:07:51 -080061 IPPROTO_MTP = 92,
Christopher Ferris38062f92014-07-09 15:33:25 -070062#define IPPROTO_MTP IPPROTO_MTP
Tao Baod7db5942015-01-28 10:07:51 -080063 IPPROTO_BEETPH = 94,
Christopher Ferris38062f92014-07-09 15:33:25 -070064#define IPPROTO_BEETPH IPPROTO_BEETPH
Tao Baod7db5942015-01-28 10:07:51 -080065 IPPROTO_ENCAP = 98,
Christopher Ferris38062f92014-07-09 15:33:25 -070066#define IPPROTO_ENCAP IPPROTO_ENCAP
Tao Baod7db5942015-01-28 10:07:51 -080067 IPPROTO_PIM = 103,
Christopher Ferris38062f92014-07-09 15:33:25 -070068#define IPPROTO_PIM IPPROTO_PIM
Tao Baod7db5942015-01-28 10:07:51 -080069 IPPROTO_COMP = 108,
Christopher Ferris38062f92014-07-09 15:33:25 -070070#define IPPROTO_COMP IPPROTO_COMP
Tao Baod7db5942015-01-28 10:07:51 -080071 IPPROTO_SCTP = 132,
Christopher Ferris38062f92014-07-09 15:33:25 -070072#define IPPROTO_SCTP IPPROTO_SCTP
Tao Baod7db5942015-01-28 10:07:51 -080073 IPPROTO_UDPLITE = 136,
Christopher Ferris38062f92014-07-09 15:33:25 -070074#define IPPROTO_UDPLITE IPPROTO_UDPLITE
Christopher Ferris05d08e92016-02-04 13:16:38 -080075 IPPROTO_MPLS = 137,
76#define IPPROTO_MPLS IPPROTO_MPLS
Tao Baod7db5942015-01-28 10:07:51 -080077 IPPROTO_RAW = 255,
Christopher Ferris38062f92014-07-09 15:33:25 -070078#define IPPROTO_RAW IPPROTO_RAW
Tao Baod7db5942015-01-28 10:07:51 -080079 IPPROTO_MAX
Ben Cheng655a7c02013-10-16 16:09:24 -070080};
Christopher Ferris05d08e92016-02-04 13:16:38 -080081#endif
Christopher Ferris05d08e92016-02-04 13:16:38 -080082#if __UAPI_DEF_IN_ADDR
Christopher Ferris05d08e92016-02-04 13:16:38 -080083#endif
Ben Cheng655a7c02013-10-16 16:09:24 -070084#define IP_TOS 1
Ben Cheng655a7c02013-10-16 16:09:24 -070085#define IP_TTL 2
86#define IP_HDRINCL 3
87#define IP_OPTIONS 4
88#define IP_ROUTER_ALERT 5
Ben Cheng655a7c02013-10-16 16:09:24 -070089#define IP_RECVOPTS 6
90#define IP_RETOPTS 7
91#define IP_PKTINFO 8
92#define IP_PKTOPTIONS 9
Ben Cheng655a7c02013-10-16 16:09:24 -070093#define IP_MTU_DISCOVER 10
94#define IP_RECVERR 11
95#define IP_RECVTTL 12
96#define IP_RECVTOS 13
Ben Cheng655a7c02013-10-16 16:09:24 -070097#define IP_MTU 14
98#define IP_FREEBIND 15
99#define IP_IPSEC_POLICY 16
100#define IP_XFRM_POLICY 17
Ben Cheng655a7c02013-10-16 16:09:24 -0700101#define IP_PASSSEC 18
102#define IP_TRANSPARENT 19
103#define IP_RECVRETOPTS IP_RETOPTS
104#define IP_ORIGDSTADDR 20
Ben Cheng655a7c02013-10-16 16:09:24 -0700105#define IP_RECVORIGDSTADDR IP_ORIGDSTADDR
106#define IP_MINTTL 21
Christopher Ferris05d08e92016-02-04 13:16:38 -0800107#define IP_NODEFRAG 22
108#define IP_CHECKSUM 23
109#define IP_BIND_ADDRESS_NO_PORT 24
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800110#define IP_RECVFRAGSIZE 25
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800111#define IP_PMTUDISC_DONT 0
Christopher Ferris05d08e92016-02-04 13:16:38 -0800112#define IP_PMTUDISC_WANT 1
Ben Cheng655a7c02013-10-16 16:09:24 -0700113#define IP_PMTUDISC_DO 2
114#define IP_PMTUDISC_PROBE 3
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800115#define IP_PMTUDISC_INTERFACE 4
Christopher Ferris05d08e92016-02-04 13:16:38 -0800116#define IP_PMTUDISC_OMIT 5
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700117#define IP_MULTICAST_IF 32
Ben Cheng655a7c02013-10-16 16:09:24 -0700118#define IP_MULTICAST_TTL 33
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800119#define IP_MULTICAST_LOOP 34
Christopher Ferris05d08e92016-02-04 13:16:38 -0800120#define IP_ADD_MEMBERSHIP 35
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700121#define IP_DROP_MEMBERSHIP 36
Ben Cheng655a7c02013-10-16 16:09:24 -0700122#define IP_UNBLOCK_SOURCE 37
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800123#define IP_BLOCK_SOURCE 38
Christopher Ferris05d08e92016-02-04 13:16:38 -0800124#define IP_ADD_SOURCE_MEMBERSHIP 39
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700125#define IP_DROP_SOURCE_MEMBERSHIP 40
Ben Cheng655a7c02013-10-16 16:09:24 -0700126#define IP_MSFILTER 41
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800127#define MCAST_JOIN_GROUP 42
Christopher Ferris05d08e92016-02-04 13:16:38 -0800128#define MCAST_BLOCK_SOURCE 43
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700129#define MCAST_UNBLOCK_SOURCE 44
Ben Cheng655a7c02013-10-16 16:09:24 -0700130#define MCAST_LEAVE_GROUP 45
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800131#define MCAST_JOIN_SOURCE_GROUP 46
Christopher Ferris05d08e92016-02-04 13:16:38 -0800132#define MCAST_LEAVE_SOURCE_GROUP 47
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700133#define MCAST_MSFILTER 48
Ben Cheng655a7c02013-10-16 16:09:24 -0700134#define IP_MULTICAST_ALL 49
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800135#define IP_UNICAST_IF 50
Christopher Ferris05d08e92016-02-04 13:16:38 -0800136#define MCAST_EXCLUDE 0
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700137#define MCAST_INCLUDE 1
Ben Cheng655a7c02013-10-16 16:09:24 -0700138#define IP_DEFAULT_MULTICAST_TTL 1
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800139#define IP_DEFAULT_MULTICAST_LOOP 1
Christopher Ferris05d08e92016-02-04 13:16:38 -0800140#if __UAPI_DEF_IP_MREQ
141struct ip_mreq {
Tao Baod7db5942015-01-28 10:07:51 -0800142 struct in_addr imr_multiaddr;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800143 struct in_addr imr_interface;
Ben Cheng655a7c02013-10-16 16:09:24 -0700144};
145struct ip_mreqn {
Tao Baod7db5942015-01-28 10:07:51 -0800146 struct in_addr imr_multiaddr;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800147 struct in_addr imr_address;
Tao Baod7db5942015-01-28 10:07:51 -0800148 int imr_ifindex;
Ben Cheng655a7c02013-10-16 16:09:24 -0700149};
Tao Baod7db5942015-01-28 10:07:51 -0800150#define IP_MSFILTER_SIZE(numsrc) (sizeof(struct ip_msfilter) - sizeof(__u32) + (numsrc) * sizeof(__u32))
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800151struct group_req {
Tao Baod7db5942015-01-28 10:07:51 -0800152 __u32 gr_interface;
Elliott Hughes64f355f2017-08-30 16:10:24 -0700153 struct sockaddr_storage gr_group;
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700154};
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800155struct group_source_req {
Tao Baod7db5942015-01-28 10:07:51 -0800156 __u32 gsr_interface;
Elliott Hughes64f355f2017-08-30 16:10:24 -0700157 struct sockaddr_storage gsr_group;
158 struct sockaddr_storage gsr_source;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800159};
Ben Cheng655a7c02013-10-16 16:09:24 -0700160struct group_filter {
Tao Baod7db5942015-01-28 10:07:51 -0800161 __u32 gf_interface;
Elliott Hughes64f355f2017-08-30 16:10:24 -0700162 struct sockaddr_storage gf_group;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800163 __u32 gf_fmode;
Tao Baod7db5942015-01-28 10:07:51 -0800164 __u32 gf_numsrc;
Elliott Hughes64f355f2017-08-30 16:10:24 -0700165 struct sockaddr_storage gf_slist[1];
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700166};
Elliott Hughes64f355f2017-08-30 16:10:24 -0700167#define GROUP_FILTER_SIZE(numsrc) (sizeof(struct group_filter) - sizeof(struct sockaddr_storage) + (numsrc) * sizeof(struct sockaddr_storage))
Christopher Ferris05d08e92016-02-04 13:16:38 -0800168#endif
169#if __UAPI_DEF_IN_PKTINFO
Ben Cheng655a7c02013-10-16 16:09:24 -0700170struct in_pktinfo {
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800171 int ipi_ifindex;
Tao Baod7db5942015-01-28 10:07:51 -0800172 struct in_addr ipi_spec_dst;
173 struct in_addr ipi_addr;
Ben Cheng655a7c02013-10-16 16:09:24 -0700174};
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800175#endif
Christopher Ferris05d08e92016-02-04 13:16:38 -0800176#if __UAPI_DEF_SOCKADDR_IN
177#define __SOCK_SIZE__ 16
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700178struct sockaddr_in {
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800179 __kernel_sa_family_t sin_family;
Tao Baod7db5942015-01-28 10:07:51 -0800180 __be16 sin_port;
181 struct in_addr sin_addr;
Tao Baod7db5942015-01-28 10:07:51 -0800182 unsigned char __pad[__SOCK_SIZE__ - sizeof(short int) - sizeof(unsigned short int) - sizeof(struct in_addr)];
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800183};
Ben Cheng655a7c02013-10-16 16:09:24 -0700184#define sin_zero __pad
Christopher Ferris05d08e92016-02-04 13:16:38 -0800185#endif
186#if __UAPI_DEF_IN_CLASS
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800187#define IN_CLASSA(a) ((((long int) (a)) & 0x80000000) == 0)
Ben Cheng655a7c02013-10-16 16:09:24 -0700188#define IN_CLASSA_NET 0xff000000
189#define IN_CLASSA_NSHIFT 24
190#define IN_CLASSA_HOST (0xffffffff & ~IN_CLASSA_NET)
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800191#define IN_CLASSA_MAX 128
Ben Cheng655a7c02013-10-16 16:09:24 -0700192#define IN_CLASSB(a) ((((long int) (a)) & 0xc0000000) == 0x80000000)
193#define IN_CLASSB_NET 0xffff0000
194#define IN_CLASSB_NSHIFT 16
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800195#define IN_CLASSB_HOST (0xffffffff & ~IN_CLASSB_NET)
Ben Cheng655a7c02013-10-16 16:09:24 -0700196#define IN_CLASSB_MAX 65536
197#define IN_CLASSC(a) ((((long int) (a)) & 0xe0000000) == 0xc0000000)
198#define IN_CLASSC_NET 0xffffff00
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800199#define IN_CLASSC_NSHIFT 8
Ben Cheng655a7c02013-10-16 16:09:24 -0700200#define IN_CLASSC_HOST (0xffffffff & ~IN_CLASSC_NET)
201#define IN_CLASSD(a) ((((long int) (a)) & 0xf0000000) == 0xe0000000)
202#define IN_MULTICAST(a) IN_CLASSD(a)
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800203#define IN_MULTICAST_NET 0xF0000000
Ben Cheng655a7c02013-10-16 16:09:24 -0700204#define IN_EXPERIMENTAL(a) ((((long int) (a)) & 0xf0000000) == 0xf0000000)
205#define IN_BADCLASS(a) IN_EXPERIMENTAL((a))
206#define INADDR_ANY ((unsigned long int) 0x00000000)
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800207#define INADDR_BROADCAST ((unsigned long int) 0xffffffff)
Ben Cheng655a7c02013-10-16 16:09:24 -0700208#define INADDR_NONE ((unsigned long int) 0xffffffff)
209#define IN_LOOPBACKNET 127
210#define INADDR_LOOPBACK 0x7f000001
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800211#define IN_LOOPBACK(a) ((((long int) (a)) & 0xff000000) == 0x7f000000)
Ben Cheng655a7c02013-10-16 16:09:24 -0700212#define INADDR_UNSPEC_GROUP 0xe0000000U
213#define INADDR_ALLHOSTS_GROUP 0xe0000001U
214#define INADDR_ALLRTRS_GROUP 0xe0000002U
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800215#define INADDR_MAX_LOCAL_GROUP 0xe00000ffU
Christopher Ferris05d08e92016-02-04 13:16:38 -0800216#endif
Ben Cheng655a7c02013-10-16 16:09:24 -0700217#include <asm/byteorder.h>
218#endif