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