diff options
author | kmacy <kmacy@FreeBSD.org> | 2008-07-21 00:08:34 +0000 |
---|---|---|
committer | kmacy <kmacy@FreeBSD.org> | 2008-07-21 00:08:34 +0000 |
commit | d24f4bd48af063b31a11caa2939d7cb9e7cb791e (patch) | |
tree | fe47fe4010a4757a836422634b5b85bff996a54a | |
parent | 739989a3ea9e9c3d2e58cc99eef0c6f6e3a530c4 (diff) | |
download | FreeBSD-src-d24f4bd48af063b31a11caa2939d7cb9e7cb791e.zip FreeBSD-src-d24f4bd48af063b31a11caa2939d7cb9e7cb791e.tar.gz |
add inpcb accessor functions for fields needed by TOE devices
-rw-r--r-- | sys/netinet/in_pcb.c | 54 | ||||
-rw-r--r-- | sys/netinet/in_pcb.h | 8 |
2 files changed, 62 insertions, 0 deletions
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index 9728a58..83e244e 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -1254,6 +1254,60 @@ inp_unlock_assert(struct inpcb *inp) } #endif +void +inp_apply_all(void (*func)(struct inpcb *, void *), void *arg) +{ + struct inpcb *inp; + + INP_INFO_RLOCK(&tcbinfo); + LIST_FOREACH(inp, tcbinfo.ipi_listhead, inp_list) { + INP_WLOCK(inp); + func(inp, arg); + INP_WUNLOCK(inp); + } + INP_INFO_RUNLOCK(&tcbinfo); +} + +struct socket * +inp_inpcbtosocket(struct inpcb *inp) +{ + + INP_WLOCK_ASSERT(inp); + return (inp->inp_socket); +} + +struct tcpcb * +inp_inpcbtotcpcb(struct inpcb *inp) +{ + + INP_WLOCK_ASSERT(inp); + return ((struct tcpcb *)inp->inp_ppcb); +} + +int +inp_ip_tos_get(const struct inpcb *inp) +{ + + return (inp->inp_ip_tos); +} + +void +inp_ip_tos_set(struct inpcb *inp, int val) +{ + + inp->inp_ip_tos = val; +} + +void +inp_4tuple_get(const struct inpcb *inp, uint32_t *laddr, uint16_t *lp, uint32_t *faddr, uint16_t *fp) +{ + memcpy(laddr, &inp->inp_laddr, 4); + memcpy(faddr, &inp->inp_faddr, 4); + + *lp = inp->inp_lport; + *fp = inp->inp_fport; +} + #ifdef DDB static void db_print_indent(int indent) diff --git a/sys/netinet/in_pcb.h b/sys/netinet/in_pcb.h index d3939ee..66a6a41 100644 --- a/sys/netinet/in_pcb.h +++ b/sys/netinet/in_pcb.h @@ -350,6 +350,14 @@ inp_unlock_assert(struct inpcb *inp __unused) } #endif + +void inp_apply_all(void (*func)(struct inpcb *, void *), void *arg); +int inp_ip_tos_get(const struct inpcb *inp); +void inp_ip_tos_set(struct inpcb *inp, int val); +struct socket *inp_inpcbtosocket(struct inpcb *inp); +struct tcpcb *inp_inpcbtotcpcb(struct inpcb *inp); +void inp_4tuple_get(const struct inpcb *inp, uint32_t *laddr, uint16_t *lp, uint32_t *faddr, uint16_t *fp); + #endif /* _KERNEL */ |