-int soopt_getm(struct sockopt *sopt, struct mbuf **mp);
-int soopt_mcopyin(struct sockopt *sopt, struct mbuf *m);
-int soopt_mcopyout(struct sockopt *sopt, struct mbuf *m);
-
-int sopoll(struct socket *so, int events, struct ucred *cred, void *wql);
-int soreceive(struct socket *so, struct sockaddr **paddr,
- struct uio *uio, struct mbuf **mp0,
- struct mbuf **controlp, int *flagsp);
-int soreserve(struct socket *so, u_long sndcc, u_long rcvcc);
-void sorflush(struct socket *so);
-int sosend(struct socket *so, struct sockaddr *addr, struct uio *uio,
- struct mbuf *top, struct mbuf *control, int flags);
-
-int sosetopt(struct socket *so, struct sockopt *sopt);
-int soshutdown(struct socket *so, int how);
-void sotoxsocket(struct socket *so, struct xsocket *xso);
-void sowakeup(struct socket *so, struct sockbuf *sb);
-int soioctl(struct socket *so, u_long cmd, caddr_t data, struct proc *p);
-
-#ifndef __APPLE__
-/* accept filter functions */
-int accept_filt_add(struct accept_filter *filt);
-int accept_filt_del(char *name);
-struct accept_filter * accept_filt_get(char *name);
-#ifdef ACCEPT_FILTER_MOD
-int accept_filt_generic_mod_event(module_t mod, int event, void *data);
-SYSCTL_DECL(_net_inet_accf);
-#endif /* ACCEPT_FILTER_MOD */
-#endif /* !defined(__APPLE__) */
+#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);
+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_list **src_sl,
+ struct sockaddr_list **dst_sl, 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 int sopeelofflocked(struct socket *so, sae_associd_t, struct socket **);
+extern void soevupcall(struct socket *, u_int32_t);
+/* flags for socreate_internal */
+#define SOCF_ASYNC 0x1 /* non-blocking socket */
+#define SOCF_MP_SUBFLOW 0x2 /* multipath subflow socket */
+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 int solisten(struct socket *so, int backlog);
+extern struct socket *sodropablereq(struct socket *head);
+extern int socket_lock(struct socket *so, int refcount);
+extern int 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);
+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);
+extern void sotoxsocket64(struct socket *so, struct xsocket64 *xso);
+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 *, vfs_context_t);
+
+extern struct sockaddr_entry *sockaddrentry_alloc(int);
+extern void sockaddrentry_free(struct sockaddr_entry *);
+extern struct sockaddr_entry *sockaddrentry_dup(const struct sockaddr_entry *,
+ int);
+extern struct sockaddr_list *sockaddrlist_alloc(int);
+extern void sockaddrlist_free(struct sockaddr_list *);
+extern void sockaddrlist_insert(struct sockaddr_list *,
+ struct sockaddr_entry *);
+extern void sockaddrlist_remove(struct sockaddr_list *,
+ struct sockaddr_entry *);
+extern struct sockaddr_list *sockaddrlist_dup(const struct sockaddr_list *,
+ int);
+
+/* 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 */