-#define sotoin6pcb(so) sotoinpcb(so) /* for KAME src sync over BSD*'s */
-
-#define INP_SOCKAF(so) so->so_proto->pr_domain->dom_family
-
-#define INP_CHECK_SOCKAF(so, af) (INP_SOCKAF(so) == af)
-
-#ifdef KERNEL
-extern int ipport_lowfirstauto;
-extern int ipport_lowlastauto;
-extern int ipport_firstauto;
-extern int ipport_lastauto;
-extern int ipport_hifirstauto;
-extern int ipport_hilastauto;
-
-#define INPCB_STATE_INUSE 0x1 /* freshly allocated PCB, it's in use */
-#define INPCB_STATE_CACHED 0x2 /* this pcb is sitting in a a cache */
-#define INPCB_STATE_DEAD 0x3 /* should treat as gone, will be garbage collected and freed */
-
-#define WNT_STOPUSING 0xffff /* marked as ready to be garbaged collected, should be treated as not found */
-#define WNT_ACQUIRE 0x1 /* that pcb is being acquired, do not recycle this time */
-#define WNT_RELEASE 0x2 /* release acquired mode, can be garbage collected when wantcnt is null */
-
-
-void in_pcbpurgeif0(struct inpcb *, struct ifnet *);
-void in_losing(struct inpcb *);
-void in_rtchange(struct inpcb *, int);
-int in_pcballoc(struct socket *, struct inpcbinfo *, struct proc *);
-int in_pcbbind(struct inpcb *, struct sockaddr *, struct proc *);
-int in_pcbconnect(struct inpcb *, struct sockaddr *, struct proc *);
-void in_pcbdetach(struct inpcb *);
-void in_pcbdispose (struct inpcb *);
-void in_pcbdisconnect(struct inpcb *);
-int in_pcbinshash(struct inpcb *, int);
-int in_pcbladdr(struct inpcb *, struct sockaddr *, struct sockaddr_in **);
-struct inpcb *
- in_pcblookup_local(struct inpcbinfo *, struct in_addr, u_int, int);
-struct inpcb *
- in_pcblookup_hash(struct inpcbinfo *,
- struct in_addr, u_int, struct in_addr, u_int,
- int, struct ifnet *);
-void in_pcbnotifyall(struct inpcbinfo *, struct in_addr,
- int, void (*)(struct inpcb *, int));
-void in_pcbrehash(struct inpcb *);
-int in_setpeeraddr(struct socket *so, struct sockaddr **nam);
-int in_setsockaddr(struct socket *so, struct sockaddr **nam);
-int in_pcb_checkstate(struct inpcb *pcb, int mode, int locked);
-
-int
-in_pcb_grab_port (struct inpcbinfo *pcbinfo,
- u_short options,
- struct in_addr laddr,
- u_short *lport,
- struct in_addr faddr,
- u_short fport,
- u_int cookie,
- u_char owner_id);
-
-int
-in_pcb_letgo_port(struct inpcbinfo *pcbinfo,
- struct in_addr laddr,
- u_short lport,
- struct in_addr faddr,
- u_short fport, u_char owner_id);
-
-u_char
-in_pcb_get_owner(struct inpcbinfo *pcbinfo,
- struct in_addr laddr,
- u_short lport,
- struct in_addr faddr,
- u_short fport,
- u_int *cookie);
-
-void in_pcb_nat_init(struct inpcbinfo *pcbinfo, int afamily, int pfamily,
- int protocol);
-
-int
-in_pcb_new_share_client(struct inpcbinfo *pcbinfo, u_char *owner_id);
-
-int
-in_pcb_rem_share_client(struct inpcbinfo *pcbinfo, u_char owner_id);
-
-void in_pcbremlists(struct inpcb *inp);
-int in_pcb_ckeckstate(struct inpcb *, int, int);
-void inpcb_to_compat(struct inpcb *inp, struct inpcb_compat *inp_compat);
-
-#endif /* KERNEL */
-#endif /* KERNEL_PRIVATE */
+#define sotoin6pcb(so) sotoinpcb(so)
+
+struct sysctl_req;
+
+extern int ipport_lowfirstauto;
+extern int ipport_lowlastauto;
+extern int ipport_firstauto;
+extern int ipport_lastauto;
+extern int ipport_hifirstauto;
+extern int ipport_hilastauto;
+
+/* freshly allocated PCB, it's in use */
+#define INPCB_STATE_INUSE 0x1
+/* this pcb is sitting in a a cache */
+#define INPCB_STATE_CACHED 0x2
+/* should treat as gone, will be garbage collected and freed */
+#define INPCB_STATE_DEAD 0x3
+
+/* marked as ready to be garbaged collected, should be treated as not found */
+#define WNT_STOPUSING 0xffff
+/* that pcb is being acquired, do not recycle this time */
+#define WNT_ACQUIRE 0x1
+/* release acquired mode, can be garbage collected when wantcnt is null */
+#define WNT_RELEASE 0x2
+
+extern void in_pcbinit(void);
+extern void in_pcbinfo_attach(struct inpcbinfo *);
+extern int in_pcbinfo_detach(struct inpcbinfo *);
+
+/* type of timer to be scheduled by inpcb_gc_sched and inpcb_timer_sched */
+enum {
+ INPCB_TIMER_LAZY = 0x1,
+ INPCB_TIMER_FAST,
+ INPCB_TIMER_NODELAY
+};
+extern void inpcb_gc_sched(struct inpcbinfo *, u_int32_t type);
+extern void inpcb_timer_sched(struct inpcbinfo *, u_int32_t type);
+
+extern void in_losing(struct inpcb *);
+extern void in_rtchange(struct inpcb *, int);
+extern int in_pcballoc(struct socket *, struct inpcbinfo *, struct proc *);
+extern int in_pcbbind(struct inpcb *, struct sockaddr *, struct proc *);
+extern int in_pcbconnect(struct inpcb *, struct sockaddr *, struct proc *,
+ unsigned int, struct ifnet **);
+extern void in_pcbdetach(struct inpcb *);
+extern void in_pcbdispose(struct inpcb *);
+extern void in_pcbdisconnect(struct inpcb *);
+extern int in_pcbinshash(struct inpcb *, int);
+extern int in_pcbladdr(struct inpcb *, struct sockaddr *, struct in_addr *,
+ unsigned int, struct ifnet **, int);
+extern struct inpcb *in_pcblookup_local(struct inpcbinfo *, struct in_addr,
+ u_int, int);
+extern struct inpcb *in_pcblookup_local_and_cleanup(struct inpcbinfo *,
+ struct in_addr, u_int, int);
+extern struct inpcb *in_pcblookup_hash(struct inpcbinfo *, struct in_addr,
+ u_int, struct in_addr, u_int, int, struct ifnet *);
+extern int in_pcblookup_hash_exists(struct inpcbinfo *, struct in_addr,
+ u_int, struct in_addr, u_int, int, uid_t *, gid_t *, struct ifnet *);
+extern void in_pcbnotifyall(struct inpcbinfo *, struct in_addr, int,
+ void (*)(struct inpcb *, int));
+extern void in_pcbrehash(struct inpcb *);
+extern int in_getpeeraddr(struct socket *, struct sockaddr **);
+extern int in_getsockaddr(struct socket *, struct sockaddr **);
+extern int in_getsockaddr_s(struct socket *, struct sockaddr_in *);
+extern int in_pcb_checkstate(struct inpcb *, int, int);
+extern void in_pcbremlists(struct inpcb *);
+extern void inpcb_to_compat(struct inpcb *, struct inpcb_compat *);
+#if !CONFIG_EMBEDDED
+extern void inpcb_to_xinpcb64(struct inpcb *, struct xinpcb64 *);
+#endif