-struct sockaddr *dup_sockaddr __P((struct sockaddr *sa, int canwait));
-int getsock __P((struct filedesc *fdp, int fd, struct file **fpp));
-int sockargs __P((struct mbuf **mp, caddr_t buf, int buflen, int type));
-int getsockaddr __P((struct sockaddr **namp, caddr_t uaddr, size_t len));
-void sbappend __P((struct sockbuf *sb, struct mbuf *m));
-int sbappendaddr __P((struct sockbuf *sb, struct sockaddr *asa,
- struct mbuf *m0, struct mbuf *control));
-int sbappendcontrol __P((struct sockbuf *sb, struct mbuf *m0,
- struct mbuf *control));
-void sbappendrecord __P((struct sockbuf *sb, struct mbuf *m0));
-void sbcheck __P((struct sockbuf *sb));
-void sbcompress __P((struct sockbuf *sb, struct mbuf *m, struct mbuf *n));
-struct mbuf *
- sbcreatecontrol __P((caddr_t p, int size, int type, int level));
-void sbdrop __P((struct sockbuf *sb, int len));
-void sbdroprecord __P((struct sockbuf *sb));
-void sbflush __P((struct sockbuf *sb));
-void sbinsertoob __P((struct sockbuf *sb, struct mbuf *m0));
-void sbrelease __P((struct sockbuf *sb));
-int sbreserve __P((struct sockbuf *sb, u_long cc));
-void sbtoxsockbuf __P((struct sockbuf *sb, struct xsockbuf *xsb));
-int sbwait __P((struct sockbuf *sb));
-int sb_lock __P((struct sockbuf *sb));
-int soabort __P((struct socket *so));
-int soaccept __P((struct socket *so, struct sockaddr **nam));
-struct socket *soalloc __P((int waitok, int dom, int type));
-int sobind __P((struct socket *so, struct sockaddr *nam));
-void socantrcvmore __P((struct socket *so));
-void socantsendmore __P((struct socket *so));
-int soclose __P((struct socket *so));
-int soconnect __P((struct socket *so, struct sockaddr *nam));
-int soconnect2 __P((struct socket *so1, struct socket *so2));
-int socreate __P((int dom, struct socket **aso, int type, int proto));
-void sodealloc __P((struct socket *so));
-int sodisconnect __P((struct socket *so));
-void sofree __P((struct socket *so));
-int sogetopt __P((struct socket *so, struct sockopt *sopt));
-void sohasoutofband __P((struct socket *so));
-void soisconnected __P((struct socket *so));
-void soisconnecting __P((struct socket *so));
-void soisdisconnected __P((struct socket *so));
-void soisdisconnecting __P((struct socket *so));
-int solisten __P((struct socket *so, int backlog));
-struct socket *
- sodropablereq __P((struct socket *head));
-struct socket *
- sonewconn __P((struct socket *head, int connstatus));
-int sooptcopyin __P((struct sockopt *sopt, void *buf, size_t len,
- size_t minlen));
-int sooptcopyout __P((struct sockopt *sopt, void *buf, size_t len));
+#define SBL_WAIT 0x00000001 /* Wait if not immediately available. */
+#define SBL_NOINTR 0x00000002 /* Force non-interruptible sleep. */
+#define SBL_IGNDEFUNCT 0x00000004 /* Ignore defunct'd state */
+#define SBL_VALID (SBL_WAIT | SBL_NOINTR | SBL_IGNDEFUNCT)
+extern int sblock(struct sockbuf *sb, uint32_t flags);
+extern void sbunlock(struct sockbuf *sb, boolean_t keeplocked);
+
+extern int soaccept(struct socket *so, struct sockaddr **nam);
+extern int soacceptlock(struct socket *so, struct sockaddr **nam, int dolock);
+extern int soacceptfilter(struct socket *so, struct socket *head);
+extern struct socket *soalloc(int waitok, int dom, int type);
+extern int sobindlock(struct socket *so, struct sockaddr *nam, int dolock);
+extern int soclose(struct socket *so);
+extern int soclose_locked(struct socket *so);
+extern void soclose_wait_locked(struct socket *so);
+extern int soconnect(struct socket *so, struct sockaddr *nam);
+extern int soconnectlock(struct socket *so, struct sockaddr *nam, int dolock);
+extern int soconnect2(struct socket *so1, struct socket *so2);
+extern int soconnectxlocked(struct socket *so, struct sockaddr *src,
+ struct sockaddr *dst, struct proc *, uint32_t, sae_associd_t,
+ sae_connid_t *, uint32_t, void *, u_int32_t, uio_t, user_ssize_t *);
+extern int sodisconnectx(struct socket *so, sae_associd_t, sae_connid_t);
+extern int sodisconnectxlocked(struct socket *so, sae_associd_t, sae_connid_t);
+extern void soevupcall(struct socket *, u_int32_t);
+/* flags for socreate_internal */
+#define SOCF_MPTCP 0x1 /* MPTCP-subflow */
+extern int socreate_internal(int dom, struct socket **aso, int type, int proto,
+ struct proc *, uint32_t, struct proc *);
+extern int socreate(int dom, struct socket **aso, int type, int proto);
+extern int socreate_delegate(int dom, struct socket **aso, int type, int proto,
+ pid_t epid);
+extern void sodealloc(struct socket *so);
+extern int sodisconnectlocked(struct socket *so);
+extern void soreference(struct socket *so);
+extern void sodereference(struct socket *so);
+extern void somultipages(struct socket *, boolean_t);
+extern void soif2kcl(struct socket *, boolean_t);
+extern int sosetdefunct(struct proc *, struct socket *, int level, boolean_t);
+extern int sodefunct(struct proc *, struct socket *, int level);
+extern int soresume(struct proc *, struct socket *, int);
+extern void resume_proc_sockets(proc_t);
+extern int so_check_extended_bk_idle_time(struct socket *);
+extern void so_drain_extended_bk_idle(struct socket *);
+extern void sohasoutofband(struct socket *so);
+extern void sodisconnectwakeup(struct socket *so);
+extern int soisthrottled(struct socket *so);
+extern int soisprivilegedtraffic(struct socket *so);
+extern int soissrcbackground(struct socket *so);
+extern int soissrcrealtime(struct socket *so);
+extern int soissrcbesteffort(struct socket *so);
+extern void soclearfastopen(struct socket *so);
+extern int solisten(struct socket *so, int backlog);
+extern struct socket *sodropablereq(struct socket *head);
+extern lck_mtx_t *socket_getlock(struct socket *so, int flags);
+extern void socket_lock(struct socket *so, int refcount);
+extern void socket_lock_assert_owned(struct socket *so);
+extern int socket_try_lock(struct socket *so);
+extern void socket_unlock(struct socket *so, int refcount);
+extern int sogetaddr_locked(struct socket *, struct sockaddr **, int);
+extern const char *solockhistory_nr(struct socket *);
+extern void soevent(struct socket *so, long hint);
+extern void sorflush(struct socket *so);
+extern void sowflush(struct socket *so);
+extern void sowakeup(struct socket *so, struct sockbuf *sb, struct socket *so2);
+extern int soioctl(struct socket *so, u_long cmd, caddr_t data, struct proc *p);
+extern int sogetoptlock(struct socket *so, struct sockopt *sopt, int);
+extern int sosetoptlock(struct socket *so, struct sockopt *sopt, int);
+extern int soshutdown(struct socket *so, int how);
+extern int soshutdownlock(struct socket *so, int how);
+extern int soshutdownlock_final(struct socket *so, int how);
+extern void sotoxsocket(struct socket *so, struct xsocket *xso);
+#if !CONFIG_EMBEDDED
+extern void sotoxsocket64(struct socket *so, struct xsocket64 *xso);
+#endif /* !CONFIG_EMBEDDED */
+extern int sosendallatonce(struct socket *so);
+extern int soreadable(struct socket *so);
+extern int sowriteable(struct socket *so);
+extern void sowwakeup(struct socket *so);
+extern int sosendcheck(struct socket *, struct sockaddr *, user_ssize_t,
+ int32_t, int32_t, int, int *, struct mbuf *);
+
+extern int soo_ioctl(struct fileproc *, u_long, caddr_t, vfs_context_t);
+extern int soo_stat(struct socket *, void *, int);
+extern int soo_select(struct fileproc *, int, void *, vfs_context_t);
+extern int soo_kqfilter(struct fileproc *, struct knote *, struct kevent_qos_s *);
+
+/* Service class flags used for setting service class on a packet */
+#define PKT_SCF_IPV6 0x00000001 /* IPv6 packet */
+#define PKT_SCF_TCP_ACK 0x00000002 /* Pure TCP ACK */
+#define PKT_SCF_TCP_SYN 0x00000004 /* TCP SYN */