140dbba57SAssar Westerlund /*- 27f2d13d6SPedro F. Giffuni * SPDX-License-Identifier: BSD-3-Clause 37f2d13d6SPedro F. Giffuni * 440dbba57SAssar Westerlund * Copyright (c) 2000 Assar Westerlund 540dbba57SAssar Westerlund * All rights reserved. 640dbba57SAssar Westerlund * 740dbba57SAssar Westerlund * Redistribution and use in source and binary forms, with or without 840dbba57SAssar Westerlund * modification, are permitted provided that the following conditions 940dbba57SAssar Westerlund * are met: 1040dbba57SAssar Westerlund * 1. Redistributions of source code must retain the above copyright 1140dbba57SAssar Westerlund * notice, this list of conditions and the following disclaimer 1240dbba57SAssar Westerlund * in this position and unchanged. 1340dbba57SAssar Westerlund * 2. Redistributions in binary form must reproduce the above copyright 1440dbba57SAssar Westerlund * notice, this list of conditions and the following disclaimer in the 1540dbba57SAssar Westerlund * documentation and/or other materials provided with the distribution. 1640dbba57SAssar Westerlund * 3. The name of the author may not be used to endorse or promote products 1721dc7d4fSJens Schweikhardt * derived from this software without specific prior written permission 1840dbba57SAssar Westerlund * 1940dbba57SAssar Westerlund * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 2040dbba57SAssar Westerlund * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 2140dbba57SAssar Westerlund * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 2240dbba57SAssar Westerlund * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 2340dbba57SAssar Westerlund * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 2440dbba57SAssar Westerlund * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2540dbba57SAssar Westerlund * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2640dbba57SAssar Westerlund * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2740dbba57SAssar Westerlund * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 2840dbba57SAssar Westerlund * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2940dbba57SAssar Westerlund */ 3040dbba57SAssar Westerlund 3140dbba57SAssar Westerlund #ifndef _LINUX_SOCKET_H_ 3240dbba57SAssar Westerlund #define _LINUX_SOCKET_H_ 3340dbba57SAssar Westerlund 3440dbba57SAssar Westerlund /* msg flags in recvfrom/recvmsg */ 3540dbba57SAssar Westerlund 3640dbba57SAssar Westerlund #define LINUX_MSG_OOB 0x01 3740dbba57SAssar Westerlund #define LINUX_MSG_PEEK 0x02 3840dbba57SAssar Westerlund #define LINUX_MSG_DONTROUTE 0x04 3940dbba57SAssar Westerlund #define LINUX_MSG_CTRUNC 0x08 4040dbba57SAssar Westerlund #define LINUX_MSG_PROXY 0x10 4140dbba57SAssar Westerlund #define LINUX_MSG_TRUNC 0x20 4240dbba57SAssar Westerlund #define LINUX_MSG_DONTWAIT 0x40 4340dbba57SAssar Westerlund #define LINUX_MSG_EOR 0x80 4440dbba57SAssar Westerlund #define LINUX_MSG_WAITALL 0x100 4540dbba57SAssar Westerlund #define LINUX_MSG_FIN 0x200 4640dbba57SAssar Westerlund #define LINUX_MSG_SYN 0x400 4740dbba57SAssar Westerlund #define LINUX_MSG_CONFIRM 0x800 4840dbba57SAssar Westerlund #define LINUX_MSG_RST 0x1000 4940dbba57SAssar Westerlund #define LINUX_MSG_ERRQUEUE 0x2000 5040dbba57SAssar Westerlund #define LINUX_MSG_NOSIGNAL 0x4000 51e1ff74c0SDmitry Chagin #define LINUX_MSG_WAITFORONE 0x10000 523a72bf04SDmitry Chagin #define LINUX_MSG_CMSG_CLOEXEC 0x40000000 5340dbba57SAssar Westerlund 54b7aaa9fdSDmitry Chagin struct l_msghdr { 55b7aaa9fdSDmitry Chagin l_uintptr_t msg_name; 56b7aaa9fdSDmitry Chagin l_int msg_namelen; 57b7aaa9fdSDmitry Chagin l_uintptr_t msg_iov; 58b7aaa9fdSDmitry Chagin l_size_t msg_iovlen; 59b7aaa9fdSDmitry Chagin l_uintptr_t msg_control; 60b7aaa9fdSDmitry Chagin l_size_t msg_controllen; 61b7aaa9fdSDmitry Chagin l_uint msg_flags; 62b7aaa9fdSDmitry Chagin }; 63b7aaa9fdSDmitry Chagin 64e1ff74c0SDmitry Chagin struct l_mmsghdr { 65e1ff74c0SDmitry Chagin struct l_msghdr msg_hdr; 66e1ff74c0SDmitry Chagin l_uint msg_len; 67e1ff74c0SDmitry Chagin 68e1ff74c0SDmitry Chagin }; 69e1ff74c0SDmitry Chagin 70b7aaa9fdSDmitry Chagin struct l_cmsghdr { 71b7aaa9fdSDmitry Chagin l_size_t cmsg_len; 72b7aaa9fdSDmitry Chagin l_int cmsg_level; 73b7aaa9fdSDmitry Chagin l_int cmsg_type; 74b7aaa9fdSDmitry Chagin }; 75b7aaa9fdSDmitry Chagin 761ce4275dSPedro F. Giffuni /* Ancillary data object information macros */ 7774f5d680SKonstantin Belousov 7874f5d680SKonstantin Belousov #define LINUX_CMSG_ALIGN(len) roundup2(len, sizeof(l_ulong)) 7974f5d680SKonstantin Belousov #define LINUX_CMSG_DATA(cmsg) ((void *)((char *)(cmsg) + \ 8074f5d680SKonstantin Belousov LINUX_CMSG_ALIGN(sizeof(struct l_cmsghdr)))) 8174f5d680SKonstantin Belousov #define LINUX_CMSG_SPACE(len) (LINUX_CMSG_ALIGN(sizeof(struct l_cmsghdr)) + \ 8274f5d680SKonstantin Belousov LINUX_CMSG_ALIGN(len)) 8374f5d680SKonstantin Belousov #define LINUX_CMSG_LEN(len) (LINUX_CMSG_ALIGN(sizeof(struct l_cmsghdr)) + \ 8474f5d680SKonstantin Belousov (len)) 8574f5d680SKonstantin Belousov #define LINUX_CMSG_FIRSTHDR(msg) \ 8674f5d680SKonstantin Belousov ((msg)->msg_controllen >= \ 8774f5d680SKonstantin Belousov sizeof(struct l_cmsghdr) ? \ 88605da56bSAndriy Gapon (struct l_cmsghdr *) \ 89605da56bSAndriy Gapon PTRIN((msg)->msg_control) : \ 9074f5d680SKonstantin Belousov (struct l_cmsghdr *)(NULL)) 9174f5d680SKonstantin Belousov #define LINUX_CMSG_NXTHDR(msg, cmsg) \ 9274f5d680SKonstantin Belousov ((((char *)(cmsg) + \ 9374f5d680SKonstantin Belousov LINUX_CMSG_ALIGN((cmsg)->cmsg_len) + \ 9474f5d680SKonstantin Belousov sizeof(*(cmsg))) > \ 95605da56bSAndriy Gapon (((char *)PTRIN((msg)->msg_control)) + \ 9674f5d680SKonstantin Belousov (msg)->msg_controllen)) ? \ 9774f5d680SKonstantin Belousov (struct l_cmsghdr *) NULL : \ 9874f5d680SKonstantin Belousov (struct l_cmsghdr *)((char *)(cmsg) + \ 9974f5d680SKonstantin Belousov LINUX_CMSG_ALIGN((cmsg)->cmsg_len))) 10074f5d680SKonstantin Belousov 10174f5d680SKonstantin Belousov #define CMSG_HDRSZ CMSG_LEN(0) 10274f5d680SKonstantin Belousov #define L_CMSG_HDRSZ LINUX_CMSG_LEN(0) 10374f5d680SKonstantin Belousov 104eeb63e51SDmitry Chagin /* Supported socket types */ 105eeb63e51SDmitry Chagin 106eeb63e51SDmitry Chagin #define LINUX_SOCK_STREAM 1 107eeb63e51SDmitry Chagin #define LINUX_SOCK_DGRAM 2 108eeb63e51SDmitry Chagin #define LINUX_SOCK_RAW 3 109eeb63e51SDmitry Chagin #define LINUX_SOCK_RDM 4 110eeb63e51SDmitry Chagin #define LINUX_SOCK_SEQPACKET 5 111eeb63e51SDmitry Chagin 112eeb63e51SDmitry Chagin #define LINUX_SOCK_MAX LINUX_SOCK_SEQPACKET 113eeb63e51SDmitry Chagin 1143933bde2SDmitry Chagin #define LINUX_SOCK_TYPE_MASK 0xf 1153933bde2SDmitry Chagin 1163933bde2SDmitry Chagin /* Flags for socket, socketpair, accept4 */ 1173933bde2SDmitry Chagin 1183933bde2SDmitry Chagin #define LINUX_SOCK_CLOEXEC LINUX_O_CLOEXEC 1193933bde2SDmitry Chagin #define LINUX_SOCK_NONBLOCK LINUX_O_NONBLOCK 1203933bde2SDmitry Chagin 121d4dd69c4SDmitry Chagin struct l_ucred { 122d4dd69c4SDmitry Chagin uint32_t pid; 123d4dd69c4SDmitry Chagin uint32_t uid; 124d4dd69c4SDmitry Chagin uint32_t gid; 125d4dd69c4SDmitry Chagin }; 126d4dd69c4SDmitry Chagin 127*6ecab394SDmitry Chagin #if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32)) 128fc7510aeSEd Maste 129a12b9b3dSDmitry Chagin struct linux_accept_args { 13056fba8e6SDmitry Chagin register_t s; 13156fba8e6SDmitry Chagin register_t addr; 13256fba8e6SDmitry Chagin register_t namelen; 133a12b9b3dSDmitry Chagin }; 134a12b9b3dSDmitry Chagin 135a12b9b3dSDmitry Chagin int linux_accept(struct thread *td, struct linux_accept_args *args); 136a12b9b3dSDmitry Chagin 137d825ce0aSJohn Baldwin /* Operations for socketcall */ 138d825ce0aSJohn Baldwin #define LINUX_SOCKET 1 139d825ce0aSJohn Baldwin #define LINUX_BIND 2 140d825ce0aSJohn Baldwin #define LINUX_CONNECT 3 141d825ce0aSJohn Baldwin #define LINUX_LISTEN 4 142d825ce0aSJohn Baldwin #define LINUX_ACCEPT 5 143d825ce0aSJohn Baldwin #define LINUX_GETSOCKNAME 6 144d825ce0aSJohn Baldwin #define LINUX_GETPEERNAME 7 145d825ce0aSJohn Baldwin #define LINUX_SOCKETPAIR 8 146d825ce0aSJohn Baldwin #define LINUX_SEND 9 147d825ce0aSJohn Baldwin #define LINUX_RECV 10 148d825ce0aSJohn Baldwin #define LINUX_SENDTO 11 149d825ce0aSJohn Baldwin #define LINUX_RECVFROM 12 150d825ce0aSJohn Baldwin #define LINUX_SHUTDOWN 13 151d825ce0aSJohn Baldwin #define LINUX_SETSOCKOPT 14 152d825ce0aSJohn Baldwin #define LINUX_GETSOCKOPT 15 153d825ce0aSJohn Baldwin #define LINUX_SENDMSG 16 154d825ce0aSJohn Baldwin #define LINUX_RECVMSG 17 155d825ce0aSJohn Baldwin #define LINUX_ACCEPT4 18 156e1ff74c0SDmitry Chagin #define LINUX_RECVMMSG 19 157e1ff74c0SDmitry Chagin #define LINUX_SENDMMSG 20 158fc7510aeSEd Maste #define LINUX_SENDFILE 21 159fc7510aeSEd Maste 160*6ecab394SDmitry Chagin #endif /* __i386__ || (__amd64__ && COMPAT_LINUX32) */ 161d825ce0aSJohn Baldwin 16285712939SDmitry Chagin /* Socket defines */ 16385712939SDmitry Chagin #define LINUX_SOL_SOCKET 1 16485712939SDmitry Chagin 16585712939SDmitry Chagin #define LINUX_SO_DEBUG 1 16685712939SDmitry Chagin #define LINUX_SO_REUSEADDR 2 16785712939SDmitry Chagin #define LINUX_SO_TYPE 3 16885712939SDmitry Chagin #define LINUX_SO_ERROR 4 16985712939SDmitry Chagin #define LINUX_SO_DONTROUTE 5 17085712939SDmitry Chagin #define LINUX_SO_BROADCAST 6 17185712939SDmitry Chagin #define LINUX_SO_SNDBUF 7 17285712939SDmitry Chagin #define LINUX_SO_RCVBUF 8 17385712939SDmitry Chagin #define LINUX_SO_KEEPALIVE 9 17485712939SDmitry Chagin #define LINUX_SO_OOBINLINE 10 17585712939SDmitry Chagin #define LINUX_SO_NO_CHECK 11 17685712939SDmitry Chagin #define LINUX_SO_PRIORITY 12 17785712939SDmitry Chagin #define LINUX_SO_LINGER 13 1783bc69ad9SEdward Tomasz Napierala #define LINUX_SO_REUSEPORT 15 17985712939SDmitry Chagin #ifndef LINUX_SO_PASSCRED /* powerpc differs */ 18085712939SDmitry Chagin #define LINUX_SO_PASSCRED 16 18185712939SDmitry Chagin #define LINUX_SO_PEERCRED 17 18285712939SDmitry Chagin #define LINUX_SO_RCVLOWAT 18 18385712939SDmitry Chagin #define LINUX_SO_SNDLOWAT 19 18485712939SDmitry Chagin #define LINUX_SO_RCVTIMEO 20 18585712939SDmitry Chagin #define LINUX_SO_SNDTIMEO 21 18685712939SDmitry Chagin #endif 1870e26e54bSDmitry Chagin #define LINUX_SO_TIMESTAMPO 29 1880e26e54bSDmitry Chagin #define LINUX_SO_TIMESTAMPN 63 18971bc8bcfSDmitry Chagin #define LINUX_SO_TIMESTAMPNSO 35 19071bc8bcfSDmitry Chagin #define LINUX_SO_TIMESTAMPNSN 64 19185712939SDmitry Chagin #define LINUX_SO_ACCEPTCONN 30 192e44a78ceSEdward Tomasz Napierala #define LINUX_SO_PEERSEC 31 193c31a6a66SEdward Tomasz Napierala #define LINUX_SO_SNDBUFFORCE 32 194c31a6a66SEdward Tomasz Napierala #define LINUX_SO_RCVBUFFORCE 33 1954fe5361cSEdward Tomasz Napierala #define LINUX_SO_PROTOCOL 38 196cf312f79SDmitry Chagin #define LINUX_SO_DOMAIN 39 197cd84c82cSEdward Tomasz Napierala #define LINUX_SO_PEERGROUPS 59 19885712939SDmitry Chagin 199f409a7c5SDmitry Chagin /* Socket-level control message types */ 200f409a7c5SDmitry Chagin 201f409a7c5SDmitry Chagin #define LINUX_SCM_RIGHTS 0x01 202f409a7c5SDmitry Chagin #define LINUX_SCM_CREDENTIALS 0x02 2030e26e54bSDmitry Chagin #define LINUX_SCM_TIMESTAMPO LINUX_SO_TIMESTAMPO 2040e26e54bSDmitry Chagin #define LINUX_SCM_TIMESTAMPN LINUX_SO_TIMESTAMPN 20571bc8bcfSDmitry Chagin #define LINUX_SCM_TIMESTAMPNSO LINUX_SO_TIMESTAMPNSO 20671bc8bcfSDmitry Chagin #define LINUX_SCM_TIMESTAMPNSN LINUX_SO_TIMESTAMPNSN 207f409a7c5SDmitry Chagin 208d825ce0aSJohn Baldwin /* Socket options */ 209d825ce0aSJohn Baldwin #define LINUX_IP_TOS 1 210d825ce0aSJohn Baldwin #define LINUX_IP_TTL 2 211d825ce0aSJohn Baldwin #define LINUX_IP_HDRINCL 3 212d825ce0aSJohn Baldwin #define LINUX_IP_OPTIONS 4 2138ec6c4a3SAlexander Leidinger #define LINUX_IP_ROUTER_ALERT 5 2148ec6c4a3SAlexander Leidinger #define LINUX_IP_RECVOPTS 6 2158ec6c4a3SAlexander Leidinger #define LINUX_IP_RETOPTS 7 2168ec6c4a3SAlexander Leidinger #define LINUX_IP_PKTINFO 8 2178ec6c4a3SAlexander Leidinger #define LINUX_IP_PKTOPTIONS 9 2188ec6c4a3SAlexander Leidinger #define LINUX_IP_MTU_DISCOVER 10 219da6d8ae6SEdward Tomasz Napierala #define LINUX_IP_RECVERR 11 2208ec6c4a3SAlexander Leidinger #define LINUX_IP_RECVTTL 12 2218ec6c4a3SAlexander Leidinger #define LINUX_IP_RECVTOS 13 2228ec6c4a3SAlexander Leidinger #define LINUX_IP_MTU 14 2238ec6c4a3SAlexander Leidinger #define LINUX_IP_FREEBIND 15 2248ec6c4a3SAlexander Leidinger #define LINUX_IP_IPSEC_POLICY 16 2258ec6c4a3SAlexander Leidinger #define LINUX_IP_XFRM_POLICY 17 2268ec6c4a3SAlexander Leidinger #define LINUX_IP_PASSSEC 18 2278ec6c4a3SAlexander Leidinger #define LINUX_IP_TRANSPARENT 19 2288ec6c4a3SAlexander Leidinger 229f8a66150SDmitry Chagin #define LINUX_IP_ORIGDSTADDR 20 230f8a66150SDmitry Chagin #define LINUX_IP_RECVORIGDSTADDR LINUX_IP_ORIGDSTADDR 2318ec6c4a3SAlexander Leidinger #define LINUX_IP_MINTTL 21 2328ec6c4a3SAlexander Leidinger #define LINUX_IP_NODEFRAG 22 2338ec6c4a3SAlexander Leidinger #define LINUX_IP_CHECKSUM 23 2348ec6c4a3SAlexander Leidinger #define LINUX_IP_BIND_ADDRESS_NO_PORT 24 2358ec6c4a3SAlexander Leidinger #define LINUX_IP_RECVFRAGSIZE 25 236d825ce0aSJohn Baldwin 237d825ce0aSJohn Baldwin #define LINUX_IP_MULTICAST_IF 32 238d825ce0aSJohn Baldwin #define LINUX_IP_MULTICAST_TTL 33 239d825ce0aSJohn Baldwin #define LINUX_IP_MULTICAST_LOOP 34 240d825ce0aSJohn Baldwin #define LINUX_IP_ADD_MEMBERSHIP 35 241d825ce0aSJohn Baldwin #define LINUX_IP_DROP_MEMBERSHIP 36 2428ec6c4a3SAlexander Leidinger #define LINUX_IP_UNBLOCK_SOURCE 37 2438ec6c4a3SAlexander Leidinger #define LINUX_IP_BLOCK_SOURCE 38 2448ec6c4a3SAlexander Leidinger #define LINUX_IP_ADD_SOURCE_MEMBERSHIP 39 2458ec6c4a3SAlexander Leidinger #define LINUX_IP_DROP_SOURCE_MEMBERSHIP 40 2468ec6c4a3SAlexander Leidinger #define LINUX_IP_MSFILTER 41 247d825ce0aSJohn Baldwin 2488ec6c4a3SAlexander Leidinger #define LINUX_MCAST_JOIN_GROUP 42 2498ec6c4a3SAlexander Leidinger #define LINUX_MCAST_BLOCK_SOURCE 43 2508ec6c4a3SAlexander Leidinger #define LINUX_MCAST_UNBLOCK_SOURCE 44 2518ec6c4a3SAlexander Leidinger #define LINUX_MCAST_LEAVE_GROUP 45 2528ec6c4a3SAlexander Leidinger #define LINUX_MCAST_JOIN_SOURCE_GROUP 46 2538ec6c4a3SAlexander Leidinger #define LINUX_MCAST_LEAVE_SOURCE_GROUP 47 2548ec6c4a3SAlexander Leidinger #define LINUX_MCAST_MSFILTER 48 2558ec6c4a3SAlexander Leidinger #define LINUX_IP_MULTICAST_ALL 49 2568ec6c4a3SAlexander Leidinger #define LINUX_IP_UNICAST_IF 50 2578ec6c4a3SAlexander Leidinger 2588ec6c4a3SAlexander Leidinger #define LINUX_IPV6_ADDRFORM 1 2598ec6c4a3SAlexander Leidinger #define LINUX_IPV6_2292PKTINFO 2 2608ec6c4a3SAlexander Leidinger #define LINUX_IPV6_2292HOPOPTS 3 2618ec6c4a3SAlexander Leidinger #define LINUX_IPV6_2292DSTOPTS 4 2628ec6c4a3SAlexander Leidinger #define LINUX_IPV6_2292RTHDR 5 2638ec6c4a3SAlexander Leidinger #define LINUX_IPV6_2292PKTOPTIONS 6 26486a9058bSAndrey V. Elsukov #define LINUX_IPV6_CHECKSUM 7 2658ec6c4a3SAlexander Leidinger #define LINUX_IPV6_2292HOPLIMIT 8 26686a9058bSAndrey V. Elsukov #define LINUX_IPV6_NEXTHOP 9 2678ec6c4a3SAlexander Leidinger #define LINUX_IPV6_AUTHHDR 10 2688ec6c4a3SAlexander Leidinger #define LINUX_IPV6_FLOWINFO 11 2698ec6c4a3SAlexander Leidinger 27086a9058bSAndrey V. Elsukov #define LINUX_IPV6_UNICAST_HOPS 16 27186a9058bSAndrey V. Elsukov #define LINUX_IPV6_MULTICAST_IF 17 27286a9058bSAndrey V. Elsukov #define LINUX_IPV6_MULTICAST_HOPS 18 27386a9058bSAndrey V. Elsukov #define LINUX_IPV6_MULTICAST_LOOP 19 27486a9058bSAndrey V. Elsukov #define LINUX_IPV6_ADD_MEMBERSHIP 20 27586a9058bSAndrey V. Elsukov #define LINUX_IPV6_DROP_MEMBERSHIP 21 2768ec6c4a3SAlexander Leidinger #define LINUX_IPV6_ROUTER_ALERT 22 2778ec6c4a3SAlexander Leidinger #define LINUX_IPV6_MTU_DISCOVER 23 2788ec6c4a3SAlexander Leidinger #define LINUX_IPV6_MTU 24 2798ec6c4a3SAlexander Leidinger #define LINUX_IPV6_RECVERR 25 28086a9058bSAndrey V. Elsukov #define LINUX_IPV6_V6ONLY 26 2818ec6c4a3SAlexander Leidinger #define LINUX_IPV6_JOIN_ANYCAST 27 2828ec6c4a3SAlexander Leidinger #define LINUX_IPV6_LEAVE_ANYCAST 28 2838ec6c4a3SAlexander Leidinger #define LINUX_IPV6_MULTICAST_ALL 29 2848ec6c4a3SAlexander Leidinger #define LINUX_IPV6_ROUTER_ALERT_ISOLATE 30 2858ec6c4a3SAlexander Leidinger 2868ec6c4a3SAlexander Leidinger #define LINUX_IPV6_FLOWLABEL_MGR 32 2878ec6c4a3SAlexander Leidinger #define LINUX_IPV6_FLOWINFO_SEND 33 2888ec6c4a3SAlexander Leidinger 2898ec6c4a3SAlexander Leidinger #define LINUX_IPV6_IPSEC_POLICY 34 2908ec6c4a3SAlexander Leidinger #define LINUX_IPV6_XFRM_POLICY 35 2918ec6c4a3SAlexander Leidinger #define LINUX_IPV6_HDRINCL 36 29286a9058bSAndrey V. Elsukov 29386a9058bSAndrey V. Elsukov #define LINUX_IPV6_RECVPKTINFO 49 29486a9058bSAndrey V. Elsukov #define LINUX_IPV6_PKTINFO 50 29586a9058bSAndrey V. Elsukov #define LINUX_IPV6_RECVHOPLIMIT 51 29686a9058bSAndrey V. Elsukov #define LINUX_IPV6_HOPLIMIT 52 29786a9058bSAndrey V. Elsukov #define LINUX_IPV6_RECVHOPOPTS 53 29886a9058bSAndrey V. Elsukov #define LINUX_IPV6_HOPOPTS 54 29986a9058bSAndrey V. Elsukov #define LINUX_IPV6_RTHDRDSTOPTS 55 30086a9058bSAndrey V. Elsukov #define LINUX_IPV6_RECVRTHDR 56 30186a9058bSAndrey V. Elsukov #define LINUX_IPV6_RTHDR 57 30286a9058bSAndrey V. Elsukov #define LINUX_IPV6_RECVDSTOPTS 58 30386a9058bSAndrey V. Elsukov #define LINUX_IPV6_DSTOPTS 59 30486a9058bSAndrey V. Elsukov #define LINUX_IPV6_RECVPATHMTU 60 30586a9058bSAndrey V. Elsukov #define LINUX_IPV6_PATHMTU 61 30686a9058bSAndrey V. Elsukov #define LINUX_IPV6_DONTFRAG 62 30786a9058bSAndrey V. Elsukov 3088ec6c4a3SAlexander Leidinger #define LINUX_IPV6_AUTOFLOWLABEL 70 3098ec6c4a3SAlexander Leidinger #define LINUX_IPV6_ADDR_PREFERENCES 72 3108ec6c4a3SAlexander Leidinger #define LINUX_IPV6_MINHOPCOUNT 73 3118ec6c4a3SAlexander Leidinger #define LINUX_IPV6_ORIGDSTADDR 74 3128ec6c4a3SAlexander Leidinger #define LINUX_IPV6_TRANSPARENT 75 3138ec6c4a3SAlexander Leidinger #define LINUX_IPV6_UNICAST_IF 76 3148ec6c4a3SAlexander Leidinger #define LINUX_IPV6_RECVFRAGSIZE 77 3158ec6c4a3SAlexander Leidinger #define LINUX_IPV6_FREEBIND 78 3168ec6c4a3SAlexander Leidinger 317d825ce0aSJohn Baldwin #define LINUX_TCP_NODELAY 1 318d825ce0aSJohn Baldwin #define LINUX_TCP_MAXSEG 2 319c2d47457SEdward Tomasz Napierala #define LINUX_TCP_CORK 3 320d825ce0aSJohn Baldwin #define LINUX_TCP_KEEPIDLE 4 321d825ce0aSJohn Baldwin #define LINUX_TCP_KEEPINTVL 5 322d825ce0aSJohn Baldwin #define LINUX_TCP_KEEPCNT 6 32399f563edSEdward Tomasz Napierala #define LINUX_TCP_INFO 11 324d825ce0aSJohn Baldwin #define LINUX_TCP_MD5SIG 14 325d825ce0aSJohn Baldwin 326cabbfb60SDmitry Chagin struct l_ifmap { 327cabbfb60SDmitry Chagin l_ulong mem_start; 328cabbfb60SDmitry Chagin l_ulong mem_end; 329cabbfb60SDmitry Chagin l_ushort base_addr; 330cabbfb60SDmitry Chagin u_char irq; 331cabbfb60SDmitry Chagin u_char dma; 332cabbfb60SDmitry Chagin u_char port; 333cabbfb60SDmitry Chagin /* 3 bytes spare */ 334cabbfb60SDmitry Chagin }; 335cabbfb60SDmitry Chagin 336a927409cSDmitry Chagin /* 337a927409cSDmitry Chagin * Careful changing the declaration of this structure. 338a927409cSDmitry Chagin * To use FreeBSD names to access the struct l_ifreq members the 339a927409cSDmitry Chagin * member names of struct l_ifreq should be equal to the FreeBSD. 340a927409cSDmitry Chagin */ 341cabbfb60SDmitry Chagin struct l_ifreq { 342a927409cSDmitry Chagin char ifr_name[LINUX_IFNAMSIZ]; 343cabbfb60SDmitry Chagin union { 344cabbfb60SDmitry Chagin struct l_sockaddr ifru_addr; 345cabbfb60SDmitry Chagin struct l_sockaddr ifru_dstaddr; 346cabbfb60SDmitry Chagin struct l_sockaddr ifru_broadaddr; 347cabbfb60SDmitry Chagin struct l_sockaddr ifru_netmask; 348cabbfb60SDmitry Chagin struct l_sockaddr ifru_hwaddr; 349cabbfb60SDmitry Chagin l_short ifru_flags[1]; 350a927409cSDmitry Chagin l_int ifru_index; 351cabbfb60SDmitry Chagin l_int ifru_mtu; 352cabbfb60SDmitry Chagin struct l_ifmap ifru_map; 353cabbfb60SDmitry Chagin char ifru_slave[LINUX_IFNAMSIZ]; 354cabbfb60SDmitry Chagin char ifru_newname[LINUX_IFNAMSIZ]; 355cabbfb60SDmitry Chagin l_uintptr_t ifru_data; 356cabbfb60SDmitry Chagin } ifr_ifru; 357cabbfb60SDmitry Chagin }; 358cabbfb60SDmitry Chagin 359a927409cSDmitry Chagin /* 360a927409cSDmitry Chagin * Define here members which are not exists in the FreeBSD struct ifreq. 361a927409cSDmitry Chagin */ 362cabbfb60SDmitry Chagin #define ifr_hwaddr ifr_ifru.ifru_hwaddr /* MAC address */ 363cabbfb60SDmitry Chagin 36440dbba57SAssar Westerlund #endif /* _LINUX_SOCKET_H_ */ 365