xref: /netbsd/sys/compat/linux/common/linux_socket.h (revision bf9ec67e)
1 /*	$NetBSD: linux_socket.h,v 1.10 2002/01/14 23:14:43 bjh21 Exp $	*/
2 
3 /*-
4  * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
5  * All rights reserved.
6  *
7  * This code is derived from software contributed to The NetBSD Foundation
8  * by Frank van der Linden and Eric Haszlakiewicz.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the
17  *    documentation and/or other materials provided with the distribution.
18  * 3. All advertising materials mentioning features or use of this software
19  *    must display the following acknowledgement:
20  *	This product includes software developed by the NetBSD
21  *	Foundation, Inc. and its contributors.
22  * 4. Neither the name of The NetBSD Foundation nor the names of its
23  *    contributors may be used to endorse or promote products derived
24  *    from this software without specific prior written permission.
25  *
26  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36  * POSSIBILITY OF SUCH DAMAGE.
37  */
38 
39 #ifndef _LINUX_SOCKET_H
40 #define _LINUX_SOCKET_H
41 
42 /*
43  * Various Linux socket defines. Everything that is not re-defined here
44  * is the same as in NetBSD.
45  *
46  * COMPAT_43 is assumed, and the osockaddr struct is used (it is what
47  * Linux uses)
48  */
49 
50 /*
51  * Address families. There are fewer of them, and they're numbered
52  * a bit different
53  */
54 
55 #define LINUX_AF_UNSPEC		0
56 #define LINUX_AF_UNIX		1
57 #define LINUX_AF_INET		2
58 #define LINUX_AF_AX25		3
59 #define LINUX_AF_IPX		4
60 #define LINUX_AF_APPLETALK	5
61 #define LINUX_AF_NETROM		6
62 #define LINUX_AF_BRIDGE		7
63 #define LINUX_AF_ATMPVC		8
64 #define LINUX_AF_X25		9
65 #define LINUX_AF_INET6		10
66 #define LINUX_AF_ROSE		11
67 #define LINUX_AF_DECnet		12
68 #define LINUX_AF_NETBEUI	13
69 #define LINUX_AF_SECURITY	14
70 #define LINUX_pseudo_AF_KEY	15
71 #define LINUX_AF_NETLINK	16
72 #define LINUX_AF_PACKET		17
73 #define LINUX_AF_ASH		18
74 #define LINUX_AF_ECONET		19
75 #define	LINUX_AF_ATMSVC		20
76 #define	LINUX_AF_SNA		22
77 #define LINUX_AF_MAX		32
78 
79 /*
80  * Option levels for [gs]etsockopt(2). Only SOL_SOCKET is different,
81  * the rest matches IPPROTO_XXX
82  */
83 
84 /* SOL_SOCKET is machine dependant on Linux */
85 #define LINUX_SOL_IP		0
86 #define LINUX_SOL_TCP		6
87 #define LINUX_SOL_UDP		17
88 /* Unused for now: */
89 #define LINUX_SOL_IPV6		41
90 #define LINUX_SOL_ICMPV6	58
91 #define LINUX_SOL_RAW		255
92 #define LINUX_SOL_IPX		256
93 #define LINUX_SOL_AX25		257
94 #define LINUX_SOL_ATALK		258
95 #define LINUX_SOL_NETROM	259
96 #define LINUX_SOL_ROSE		260
97 #define LINUX_SOL_DECNET	261
98 #define LINUX_SOL_X25		262
99 #define LINUX_SOL_PACKET	263
100 #define LINUX_SOL_ATM		264
101 #define LINUX_SOL_AAL		265
102 
103 /*
104  * Options for [gs]etsockopt(2), socket level are machine dependant.
105  */
106 
107 /*
108  * Options for [gs]etsockopt(2), IP level.
109  */
110 
111 #define LINUX_IP_TOS		1
112 #define LINUX_IP_TTL		2
113 #define	LINUX_IP_MULTICAST_IF	32
114 #define	LINUX_IP_MULTICAST_TTL	33
115 #define	LINUX_IP_MULTICAST_LOOP	34
116 #define	LINUX_IP_ADD_MEMBERSHIP	35
117 #define	LINUX_IP_DROP_MEMBERSHIP 36
118 
119 /*
120  * Options for [gs]etsockopt(2), TCP level.
121  */
122 
123 #define	LINUX_TCP_NODELAY	1
124 #define	LINUX_TCP_MAXSEG	2
125 
126 #if defined(__i386__)
127 #include <compat/linux/arch/i386/linux_socket.h>
128 #elif defined(__m68k__)
129 #include <compat/linux/arch/m68k/linux_socket.h>
130 #elif defined(__alpha__)
131 #include <compat/linux/arch/alpha/linux_socket.h>
132 #elif defined(__powerpc__)
133 #include <compat/linux/arch/powerpc/linux_socket.h>
134 #elif defined(__mips__)
135 #include <compat/linux/arch/mips/linux_socket.h>
136 #elif defined(__arm__)
137 #include <compat/linux/arch/arm/linux_socket.h>
138 #else
139 #error Undefined linux_socket.h machine type.
140 #endif
141 
142 #endif /* !_LINUX_SOCKET_H */
143