4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
26 /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
27 /* All Rights Reserved */
30 * Portions of this source code were derived from Berkeley 4.3 BSD
31 * under license from the Regents of the University of California.
34 #ifndef _SYS_SOCKET_IMPL_H
35 #define _SYS_SOCKET_IMPL_H
43 typedef uint16_t sa_family_t
;
47 * Structure used by kernel to store most
51 sa_family_t sa_family
; /* address family */
52 char sa_data
[14]; /* up to 14 bytes of direct address */
55 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
57 #include <net/if_dl.h>
58 #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
60 #if !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__)
63 * Common superset of at least AF_INET, AF_INET6 and AF_LINK sockaddr
64 * structures. Has sufficient size and alignment for those sockaddrs.
68 * Desired maximum size, alignment size and related types.
70 #define _SS_MAXSIZE 256 /* Implementation specific max size */
73 * To represent desired sockaddr max alignment for platform, a
74 * type is chosen which may depend on implementation platform architecture.
75 * Type chosen based on alignment size restrictions from <sys/isa_defs.h>.
76 * We desire to force up to (but no more than) 64-bit (8 byte) alignment,
77 * on platforms where it is possible to do so. (e.g not possible on ia32).
78 * For all currently supported platforms by our implementation
79 * in <sys/isa_defs.h>, (i.e. sparc, sparcv9, ia32, ia64)
80 * type "double" is suitable for that intent.
82 * Note: Type "double" is chosen over the more obvious integer type int64_t.
83 * int64_t is not a valid type for strict ANSI/ISO C compilation on ILP32.
85 typedef double sockaddr_maxalign_t
;
87 #define _SS_ALIGNSIZE (sizeof (sockaddr_maxalign_t))
90 * Definitions used for sockaddr_storage structure paddings design.
92 #define _SS_PAD1SIZE (_SS_ALIGNSIZE - sizeof (sa_family_t))
93 #define _SS_PAD2SIZE (_SS_MAXSIZE - (sizeof (sa_family_t)+ \
94 _SS_PAD1SIZE + _SS_ALIGNSIZE))
96 struct sockaddr_storage
{
97 sa_family_t ss_family
; /* Address family */
98 /* Following fields are implementation specific */
99 char _ss_pad1
[_SS_PAD1SIZE
];
100 sockaddr_maxalign_t _ss_align
;
101 char _ss_pad2
[_SS_PAD2SIZE
];
103 #endif /* !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__) */
106 * To be compatible with the Linux interfaces used, this structure is
107 * placed in socket_impl.h so that an include for <sys/socket.h> will
108 * pickup this structure. This structure is for use with PF_PACKET
113 uint16_t sll_protocol
;
121 #define LINUX_SLL_HOST 0
122 #define LINUX_SLL_BROADCAST 1
123 #define LINUX_SLL_MULTICAST 2
124 #define LINUX_SLL_OTHERHOST 3
125 #define LINUX_SLL_OUTGOING 4
131 #endif /* _SYS_SOCKET_IMPL_H */