/*
- * Copyright (c) 2000-2014 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2015 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
#if MPTCP
#define SO_MPTCP_FASTJOIN 0x1111 /* fast join MPTCP */
#endif /* MPTCP */
-
-#define SO_AWDL_UNRESTRICTED 0x1113 /* try to use AWDL in restricted mode */
#endif /* PRIVATE */
-
#define SO_NUMRCVPKT 0x1112 /* number of datagrams in receive socket buffer */
+#ifdef PRIVATE
+#define SO_AWDL_UNRESTRICTED 0x1113 /* try to use AWDL in restricted mode */
+#define SO_EXTENDED_BK_IDLE 0x1114 /* extended time to keep socket idle after app is suspended (int) */
+#endif /* PRIVATE */
+typedef __uint32_t sae_associd_t;
+#define SAE_ASSOCID_ANY 0
+#define SAE_ASSOCID_ALL ((sae_associd_t)(-1ULL))
+
+typedef __uint32_t sae_connid_t;
+#define SAE_CONNID_ANY 0
+#define SAE_CONNID_ALL ((sae_connid_t)(-1ULL))
+
+/* connectx() flag parameters */
+#define CONNECT_RESUME_ON_READ_WRITE 0x1 /* resume connect() on read/write */
+#define CONNECT_DATA_IDEMPOTENT 0x2 /* data is idempotent */
+
+/* sockaddr endpoints */
+typedef struct sa_endpoints {
+ unsigned int sae_srcif; /* optional source interface */
+ struct sockaddr *sae_srcaddr; /* optional source address */
+ socklen_t sae_srcaddrlen; /* size of source address */
+ struct sockaddr *sae_dstaddr; /* destination address */
+ socklen_t sae_dstaddrlen; /* size of destination address */
+} sa_endpoints_t;
#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
/*
#ifdef KERNEL_PRIVATE
#define SONPX_MASK_VALID (SONPX_SETOPTSHUT)
#define IS_SO_TC_BACKGROUND(_tc_) ((_tc_) == SO_TC_BK || (_tc_) == SO_TC_BK_SYS)
+#define IS_SO_TC_BACKGROUNDSYSTEM(_tc_) ((_tc_) == SO_TC_BK_SYS)
#endif /* KERNEL_PRIVATE */
#endif
user32_size_t msg_datalen; /* byte length of buffer in msg_iov */
};
+/*
+ * In-kernel representation of "struct sa_endpoints" from
+ * userspace. Has enough precision for 32-bit or
+ * 64-bit clients, but does not need to be packed.
+ */
+
+struct user_sa_endpoints {
+ unsigned int sae_srcif; /* optional source interface */
+ user_addr_t sae_srcaddr; /* optional source address */
+ socklen_t sae_srcaddrlen; /* size of source address */
+ user_addr_t sae_dstaddr; /* destination address */
+ socklen_t sae_dstaddrlen; /* size of destination address */
+};
+
+/*
+ * LP64 user version of struct sa_endpoints
+ * WARNING - keep in sync with struct sa_endpoints
+ */
+
+struct user64_sa_endpoints {
+ unsigned int sae_srcif; /* optional source interface */
+ user64_addr_t sae_srcaddr; /* optional source address */
+ socklen_t sae_srcaddrlen; /* size of source address */
+ user64_addr_t sae_dstaddr; /* destination address */
+ socklen_t sae_dstaddrlen; /* size of destination address */
+};
+
+/*
+ * ILP32 user version of struct sa_endpoints
+ * WARNING - keep in sync with struct sa_endpoints
+ */
+
+struct user32_sa_endpoints {
+ unsigned int sae_srcif; /* optional source interface */
+ user32_addr_t sae_srcaddr; /* optional source address */
+ socklen_t sae_srcaddrlen; /* size of source address */
+ user32_addr_t sae_dstaddr; /* destination address */
+ socklen_t sae_dstaddrlen; /* size of destination address */
+};
+
#endif /* XNU_KERNEL_PRIVATE */
#define MSG_OOB 0x1 /* process out-of-band data */
#ifdef PRIVATE
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
-typedef __uint32_t associd_t;
-#define ASSOCID_ANY 0
-#define ASSOCID_ALL ((associd_t)(-1ULL))
-
-typedef __uint32_t connid_t;
-#define CONNID_ANY 0
-#define CONNID_ALL ((connid_t)(-1ULL))
/*
* Structure for SIOCGASSOCIDS
*/
struct so_aidreq {
__uint32_t sar_cnt; /* number of associations */
- associd_t *sar_aidp; /* array of association IDs */
+ sae_associd_t *sar_aidp; /* array of association IDs */
};
#ifdef BSD_KERNEL_PRIVATE
* Structure for SIOCGCONNIDS
*/
struct so_cidreq {
- associd_t scr_aid; /* association ID */
+ sae_associd_t scr_aid; /* association ID */
__uint32_t scr_cnt; /* number of connections */
- connid_t *scr_cidp; /* array of connection IDs */
+ sae_connid_t *scr_cidp; /* array of connection IDs */
};
#ifdef BSD_KERNEL_PRIVATE
struct so_cidreq32 {
- associd_t scr_aid;
+ sae_associd_t scr_aid;
__uint32_t scr_cnt;
user32_addr_t scr_cidp;
};
struct so_cidreq64 {
- associd_t scr_aid;
+ sae_associd_t scr_aid;
__uint32_t scr_cnt;
user64_addr_t scr_cidp __attribute__((aligned(8)));
};
* Structure for SIOCGCONNINFO
*/
struct so_cinforeq {
- connid_t scir_cid; /* connection ID */
+ sae_connid_t scir_cid; /* connection ID */
__uint32_t scir_flags; /* see flags below */
__uint32_t scir_ifindex; /* (last) outbound interface */
__int32_t scir_error; /* most recent error */
#ifdef BSD_KERNEL_PRIVATE
struct so_cinforeq32 {
- connid_t scir_cid;
+ sae_connid_t scir_cid;
__uint32_t scir_flags;
__uint32_t scir_ifindex;
__int32_t scir_error;
};
struct so_cinforeq64 {
- connid_t scir_cid;
+ sae_connid_t scir_cid;
__uint32_t scir_flags;
__uint32_t scir_ifindex;
__int32_t scir_error;
* Structure for SIOC{S,G}CONNORDER
*/
struct so_cordreq {
- connid_t sco_cid; /* connection ID */
+ sae_connid_t sco_cid; /* connection ID */
__uint32_t sco_rank; /* rank (0 means unspecified) */
};
#ifndef KERNEL
__BEGIN_DECLS
-extern int connectx(int s, struct sockaddr *, socklen_t, struct sockaddr *,
- socklen_t, __uint32_t, associd_t, connid_t *);
-extern int disconnectx(int s, associd_t, connid_t);
-extern int peeloff(int s, associd_t);
+
+extern int peeloff(int s, sae_associd_t);
extern int socket_delegate(int, int, int, pid_t);
/*
* several datagrams at once in the array of message headers "msgp".
*
* recvmsg_x() can be used only with protocols handlers that have been specially
- * modified to handle sending and receiving several datagrams at once.
+ * modified to support sending and receiving several datagrams at once.
*
* The size of the array "msgp" is given by the argument "cnt".
*
* recvmsg_x() may return with less than "cnt" datagrams received based on
* the low water mark and the amount of data pending in the socket buffer.
*
- * Address and ancillary data are not supported so the following fields
- * must be set to zero on input:
- * "msg_name", "msg_namelen", "msg_control" and "msg_controllen".
- *
- * recvmsg_x() returns the number of datagrams that have been received ,
+ * recvmsg_x() returns the number of datagrams that have been received,
* or -1 if an error occurred.
*
* NOTE: This a private system call, the API is subject to change.
* several datagrams at once in the array of message headers "msgp".
*
* sendmsg_x() can be used only with protocols handlers that have been specially
- * modified to support to handle sending and receiving several datagrams at once.
+ * modified to support sending and receiving several datagrams at once.
*
* The size of the array "msgp" is given by the argument "cnt".
*
#ifndef KERNEL
__BEGIN_DECLS
+
int accept(int, struct sockaddr * __restrict, socklen_t * __restrict)
__DARWIN_ALIAS_C(accept);
int bind(int, const struct sockaddr *, socklen_t) __DARWIN_ALIAS(bind);
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
void pfctlinput(int, struct sockaddr *);
+int connectx(int , const sa_endpoints_t *, sae_associd_t, unsigned int,
+ const struct iovec *, unsigned int, size_t *, sae_connid_t *);
+int disconnectx(int , sae_associd_t, sae_connid_t);
#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
__END_DECLS
#endif /* !KERNEL */