version 1.59.2.5, 2001/11/14 19:18:51 |
version 1.68.4.1, 2006/01/30 14:48:18 |
|
|
* 2. Redistributions in binary form must reproduce the above copyright |
* 2. Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* documentation and/or other materials provided with the distribution. |
* 3. All advertising materials mentioning features or use of this software |
* 3. Neither the name of the University nor the names of its contributors |
* must display the following acknowledgement: |
|
* This product includes software developed by the University of |
|
* California, Berkeley and its contributors. |
|
* 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 |
* may be used to endorse or promote products derived from this software |
* without specific prior written permission. |
* without specific prior written permission. |
* |
* |
|
|
#ifndef _SYS_SOCKET_H_ |
#ifndef _SYS_SOCKET_H_ |
#define _SYS_SOCKET_H_ |
#define _SYS_SOCKET_H_ |
|
|
|
#include <sys/featuretest.h> |
|
|
/* |
/* |
* Definitions related to sockets: types, address families, options. |
* Definitions related to sockets: types, address families, options. |
*/ |
*/ |
|
|
#define AF_APPLETALK 16 /* Apple Talk */ |
#define AF_APPLETALK 16 /* Apple Talk */ |
#define AF_ROUTE 17 /* Internal Routing Protocol */ |
#define AF_ROUTE 17 /* Internal Routing Protocol */ |
#define AF_LINK 18 /* Link layer interface */ |
#define AF_LINK 18 /* Link layer interface */ |
#if !defined(_XOPEN_SOURCE) |
#if defined(_NETBSD_SOURCE) |
#define pseudo_AF_XTP 19 /* eXpress Transfer Protocol (no AF) */ |
#define pseudo_AF_XTP 19 /* eXpress Transfer Protocol (no AF) */ |
#endif |
#endif |
#define AF_COIP 20 /* connection-oriented IP, aka ST II */ |
#define AF_COIP 20 /* connection-oriented IP, aka ST II */ |
#define AF_CNT 21 /* Computer Network Technology */ |
#define AF_CNT 21 /* Computer Network Technology */ |
#if !defined(_XOPEN_SOURCE) |
#if defined(_NETBSD_SOURCE) |
#define pseudo_AF_RTIP 22 /* Help Identify RTIP packets */ |
#define pseudo_AF_RTIP 22 /* Help Identify RTIP packets */ |
#endif |
#endif |
#define AF_IPX 23 /* Novell Internet Protocol */ |
#define AF_IPX 23 /* Novell Internet Protocol */ |
#define AF_INET6 24 /* IP version 6 */ |
#define AF_INET6 24 /* IP version 6 */ |
#if !defined(_XOPEN_SOURCE) |
#if defined(_NETBSD_SOURCE) |
#define pseudo_AF_PIP 25 /* Help Identify PIP packets */ |
#define pseudo_AF_PIP 25 /* Help Identify PIP packets */ |
#endif |
#endif |
#define AF_ISDN 26 /* Integrated Services Digital Network*/ |
#define AF_ISDN 26 /* Integrated Services Digital Network*/ |
#define AF_E164 AF_ISDN /* CCITT E.164 recommendation */ |
#define AF_E164 AF_ISDN /* CCITT E.164 recommendation */ |
#define AF_NATM 27 /* native ATM access */ |
#define AF_NATM 27 /* native ATM access */ |
#define AF_ARP 28 /* (rev.) addr. res. prot. (RFC 826) */ |
#define AF_ARP 28 /* (rev.) addr. res. prot. (RFC 826) */ |
#if !defined(_XOPEN_SOURCE) |
#if defined(_NETBSD_SOURCE) |
#define pseudo_AF_KEY 29 /* Internal key management protocol */ |
#define pseudo_AF_KEY 29 /* Internal key management protocol */ |
#define pseudo_AF_HDRCMPLT 30 /* Used by BPF to not rewrite hdrs |
#define pseudo_AF_HDRCMPLT 30 /* Used by BPF to not rewrite hdrs |
in interface output routine */ |
in interface output routine */ |
Line 229 struct sockproto { |
|
Line 227 struct sockproto { |
|
#define _SS_PAD2SIZE (_SS_MAXSIZE - 2 - \ |
#define _SS_PAD2SIZE (_SS_MAXSIZE - 2 - \ |
_SS_PAD1SIZE - _SS_ALIGNSIZE) |
_SS_PAD1SIZE - _SS_ALIGNSIZE) |
|
|
#if !defined(_XOPEN_SOURCE) || (_XOPEN_SOURCE - 0) >= 500 |
#if (_XOPEN_SOURCE - 0) >= 500 || defined(_NETBSD_SOURCE) |
struct sockaddr_storage { |
struct sockaddr_storage { |
__uint8_t ss_len; /* address length */ |
__uint8_t ss_len; /* address length */ |
sa_family_t ss_family; /* address family */ |
sa_family_t ss_family; /* address family */ |
Line 237 struct sockaddr_storage { |
|
Line 235 struct sockaddr_storage { |
|
__int64_t __ss_align;/* force desired structure storage alignment */ |
__int64_t __ss_align;/* force desired structure storage alignment */ |
char __ss_pad2[_SS_PAD2SIZE]; |
char __ss_pad2[_SS_PAD2SIZE]; |
}; |
}; |
#endif /* !_XOPEN_SOURCE || ... */ |
#endif /* _XOPEN_SOURCE >= 500 || _NETBSD_SOURCE */ |
#endif /* 1 */ |
#endif /* 1 */ |
|
|
/* |
/* |
Line 264 struct sockaddr_storage { |
|
Line 262 struct sockaddr_storage { |
|
#define PF_APPLETALK AF_APPLETALK |
#define PF_APPLETALK AF_APPLETALK |
#define PF_ROUTE AF_ROUTE |
#define PF_ROUTE AF_ROUTE |
#define PF_LINK AF_LINK |
#define PF_LINK AF_LINK |
#if !defined(_XOPEN_SOURCE) |
#if defined(_NETBSD_SOURCE) |
#define PF_XTP pseudo_AF_XTP /* really just proto family, no AF */ |
#define PF_XTP pseudo_AF_XTP /* really just proto family, no AF */ |
#endif |
#endif |
#define PF_COIP AF_COIP |
#define PF_COIP AF_COIP |
#define PF_CNT AF_CNT |
#define PF_CNT AF_CNT |
#define PF_INET6 AF_INET6 |
#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 */ |
#if !defined(_XOPEN_SOURCE) |
#if defined(_NETBSD_SOURCE) |
#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 |
#endif |
#endif |
Line 279 struct sockaddr_storage { |
|
Line 277 struct sockaddr_storage { |
|
#define PF_E164 AF_E164 |
#define PF_E164 AF_E164 |
#define PF_NATM AF_NATM |
#define PF_NATM AF_NATM |
#define PF_ARP AF_ARP |
#define PF_ARP AF_ARP |
#if !defined(_XOPEN_SOURCE) |
#if defined(_NETBSD_SOURCE) |
#define PF_KEY pseudo_AF_KEY /* like PF_ROUTE, only for key mgmt */ |
#define PF_KEY pseudo_AF_KEY /* like PF_ROUTE, only for key mgmt */ |
#endif |
#endif |
|
|
#define PF_MAX AF_MAX |
#define PF_MAX AF_MAX |
|
|
#if !defined(_XOPEN_SOURCE) |
#if defined(_NETBSD_SOURCE) |
|
|
#ifndef gid_t |
#ifndef gid_t |
typedef __gid_t gid_t; /* group id */ |
typedef __gid_t gid_t; /* group id */ |
Line 314 struct sockcred { |
|
Line 312 struct sockcred { |
|
*/ |
*/ |
#define SOCKCREDSIZE(ngrps) \ |
#define SOCKCREDSIZE(ngrps) \ |
(sizeof(struct sockcred) + (sizeof(gid_t) * ((ngrps) - 1))) |
(sizeof(struct sockcred) + (sizeof(gid_t) * ((ngrps) - 1))) |
#endif /* !_XOPEN_SOURCE */ |
#endif /* _NETBSD_SOURCE */ |
|
|
|
|
#if !defined(_XOPEN_SOURCE) |
#if defined(_NETBSD_SOURCE) |
/* |
/* |
* Definitions for network related sysctl, CTL_NET. |
* Definitions for network related sysctl, CTL_NET. |
* |
* |
Line 360 struct sockcred { |
|
Line 358 struct sockcred { |
|
{ "arp", CTLTYPE_NODE }, \ |
{ "arp", CTLTYPE_NODE }, \ |
{ "key", CTLTYPE_NODE }, \ |
{ "key", CTLTYPE_NODE }, \ |
} |
} |
#endif /* !_XOPEN_SOURCE */ |
#endif /* _NETBSD_SOURCE */ |
|
|
#if !defined(_XOPEN_SOURCE) |
#if defined(_NETBSD_SOURCE) |
/* |
/* |
* PF_ROUTE - Routing table |
* PF_ROUTE - Routing table |
* |
* |
Line 384 struct sockcred { |
|
Line 382 struct sockcred { |
|
{ 0, 0 }, \ |
{ 0, 0 }, \ |
{ "iflist", CTLTYPE_STRUCT }, \ |
{ "iflist", CTLTYPE_STRUCT }, \ |
} |
} |
#endif /* !_XOPEN_SOURCE */ |
#endif /* _NETBSD_SOURCE */ |
|
|
/* |
/* |
* Maximum queue length specifiable by listen(2). |
* Maximum queue length specifiable by listen(2). |
*/ |
*/ |
|
#ifndef SOMAXCONN |
#define SOMAXCONN 128 |
#define SOMAXCONN 128 |
|
#endif |
|
|
/* |
/* |
* Message header for recvmsg and sendmsg calls. |
* Message header for recvmsg and sendmsg calls. |
Line 453 struct cmsghdr { |
|
Line 452 struct cmsghdr { |
|
(((__caddr_t)(cmsg) + __CMSG_ALIGN((cmsg)->cmsg_len) + \ |
(((__caddr_t)(cmsg) + __CMSG_ALIGN((cmsg)->cmsg_len) + \ |
__CMSG_ALIGN(sizeof(struct cmsghdr)) > \ |
__CMSG_ALIGN(sizeof(struct cmsghdr)) > \ |
(((__caddr_t)(mhdr)->msg_control) + (mhdr)->msg_controllen)) ? \ |
(((__caddr_t)(mhdr)->msg_control) + (mhdr)->msg_controllen)) ? \ |
(struct cmsghdr *)NULL : \ |
(struct cmsghdr *)0 : \ |
(struct cmsghdr *)((__caddr_t)(cmsg) + \ |
(struct cmsghdr *)((__caddr_t)(cmsg) + \ |
__CMSG_ALIGN((cmsg)->cmsg_len))) |
__CMSG_ALIGN((cmsg)->cmsg_len))) |
|
|
Line 464 struct cmsghdr { |
|
Line 463 struct cmsghdr { |
|
#define CMSG_FIRSTHDR(mhdr) \ |
#define CMSG_FIRSTHDR(mhdr) \ |
((mhdr)->msg_controllen >= sizeof(struct cmsghdr) ? \ |
((mhdr)->msg_controllen >= sizeof(struct cmsghdr) ? \ |
(struct cmsghdr *)(mhdr)->msg_control : \ |
(struct cmsghdr *)(mhdr)->msg_control : \ |
(struct cmsghdr *)NULL) |
(struct cmsghdr *)0) |
|
|
#define CMSG_SPACE(l) (__CMSG_ALIGN(sizeof(struct cmsghdr)) + __CMSG_ALIGN(l)) |
#define CMSG_SPACE(l) (__CMSG_ALIGN(sizeof(struct cmsghdr)) + __CMSG_ALIGN(l)) |
#define CMSG_LEN(l) (__CMSG_ALIGN(sizeof(struct cmsghdr)) + (l)) |
#define CMSG_LEN(l) (__CMSG_ALIGN(sizeof(struct cmsghdr)) + (l)) |
|
|
/* "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) */ |
#if !defined(_XOPEN_SOURCE) |
#if defined(_NETBSD_SOURCE) |
#define SCM_TIMESTAMP 0x02 /* timestamp (struct timeval) */ |
#define SCM_TIMESTAMP 0x02 /* timestamp (struct timeval) */ |
#define SCM_CREDS 0x04 /* credentials (struct sockcred) */ |
#define SCM_CREDS 0x04 /* credentials (struct sockcred) */ |
#endif |
#endif |
Line 483 struct cmsghdr { |
|
Line 482 struct cmsghdr { |
|
#define SHUT_WR 1 /* Disallow further sends. */ |
#define SHUT_WR 1 /* Disallow further sends. */ |
#define SHUT_RDWR 2 /* Disallow further sends/receives. */ |
#define SHUT_RDWR 2 /* Disallow further sends/receives. */ |
|
|
#if !defined(_XOPEN_SOURCE) |
#if defined(_NETBSD_SOURCE) |
/* |
/* |
* 4.3 compat sockaddr, move to compat file later |
* 4.3 compat sockaddr, move to compat file later |
*/ |
*/ |