From 69e9423833246163c0d60bcdc1228d147951c3c1 Mon Sep 17 00:00:00 2001 From: Lorenzo Miniero Date: Thu, 1 Oct 2020 12:09:12 +0200 Subject: [PATCH] Add new method to init the stack with threads but no UDP encapsulation --- usrsctplib/netinet/sctp_usrreq.c | 2 +- usrsctplib/user_socket.c | 10 ++++++++++ usrsctplib/usrsctp.h | 5 +++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/usrsctplib/netinet/sctp_usrreq.c b/usrsctplib/netinet/sctp_usrreq.c index 5e5436048..278b8ab92 100755 --- a/usrsctplib/netinet/sctp_usrreq.c +++ b/usrsctplib/netinet/sctp_usrreq.c @@ -138,7 +138,7 @@ sctp_init(void) SCTP_BASE_VAR(timer_thread_started) = 0; #endif #if defined(__Userspace__) - sctp_pcb_init(start_threads); + sctp_pcb_init(start_threads == 1); if (start_threads) { sctp_start_timer_thread(); } diff --git a/usrsctplib/user_socket.c b/usrsctplib/user_socket.c index 7aeb7337e..18b837600 100755 --- a/usrsctplib/user_socket.c +++ b/usrsctplib/user_socket.c @@ -113,6 +113,16 @@ usrsctp_init(uint16_t port, } +void +usrsctp_init_noudpthread(uint16_t port, + int (*conn_output)(void *addr, void *buffer, size_t length, uint8_t tos, uint8_t set_df), + void (*debug_printf)(const char *format, ...)) +{ + init_sync(); + sctp_init(port, conn_output, debug_printf, 2); +} + + void usrsctp_init_nothreads(uint16_t port, int (*conn_output)(void *addr, void *buffer, size_t length, uint8_t tos, uint8_t set_df), diff --git a/usrsctplib/usrsctp.h b/usrsctplib/usrsctp.h index b7192904e..22f277887 100644 --- a/usrsctplib/usrsctp.h +++ b/usrsctplib/usrsctp.h @@ -895,6 +895,11 @@ usrsctp_init(uint16_t, int (*)(void *addr, void *buffer, size_t length, uint8_t tos, uint8_t set_df), void (*)(const char *format, ...)); +void +usrsctp_init_noudpthread(uint16_t, + int (*)(void *addr, void *buffer, size_t length, uint8_t tos, uint8_t set_df), + void (*)(const char *format, ...)); + void usrsctp_init_nothreads(uint16_t, int (*)(void *addr, void *buffer, size_t length, uint8_t tos, uint8_t set_df),