version 1.73, 2005/03/09 05:07:19 |
version 1.87.2.1, 2007/09/03 10:24:01 |
Line 122 typedef _BSD_SSIZE_T_ ssize_t; |
|
Line 122 typedef _BSD_SSIZE_T_ ssize_t; |
|
#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 */ |
#define SO_TIMESTAMP 0x0400 /* timestamp received dgram traffic */ |
|
|
|
|
/* |
/* |
* Additional options, not kept in so_options. |
* Additional options, not kept in so_options. |
*/ |
*/ |
|
|
#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 */ |
#endif |
#endif |
|
#define AF_BLUETOOTH 31 /* Bluetooth: HCI, SCO, L2CAP, RFCOMM */ |
|
|
#define AF_MAX 31 |
#define AF_MAX 32 |
|
|
/* |
/* |
* Structure used by kernel to store most |
* Structure used by kernel to store most |
Line 281 struct sockaddr_storage { |
|
Line 283 struct sockaddr_storage { |
|
#if defined(_NETBSD_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_BLUETOOTH AF_BLUETOOTH |
|
|
#define PF_MAX AF_MAX |
#define PF_MAX AF_MAX |
|
|
Line 361 struct sockcred { |
|
Line 364 struct sockcred { |
|
} |
} |
|
|
struct kinfo_pcb { |
struct kinfo_pcb { |
uint64_t ki_pcbaddr; /* PTR: pcb addr */ |
__uint64_t ki_pcbaddr; /* PTR: pcb addr */ |
uint64_t ki_ppcbaddr; /* PTR: ppcb addr */ |
__uint64_t ki_ppcbaddr; /* PTR: ppcb addr */ |
uint64_t ki_sockaddr; /* PTR: socket addr */ |
__uint64_t ki_sockaddr; /* PTR: socket addr */ |
|
|
uint32_t ki_family; /* INT: protocol family */ |
__uint32_t ki_family; /* INT: protocol family */ |
uint32_t ki_type; /* INT: socket type */ |
__uint32_t ki_type; /* INT: socket type */ |
uint32_t ki_protocol; /* INT: protocol */ |
__uint32_t ki_protocol; /* INT: protocol */ |
uint32_t ki_pflags; /* INT: generic protocol flags */ |
__uint32_t ki_pflags; /* INT: generic protocol flags */ |
|
|
uint32_t ki_sostate; /* INT: socket state */ |
__uint32_t ki_sostate; /* INT: socket state */ |
uint32_t ki_prstate; /* INT: protocol state */ |
__uint32_t ki_prstate; /* INT: protocol state */ |
int32_t ki_tstate; /* INT: tcp state */ |
__int32_t ki_tstate; /* INT: tcp state */ |
uint32_t ki_tflags; /* INT: tcp flags */ |
__uint32_t ki_tflags; /* INT: tcp flags */ |
|
|
uint64_t ki_rcvq; /* U_LONG: receive queue len */ |
__uint64_t ki_rcvq; /* U_LONG: receive queue len */ |
uint64_t ki_sndq; /* U_LONG: send queue len */ |
__uint64_t ki_sndq; /* U_LONG: send queue len */ |
|
|
union { |
union { |
struct sockaddr _kis_src; /* STRUCT: local address */ |
struct sockaddr _kis_src; /* STRUCT: local address */ |
Line 387 struct kinfo_pcb { |
|
Line 390 struct kinfo_pcb { |
|
char _kid_pad[256 + 8]; /* pad to max addr length */ |
char _kid_pad[256 + 8]; /* pad to max addr length */ |
} ki_d; |
} ki_d; |
|
|
uint64_t ki_inode; /* INO_T: fake inode number */ |
__uint64_t ki_inode; /* INO_T: fake inode number */ |
uint64_t ki_vnode; /* PTR: if associated with file */ |
__uint64_t ki_vnode; /* PTR: if associated with file */ |
uint64_t ki_conn; /* PTR: control block of peer */ |
__uint64_t ki_conn; /* PTR: control block of peer */ |
uint64_t ki_refs; /* PTR: referencing socket */ |
__uint64_t ki_refs; /* PTR: referencing socket */ |
uint64_t ki_nextref; /* PTR: link in refs list */ |
__uint64_t ki_nextref; /* PTR: link in refs list */ |
}; |
}; |
|
|
#define ki_src ki_s._kis_src |
#define ki_src ki_s._kis_src |
|
|
int msg_flags; /* flags on received message */ |
int msg_flags; /* flags on received message */ |
}; |
}; |
|
|
#define MSG_OOB 0x1 /* process out-of-band data */ |
#define MSG_OOB 0x0001 /* process out-of-band data */ |
#define MSG_PEEK 0x2 /* peek at incoming message */ |
#define MSG_PEEK 0x0002 /* peek at incoming message */ |
#define MSG_DONTROUTE 0x4 /* send without using routing tables */ |
#define MSG_DONTROUTE 0x0004 /* send without using routing tables */ |
#define MSG_EOR 0x8 /* data completes record */ |
#define MSG_EOR 0x0008 /* data completes record */ |
#define MSG_TRUNC 0x10 /* data discarded before delivery */ |
#define MSG_TRUNC 0x0010 /* data discarded before delivery */ |
#define MSG_CTRUNC 0x20 /* control data lost before delivery */ |
#define MSG_CTRUNC 0x0020 /* control data lost before delivery */ |
#define MSG_WAITALL 0x40 /* wait for full request or error */ |
#define MSG_WAITALL 0x0040 /* wait for full request or error */ |
#define MSG_DONTWAIT 0x80 /* this message should be nonblocking */ |
#define MSG_DONTWAIT 0x0080 /* this message should be nonblocking */ |
#define MSG_BCAST 0x100 /* this message was rcvd using link-level brdcst */ |
#define MSG_BCAST 0x0100 /* this message was rcvd using link-level brdcst */ |
#define MSG_MCAST 0x200 /* this message was rcvd using link-level mcast */ |
#define MSG_MCAST 0x0200 /* this message was rcvd using link-level mcast */ |
|
#define MSG_NOSIGNAL 0x0400 /* do not generate SIGPIPE on EOF */ |
|
|
|
/* Extra flags used internally only */ |
|
#define MSG_USERFLAGS 0x0ffffff |
|
#define MSG_NAMEMBUF 0x1000000 /* msg_name is an mbuf */ |
|
#define MSG_CONTROLMBUF 0x2000000 /* msg_control is an mbuf */ |
|
#define MSG_IOVUSRSPACE 0x4000000 /* msg_iov is in user space */ |
|
#define MSG_LENUSRSPACE 0x8000000 /* address length is in user space */ |
|
|
/* |
/* |
* Header for ancillary data objects in msg_control buffer. |
* Header for ancillary data objects in msg_control buffer. |
Line 474 struct cmsghdr { |
|
Line 485 struct cmsghdr { |
|
/* given pointer to struct cmsghdr, return pointer to data */ |
/* given pointer to struct cmsghdr, return pointer to data */ |
#define CMSG_DATA(cmsg) \ |
#define CMSG_DATA(cmsg) \ |
((u_char *)(void *)(cmsg) + __CMSG_ALIGN(sizeof(struct cmsghdr))) |
((u_char *)(void *)(cmsg) + __CMSG_ALIGN(sizeof(struct cmsghdr))) |
|
#define CCMSG_DATA(cmsg) \ |
|
((const u_char *)(const void *)(cmsg) + \ |
|
__CMSG_ALIGN(sizeof(struct cmsghdr))) |
|
|
/* |
/* |
* Alignment requirement for CMSG struct manipulation. |
* Alignment requirement for CMSG struct manipulation. |
Line 491 struct cmsghdr { |
|
Line 505 struct cmsghdr { |
|
|
|
/* given pointer to struct cmsghdr, return pointer to next cmsghdr */ |
/* given pointer to struct cmsghdr, return pointer to next cmsghdr */ |
#define CMSG_NXTHDR(mhdr, cmsg) \ |
#define CMSG_NXTHDR(mhdr, cmsg) \ |
(((__caddr_t)(cmsg) + __CMSG_ALIGN((cmsg)->cmsg_len) + \ |
(((char *)(cmsg) + __CMSG_ALIGN((cmsg)->cmsg_len) + \ |
__CMSG_ALIGN(sizeof(struct cmsghdr)) > \ |
__CMSG_ALIGN(sizeof(struct cmsghdr)) > \ |
(((__caddr_t)(mhdr)->msg_control) + (mhdr)->msg_controllen)) ? \ |
(((char *)(mhdr)->msg_control) + (mhdr)->msg_controllen)) ? \ |
(struct cmsghdr *)NULL : \ |
(struct cmsghdr *)0 : \ |
(struct cmsghdr *)((__caddr_t)(cmsg) + \ |
(struct cmsghdr *)((char *)(cmsg) + \ |
__CMSG_ALIGN((cmsg)->cmsg_len))) |
__CMSG_ALIGN((cmsg)->cmsg_len))) |
|
|
/* |
/* |
Line 505 struct cmsghdr { |
|
Line 519 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)) |
Line 524 struct cmsghdr { |
|
Line 538 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(_NETBSD_SOURCE) |
|
/* |
|
* 4.3 compat sockaddr, move to compat file later |
|
*/ |
|
struct osockaddr { |
|
__uint16_t sa_family; /* address family */ |
|
char sa_data[14]; /* up to 14 bytes of direct address */ |
|
}; |
|
|
|
/* |
|
* 4.3-compat message header (move to compat file later). |
|
*/ |
|
struct omsghdr { |
|
__caddr_t msg_name; /* optional address */ |
|
int msg_namelen; /* size of address */ |
|
struct iovec *msg_iov; /* scatter/gather array */ |
|
int msg_iovlen; /* # elements in msg_iov */ |
|
__caddr_t msg_accrights; /* access rights sent/received */ |
|
int msg_accrightslen; |
|
}; |
|
#endif |
|
|
|
#include <sys/cdefs.h> |
#include <sys/cdefs.h> |
|
|
__BEGIN_DECLS |
__BEGIN_DECLS |
int __cmsg_alignbytes(void); |
int __cmsg_alignbytes(void); |
__END_DECLS |
__END_DECLS |
|
|
|
#ifdef _KERNEL |
|
__BEGIN_DECLS |
|
struct sockaddr *sockaddr_copy(struct sockaddr *, socklen_t, |
|
const struct sockaddr *); |
|
struct sockaddr *sockaddr_alloc(sa_family_t, socklen_t, int); |
|
int sockaddr_cmp(const struct sockaddr *, const struct sockaddr *); |
|
struct sockaddr *sockaddr_dup(const struct sockaddr *, int); |
|
void sockaddr_free(struct sockaddr *); |
|
__END_DECLS |
|
#endif /* _KERNEL */ |
|
|
#ifndef _KERNEL |
#ifndef _KERNEL |
|
|
__BEGIN_DECLS |
__BEGIN_DECLS |
Line 560 int bind(int, const struct sockaddr *, s |
|
Line 563 int bind(int, const struct sockaddr *, s |
|
int connect(int, const struct sockaddr *, socklen_t); |
int connect(int, const struct sockaddr *, socklen_t); |
int getpeername(int, struct sockaddr * __restrict, socklen_t * __restrict); |
int getpeername(int, struct sockaddr * __restrict, socklen_t * __restrict); |
int getsockname(int, struct sockaddr * __restrict, socklen_t * __restrict); |
int getsockname(int, struct sockaddr * __restrict, socklen_t * __restrict); |
int getsockopt(int, int, int, void * __restrict, socklen_t * __restrict); |
int getsockopt(int, int, int, void *__restrict, socklen_t * __restrict); |
int listen(int, int); |
int listen(int, int); |
ssize_t recv(int, void *, size_t, int); |
ssize_t recv(int, void *, size_t, int); |
ssize_t recvfrom(int, void * __restrict, size_t, int, |
ssize_t recvfrom(int, void *__restrict, size_t, int, |
struct sockaddr * __restrict, socklen_t * __restrict); |
struct sockaddr * __restrict, socklen_t * __restrict); |
ssize_t recvmsg(int, struct msghdr *, int); |
ssize_t recvmsg(int, struct msghdr *, int); |
ssize_t send(int, const void *, size_t, int); |
ssize_t send(int, const void *, size_t, int); |
Line 573 ssize_t sendmsg(int, const struct msghdr |
|
Line 576 ssize_t sendmsg(int, const struct msghdr |
|
int setsockopt(int, int, int, const void *, socklen_t); |
int setsockopt(int, int, int, const void *, socklen_t); |
int shutdown(int, int); |
int shutdown(int, int); |
int sockatmark(int); |
int sockatmark(int); |
int socket(int, int, int); |
int socket(int, int, int) |
|
#if !defined(__LIBC12_SOURCE__) && !defined(_STANDALONE) |
|
__RENAME(__socket30) |
|
#endif |
|
; |
int socketpair(int, int, int, int *); |
int socketpair(int, int, int, int *); |
__END_DECLS |
__END_DECLS |
#endif /* !_KERNEL */ |
#endif /* !_KERNEL */ |