version 1.8, 1994/05/13 06:12:10 |
version 1.29, 1998/04/25 10:41:12 |
|
|
|
/* $NetBSD$ */ |
|
|
/* |
/* |
* Copyright (c) 1982, 1985, 1986, 1988, 1993, 1994 |
* Copyright (c) 1982, 1985, 1986, 1988, 1993, 1994 |
* The Regents of the University of California. All rights reserved. |
* The Regents of the University of California. All rights reserved. |
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
* SUCH DAMAGE. |
* SUCH DAMAGE. |
* |
* |
* from: @(#)socket.h 8.4 (Berkeley) 2/21/94 |
* @(#)socket.h 8.6 (Berkeley) 5/3/95 |
* $Id$ |
|
*/ |
*/ |
|
|
#ifndef _SYS_SOCKET_H_ |
#ifndef _SYS_SOCKET_H_ |
|
|
#define SO_LINGER 0x0080 /* linger on close if data present */ |
#define SO_LINGER 0x0080 /* linger on close if data present */ |
#define SO_OOBINLINE 0x0100 /* leave received OOB data in line */ |
#define SO_OOBINLINE 0x0100 /* leave received OOB data in line */ |
#define SO_REUSEPORT 0x0200 /* allow local address & port reuse */ |
#define SO_REUSEPORT 0x0200 /* allow local address & port reuse */ |
|
#define SO_TIMESTAMP 0x0400 /* timestamp received dgram traffic */ |
|
|
/* |
/* |
* Additional options, not kept in so_options. |
* Additional options, not kept in so_options. |
|
|
*/ |
*/ |
struct linger { |
struct linger { |
int l_onoff; /* option on/off */ |
int l_onoff; /* option on/off */ |
int l_linger; /* linger time */ |
int l_linger; /* linger time in seconds */ |
}; |
}; |
|
|
/* |
/* |
|
|
#define AF_CNT 21 /* Computer Network Technology */ |
#define AF_CNT 21 /* Computer Network Technology */ |
#define pseudo_AF_RTIP 22 /* Help Identify RTIP packets */ |
#define pseudo_AF_RTIP 22 /* Help Identify RTIP packets */ |
#define AF_IPX 23 /* Novell Internet Protocol */ |
#define AF_IPX 23 /* Novell Internet Protocol */ |
#define AF_SIP 24 /* Simple Internet Protocol */ |
#define AF_INET6 24 /* IP version 6 */ |
#define pseudo_AF_PIP 25 /* Help Identify PIP packets */ |
#define pseudo_AF_PIP 25 /* Help Identify PIP packets */ |
|
#define AF_ISDN 26 /* Integrated Services Digital Network*/ |
|
#define AF_E164 AF_ISDN /* CCITT E.164 recommendation */ |
|
#define AF_NATM 27 /* native ATM access */ |
|
#define AF_ARP 28 /* (rev.) addr. res. prot. (RFC 826) */ |
|
#define pseudo_AF_KEY 29 /* Internal key management protocol */ |
|
|
#define AF_MAX 26 |
#define AF_MAX 30 |
|
|
/* |
/* |
* Structure used by kernel to store most |
* Structure used by kernel to store most |
Line 169 struct sockproto { |
|
Line 176 struct sockproto { |
|
#define PF_XTP pseudo_AF_XTP /* really just proto family, no AF */ |
#define PF_XTP pseudo_AF_XTP /* really just proto family, no AF */ |
#define PF_COIP AF_COIP |
#define PF_COIP AF_COIP |
#define PF_CNT AF_CNT |
#define PF_CNT AF_CNT |
#define PF_SIP AF_SIP |
#define PF_INET6 AF_INET6 |
#define PF_IPX AF_IPX /* same format as AF_NS */ |
#define PF_IPX AF_IPX /* same format as AF_NS */ |
#define PF_RTIP pseudo_AF_FTIP /* same format as AF_INET */ |
#define PF_RTIP pseudo_AF_FTIP /* same format as AF_INET */ |
#define PF_PIP pseudo_AF_PIP |
#define PF_PIP pseudo_AF_PIP |
|
#define PF_ISDN AF_ISDN /* same as E164 */ |
|
#define PF_E164 AF_E164 |
|
#define PF_NATM AF_NATM |
|
#define PF_ARP AF_ARP |
|
#define PF_KEY pseudo_AF_KEY /* like PF_ROUTE, only for key mgmt */ |
|
|
#define PF_MAX AF_MAX |
#define PF_MAX AF_MAX |
|
|
/* |
/* |
|
* Socket credentials. |
|
*/ |
|
struct sockcred { |
|
uid_t sc_uid; /* real user id */ |
|
uid_t sc_euid; /* effective user id */ |
|
gid_t sc_gid; /* real group id */ |
|
gid_t sc_egid; /* effective group id */ |
|
int sc_ngroups; /* number of supplemental groups */ |
|
gid_t sc_groups[1]; /* variable length */ |
|
}; |
|
|
|
/* |
|
* Compute size of a sockcred structure with groups. |
|
*/ |
|
#define SOCKCREDSIZE(ngrps) \ |
|
(sizeof(struct sockcred) + (sizeof(gid_t) * ((ngrps) - 1))) |
|
|
|
/* |
* Definitions for network related sysctl, CTL_NET. |
* Definitions for network related sysctl, CTL_NET. |
* |
* |
* Second level is protocol family. |
* Second level is protocol family. |
Line 188 struct sockproto { |
|
Line 218 struct sockproto { |
|
|
|
#define CTL_NET_NAMES { \ |
#define CTL_NET_NAMES { \ |
{ 0, 0 }, \ |
{ 0, 0 }, \ |
{ "unix", CTLTYPE_NODE }, \ |
{ "local", CTLTYPE_NODE }, \ |
{ "inet", CTLTYPE_NODE }, \ |
{ "inet", CTLTYPE_NODE }, \ |
{ "implink", CTLTYPE_NODE }, \ |
{ "implink", CTLTYPE_NODE }, \ |
{ "pup", CTLTYPE_NODE }, \ |
{ "pup", CTLTYPE_NODE }, \ |
Line 211 struct sockproto { |
|
Line 241 struct sockproto { |
|
{ "cnt", CTLTYPE_NODE }, \ |
{ "cnt", CTLTYPE_NODE }, \ |
{ "rtip", CTLTYPE_NODE }, \ |
{ "rtip", CTLTYPE_NODE }, \ |
{ "ipx", CTLTYPE_NODE }, \ |
{ "ipx", CTLTYPE_NODE }, \ |
{ "sip", CTLTYPE_NODE }, \ |
{ "inet6", CTLTYPE_NODE }, \ |
{ "pip", CTLTYPE_NODE }, \ |
{ "pip", CTLTYPE_NODE }, \ |
|
{ "isdn", CTLTYPE_NODE }, \ |
|
{ "natm", CTLTYPE_NODE }, \ |
|
{ "arp", CTLTYPE_NODE }, \ |
|
{ "key", CTLTYPE_NODE }, \ |
} |
} |
|
|
/* |
/* |
Line 236 struct sockproto { |
|
Line 270 struct sockproto { |
|
} |
} |
|
|
/* |
/* |
* Maximum queue length specifiable by listen. |
* Maximum queue length specifiable by listen(2). |
*/ |
*/ |
#define SOMAXCONN 5 |
|
|
#define SOMAXCONN 128 |
|
|
/* |
/* |
* Message header for recvmsg and sendmsg calls. |
* Message header for recvmsg and sendmsg calls. |
Line 290 struct cmsghdr { |
|
Line 325 struct cmsghdr { |
|
|
|
/* "Socket"-level control message types: */ |
/* "Socket"-level control message types: */ |
#define SCM_RIGHTS 0x01 /* access rights (array of int) */ |
#define SCM_RIGHTS 0x01 /* access rights (array of int) */ |
|
#define SCM_TIMESTAMP 0x02 /* timestamp (struct timeval) */ |
|
#define SCM_CREDS 0x04 /* credientials (struct sockcred) */ |
|
|
|
/* |
|
* Types of socket shutdown(2). |
|
*/ |
|
#define SHUT_RD 0 /* Disallow further receives. */ |
|
#define SHUT_WR 1 /* Disallow further sends. */ |
|
#define SHUT_RDWR 2 /* Disallow further sends/receives. */ |
|
|
/* |
/* |
* 4.3 compat sockaddr, move to compat file later |
* 4.3 compat sockaddr, move to compat file later |
Line 311 struct omsghdr { |
|
Line 355 struct omsghdr { |
|
int msg_accrightslen; |
int msg_accrightslen; |
}; |
}; |
|
|
#ifndef KERNEL |
#ifndef _KERNEL |
|
|
#include <sys/cdefs.h> |
#include <sys/cdefs.h> |
|
|
Line 335 int shutdown __P((int, int)); |
|
Line 379 int shutdown __P((int, int)); |
|
int socket __P((int, int, int)); |
int socket __P((int, int, int)); |
int socketpair __P((int, int, int, int *)); |
int socketpair __P((int, int, int, int *)); |
__END_DECLS |
__END_DECLS |
|
#else |
|
# if defined(COMPAT_43) || defined(COMPAT_SUNOS) || defined(COMPAT_LINUX) || \ |
|
defined(COMPAT_HPUX) || defined(COMPAT_FREEBSD) |
|
# define COMPAT_OLDSOCK |
|
# define MSG_COMPAT 0x8000 |
|
# endif |
|
#endif /* !_KERNEL */ |
|
|
#endif /* !KERNEL */ |
|
#endif /* !_SYS_SOCKET_H_ */ |
#endif /* !_SYS_SOCKET_H_ */ |