/*-
* Copyright (c) 1982, 1985, 1986, 1988, 1993, 1994
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)socket.h 8.4 (Berkeley) 2/21/94
* $FreeBSD$
*/
#ifndef _SYS_SOCKET_H_
#define _SYS_SOCKET_H_
/*
* Definitions related to sockets: types, address families, options.
*/
/*
* Data types.
*/
#if __BSD_VISIBLE
#ifndef _GID_T_DECLARED
#define _GID_T_DECLARED
#endif
#ifndef _OFF_T_DECLARED
#define _OFF_T_DECLARED
#endif
#ifndef _PID_T_DECLARED
#define _PID_T_DECLARED
#endif
#endif
#ifndef _SA_FAMILY_T_DECLARED
#define _SA_FAMILY_T_DECLARED
#endif
#ifndef _SOCKLEN_T_DECLARED
#define _SOCKLEN_T_DECLARED
#endif
#ifndef _SSIZE_T_DECLARED
#define _SSIZE_T_DECLARED
#endif
#if __BSD_VISIBLE
#ifndef _UID_T_DECLARED
#define _UID_T_DECLARED
#endif
#endif
#ifndef _UINT32_T_DECLARED
#define _UINT32_T_DECLARED
#endif
#ifndef _UINTPTR_T_DECLARED
#define _UINTPTR_T_DECLARED
#endif
/*
* Types
*/
#if __BSD_VISIBLE
#endif
#if __BSD_VISIBLE
/*
* Creation flags, OR'ed into socket() and socketpair() type argument.
*/
#endif
/*
* Option flags per-socket.
*/
#if __BSD_VISIBLE
#endif
#if __BSD_VISIBLE
#endif
/*
* Additional options, not kept in so_options.
*/
#if __BSD_VISIBLE
#endif
/*
* Space reserved for new socket options added by third-party vendors.
* This range applies to all socket option levels. New socket options
* in FreeBSD should always use an option value less than SO_VENDOR.
*/
#if __BSD_VISIBLE
#endif
/*
* Structure used for manipulating linger option.
*/
struct linger {
};
#if __BSD_VISIBLE
struct accept_filter_arg {
};
#endif
/*
*/
/*
* Address families.
*/
#if __BSD_VISIBLE
#endif
#if __BSD_VISIBLE
#endif
#if __BSD_VISIBLE
* in interface output routine
*/
/*
* When allocating a new AF_ constant, please only allocate
* even numbered constants for FreeBSD until 134 as odd numbered AF_
* constants 39-133 are now reserved for vendors.
*/
#endif
/*
* Structure used by kernel to store most
* addresses.
*/
struct sockaddr {
};
#if __BSD_VISIBLE
/*
* Structure used by kernel to pass protocol
* information in raw sockets.
*/
struct sockproto {
};
#endif
#include <sys/_sockaddr_storage.h>
#if __BSD_VISIBLE
/*
* Protocol families, same as address families for now.
*/
/*
* Definitions for network related sysctl, CTL_NET.
*
* Second level is protocol family.
* Third level is protocol number.
*
* Further levels are defined by the individual families.
*/
/*
* PF_ROUTE - Routing table
*
* Three additional levels are defined:
* Fourth: address family, 0 is wildcard
* Fifth: type of info, defined below
* Sixth: flag(s) to mask with for NET_RT_FLAGS
*/
* versions of msghdr structs. */
#endif /* __BSD_VISIBLE */
/*
* Maximum queue length specifiable by listen.
*/
/*
* Message header for recvmsg and sendmsg calls.
* Used value-result for recvmsg, value only for sendmsg.
*/
struct msghdr {
};
#if __POSIX_VISIBLE >= 200809
#endif
#if __BSD_VISIBLE
#endif
#ifdef _KERNEL
#endif
/*
* Header for ancillary data objects in msg_control buffer.
* not expressible by flags. The format is a sequence
* of message elements headed by cmsghdr structures.
*/
struct cmsghdr {
/* followed by u_char cmsg_data[]; */
};
#if __BSD_VISIBLE
/*
* While we may have more groups than this, the cmsgcred struct must
* be able to fit in an mbuf and we have historically supported a
* maximum of 16 groups.
*/
/*
* Credentials structure, used to verify the identity of a peer
* process that has sent us a message. This is allocated by the
* peer process but filled in by the kernel. This prevents the
* peer from lying about its identity. (Note that cmcred_groups[0]
* is the effective GID.)
*/
struct cmsgcred {
};
/*
* Socket credentials.
*/
struct sockcred {
};
/*
* Compute size of a sockcred structure with groups.
*/
#endif /* __BSD_VISIBLE */
/* given pointer to struct cmsghdr, return pointer to data */
/* given pointer to struct cmsghdr, return pointer to next cmsghdr */
(struct cmsghdr *)0 : \
/*
* RFC 2292 requires to check msg_controllen, in case that the kernel returns
* an empty list for some reasons.
*/
#if __BSD_VISIBLE
/* RFC 2292 additions */
#endif
#ifdef _KERNEL
#endif
/* "Socket"-level control message types: */
#if __BSD_VISIBLE
#endif
#if __BSD_VISIBLE
/*
* 4.3 compat sockaddr, move to compat file later
*/
struct osockaddr {
};
/*
* 4.3-compat message header (move to compat file later).
*/
struct omsghdr {
int msg_accrightslen;
};
#endif
/*
* howto arguments for shutdown(2), specified by Posix.1g.
*/
#if __BSD_VISIBLE
/* for SCTP */
/* we cheat and use the SHUT_XX defines for these */
#endif
#if __BSD_VISIBLE
/*
*/
struct sf_hdtr {
};
/*
* Sendfile-specific flag(s)
*/
#ifdef _KERNEL
#endif /* _KERNEL */
/*
*/
struct mmsghdr {
};
#endif /* __BSD_VISIBLE */
#ifndef _KERNEL
#if __BSD_VISIBLE
#endif
int listen(int, int);
#if __BSD_VISIBLE
struct timespec;
const struct timespec * __restrict);
#endif
#if __BSD_VISIBLE
int setfib(int);
#endif
int setsockopt(int, int, int, const void *, socklen_t);
int shutdown(int, int);
int sockatmark(int);
int socket(int, int, int);
int socketpair(int, int, int, int *);
#endif /* !_KERNEL */
#ifdef _KERNEL
struct socket;
int so_state_get(const struct socket *);
void so_state_set(struct socket *, int);
int so_options_get(const struct socket *);
void so_options_set(struct socket *, int);
int so_error_get(const struct socket *);
void so_error_set(struct socket *, int);
int so_linger_get(const struct socket *);
void so_linger_set(struct socket *, int);
#endif
#endif /* !_SYS_SOCKET_H_ */