diff options
author | Taylor Brandstetter <deadbeef@google.com> | 2020-05-15 02:20:35 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-15 11:20:35 +0200 |
commit | df49eb6e19b84905d0b20dd79edf81ec7a76f133 (patch) | |
tree | 7b1c746b9df3b866bb19e4ae01ae5b249fd077a1 | |
parent | a5f8b654ecda961e013b29695814dd1f2a9ae13b (diff) | |
download | usrsctp-df49eb6e19b84905d0b20dd79edf81ec7a76f133.tar.gz |
Add usrsctp_get_ulpinfo getter. (#467)
-rwxr-xr-x | usrsctplib/netinet/sctp_pcb.h | 1 | ||||
-rwxr-xr-x | usrsctplib/netinet/sctp_usrreq.c | 19 | ||||
-rwxr-xr-x | usrsctplib/user_socket.c | 7 | ||||
-rw-r--r-- | usrsctplib/usrsctp.h | 3 |
4 files changed, 30 insertions, 0 deletions
diff --git a/usrsctplib/netinet/sctp_pcb.h b/usrsctplib/netinet/sctp_pcb.h index fbc80228..f38e8a5b 100755 --- a/usrsctplib/netinet/sctp_pcb.h +++ b/usrsctplib/netinet/sctp_pcb.h @@ -614,6 +614,7 @@ int register_recv_cb (struct socket *, struct sctp_rcvinfo, int, void *)); int register_send_cb (struct socket *, uint32_t, int (*)(struct socket *, uint32_t)); int register_ulp_info (struct socket *, void *); +int retrieve_ulp_info (struct socket *, void **); #endif struct sctp_tcb { diff --git a/usrsctplib/netinet/sctp_usrreq.c b/usrsctplib/netinet/sctp_usrreq.c index ecdc184d..d71f9e26 100755 --- a/usrsctplib/netinet/sctp_usrreq.c +++ b/usrsctplib/netinet/sctp_usrreq.c @@ -9205,4 +9205,23 @@ register_ulp_info (struct socket *so, void *ulp_info) SCTP_INP_WUNLOCK(inp); return (1); } + +int +retrieve_ulp_info (struct socket *so, void **pulp_info) +{ + struct sctp_inpcb *inp; + + if (pulp_info == NULL) { + return (0); + } + + inp = (struct sctp_inpcb *) so->so_pcb; + if (inp == NULL) { + return (0); + } + SCTP_INP_RLOCK(inp); + *pulp_info = inp->ulp_info; + SCTP_INP_RUNLOCK(inp); + return (1); +} #endif diff --git a/usrsctplib/user_socket.c b/usrsctplib/user_socket.c index b9e87ec2..c2fb0407 100755 --- a/usrsctplib/user_socket.c +++ b/usrsctplib/user_socket.c @@ -2583,6 +2583,13 @@ usrsctp_set_ulpinfo(struct socket *so, void *ulp_info) return (register_ulp_info(so, ulp_info)); } + +int +usrsctp_get_ulpinfo(struct socket *so, void **pulp_info) +{ + return (retrieve_ulp_info(so, pulp_info)); +} + int usrsctp_bindx(struct socket *so, struct sockaddr *addrs, int addrcnt, int flags) { diff --git a/usrsctplib/usrsctp.h b/usrsctplib/usrsctp.h index 37d4828f..ede54891 100644 --- a/usrsctplib/usrsctp.h +++ b/usrsctplib/usrsctp.h @@ -1033,6 +1033,9 @@ int usrsctp_set_ulpinfo(struct socket *, void *); int +usrsctp_get_ulpinfo(struct socket *, void **); + +int usrsctp_set_upcall(struct socket *so, void (*upcall)(struct socket *, void *, int), void *arg); |