34 #include <sys/cdefs.h> 35 __FBSDID(
"$FreeBSD: head/sys/netinet/sctputil.h 298508 2016-04-23 09:15:58Z tuexen $");
38 #ifndef _NETINET_SCTP_UTIL_H_ 39 #define _NETINET_SCTP_UTIL_H_ 41 #if defined(_KERNEL) || defined(__Userspace__) 43 #define SCTP_READ_LOCK_HELD 1 44 #define SCTP_READ_LOCK_NOT_HELD 0 46 #ifdef SCTP_ASOCLOG_OF_TSNS 47 void sctp_print_out_track_log(
struct sctp_tcb *stcb);
50 #ifdef SCTP_MBUF_LOGGING 52 void sctp_m_freem(
struct mbuf *
m);
54 #define sctp_m_free m_free 55 #define sctp_m_freem m_freem 58 #if defined(SCTP_LOCAL_TRACE_BUF) || defined(__APPLE__) 63 #define sctp_get_associd(stcb) ((sctp_assoc_t)stcb->asoc.assoc_id) 112 #
if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING)
117 #if defined(__Userspace__) 118 void sctp_invoke_recv_callback(
struct sctp_inpcb *,
132 #
if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING)
147 struct sctp_nets *,
struct timeval *,
int,
int);
164 #
if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING)
172 struct sctp_tcb *stcb,
int waitflags);
178 #
if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING)
187 #
if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING)
195 int,
struct sockaddr *,
struct sockaddr *,
197 #
if defined(__FreeBSD__)
207 #
if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING)
213 struct sockaddr *,
struct sockaddr *,
216 #
if defined(__FreeBSD__)
222 int totaddr,
int *
error);
226 unsigned int *totaddr,
unsigned int *num_v4,
unsigned int *num_v6,
227 int *
error,
unsigned int limit,
int *bad_addr);
231 uint32_t sctp_is_same_scope(
struct sockaddr_in6 *,
struct sockaddr_in6 *);
233 #if defined(SCTP_EMBEDDED_V6_SCOPE) 234 struct sockaddr_in6 *
235 sctp_recover_scope(
struct sockaddr_in6 *,
struct sockaddr_in6 *);
238 #define sctp_recover_scope_mac(addr, store) do { \ 239 if ((addr->sin6_family == AF_INET6) && \ 240 (IN6_IS_SCOPE_LINKLOCAL(&addr->sin6_addr))) { \ 242 if (addr->sin6_scope_id == 0) { \ 243 if (!sa6_recoverscope(store)) { \ 247 in6_clearscope(&addr->sin6_addr); \ 253 #define sctp_recover_scope_mac(addr, store) do { \ 254 if ((addr->sin6_family == AF_INET6) && \ 255 (IN6_IS_SCOPE_LINKLOCAL(&addr->sin6_addr))) { \ 257 if (addr->sin6_scope_id == 0) { \ 258 if (!in6_recoverscope(store, &store->sin6_addr, \ 263 in6_clearscope(&addr->sin6_addr); \ 279 #
if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING)
296 #ifdef SCTP_MBCNT_LOGGING 302 #define sctp_free_bufspace(stcb, asoc, tp1, chk_cnt) \ 304 if (tp1->data != NULL) { \ 305 atomic_subtract_int(&((asoc)->chunks_on_out_queue), chk_cnt); \ 306 if ((asoc)->total_output_queue_size >= tp1->book_size) { \ 307 atomic_subtract_int(&((asoc)->total_output_queue_size), tp1->book_size); \ 309 (asoc)->total_output_queue_size = 0; \ 311 if (stcb->sctp_socket && ((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || \ 312 (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL))) { \ 313 if (stcb->sctp_socket->so_snd.sb_cc >= tp1->book_size) { \ 314 atomic_subtract_int(&((stcb)->sctp_socket->so_snd.sb_cc), tp1->book_size); \ 316 stcb->sctp_socket->so_snd.sb_cc = 0; \ 324 #define sctp_free_spbufspace(stcb, asoc, sp) \ 326 if (sp->data != NULL) { \ 327 if ((asoc)->total_output_queue_size >= sp->length) { \ 328 atomic_subtract_int(&(asoc)->total_output_queue_size, sp->length); \ 330 (asoc)->total_output_queue_size = 0; \ 332 if (stcb->sctp_socket && ((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || \ 333 (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL))) { \ 334 if (stcb->sctp_socket->so_snd.sb_cc >= sp->length) { \ 335 atomic_subtract_int(&stcb->sctp_socket->so_snd.sb_cc,sp->length); \ 337 stcb->sctp_socket->so_snd.sb_cc = 0; \ 343 #define sctp_snd_sb_alloc(stcb, sz) \ 345 atomic_add_int(&stcb->asoc.total_output_queue_size,sz); \ 346 if ((stcb->sctp_socket != NULL) && \ 347 ((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || \ 348 (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL))) { \ 349 atomic_add_int(&stcb->sctp_socket->so_snd.sb_cc,sz); \ 354 #if defined(__APPLE__) || defined(__FreeBSD__) 355 void sctp_over_udp_stop(
void);
356 int sctp_over_udp_start(
void);
358 #if defined(__Windows__) 359 void sctp_over_udp_restart(
void);
366 struct mbuf **controlp,
381 #ifdef SCTP_MBUF_LOGGING 383 sctp_log_mb(
struct mbuf *
m,
int from);
386 sctp_log_mbc(
struct mbuf *
m,
int from);
391 struct sctp_tcb *stcb,
int from,
int incr);
412 void sctp_clr_stat_log(
void);
415 #ifdef SCTP_AUDITING_ENABLED void sctp_notify_stream_reset_tsn(struct sctp_tcb *stcb, uint32_t sending_tsn, uint32_t recv_tsn, int flag)
Definition: sctputil.c:3607
int sctp_init_asoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, uint32_t override_tag, uint32_t vrf_id, uint16_t o_strms)
Definition: sctputil.c:1010
void sctp_handle_ootb(struct mbuf *m, int iphlen, int offset, struct sockaddr *src, struct sockaddr *dst, struct sctphdr *sh, struct sctp_inpcb *inp, struct mbuf *cause, uint32_t vrf_id, uint16_t port)
Definition: sctputil.c:4335
caddr_t sctp_m_getptr(struct mbuf *m, int off, int len, uint8_t *in_ptr)
Definition: sctputil.c:2687
DOMString p
Definition: WebCryptoAPI.idl:116
struct mbuf * sctp_pad_lastmbuf(struct mbuf *m, int padval, struct mbuf *last_mbuf)
Definition: sctputil.c:2772
uint32_t flag
Definition: ssl_lib.c:2732
void sctp_bindx_delete_address(struct sctp_inpcb *inp, struct sockaddr *sa, sctp_assoc_t assoc_id, uint32_t vrf_id, int *error)
Definition: sctputil.c:7346
void sctp_misc_ints(uint8_t from, uint32_t a, uint32_t b, uint32_t c, uint32_t d)
Definition: sctputil.c:515
int c
Definition: cpp_unittests.cpp:275
Definition: sctp_structs.h:305
GLuint GLuint end
Definition: gl2ext.h:323
void sctp_timeout_handler(void *t)
Definition: sctputil.c:1597
Definition: sctp_header.h:315
signed int int32_t
Definition: ptypes.h:101
Definition: sctp_pcb.h:444
unsigned int uint32_t
Definition: ptypes.h:105
uint32_t sctp_select_a_tag(struct sctp_inpcb *inp, uint16_t lport, uint16_t rport, int check)
Definition: sctputil.c:945
int sctp_expand_mapping_array(struct sctp_association *asoc, uint32_t needed)
Definition: sctputil.c:1316
void sctp_log_maxburst(struct sctp_tcb *stcb, struct sctp_nets *net, int error, int burst, uint8_t from)
Definition: sctputil.c:424
int sctp_fill_stat_log(void *optval SCTP_UNUSED, size_t *optsize SCTP_UNUSED)
Definition: sctputil.c:597
void sctp_abort_association(struct sctp_inpcb *inp, struct sctp_tcb *stcb, struct mbuf *m, int iphlen, struct sockaddr *src, struct sockaddr *dst, struct sctphdr *sh, struct mbuf *op_err, uint32_t vrf_id, uint16_t port)
Definition: sctputil.c:4145
const GLfloat * m
Definition: gl2ext.h:850
Definition: user_socketvar.h:125
int sctp_dynamic_set_primary(struct sockaddr *sa, uint32_t vrf_id)
Definition: sctputil.c:6738
void sctp_add_to_readq(struct sctp_inpcb *inp, struct sctp_tcb *stcb, struct sctp_queued_to_read *control, struct sockbuf *sb, int end, int inp_read_lock_held, int so_locked SCTP_UNUSED)
Definition: sctputil.c:4900
signed short int16_t
Definition: ptypes.h:93
struct sctp_ifa * sctp_find_ifa_in_ep(struct sctp_inpcb *inp, struct sockaddr *addr, int holds_lock)
Definition: sctputil.c:5348
uint32_t sctp_select_initial_TSN(struct sctp_pcb *inp)
Definition: sctputil.c:907
void sctp_abort_notification(struct sctp_tcb *stcb, uint8_t from_peer, uint16_t error, struct sctp_abort_chunk *abort, int so_locked SCTP_UNUSED)
Definition: sctputil.c:4108
Definition: sctp_structs.h:514
struct mbuf * sctp_generate_cause(uint16_t code, char *info)
Definition: sctputil.c:5016
int sctp_release_pr_sctp_chunk(struct sctp_tcb *stcb, struct sctp_tmit_chunk *tp1, uint8_t sent, int so_locked SCTP_UNUSED)
Definition: sctputil.c:5097
void sctp_wakeup_the_read_socket(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int so_locked SCTP_UNUSED)
Definition: sctputil.c:4758
void sctp_wakeup_log(struct sctp_tcb *stcb, uint32_t wake_cnt, int from)
Definition: sctputil.c:526
void sctp_log_map(uint32_t map, uint32_t cum, uint32_t high, int from)
Definition: sctputil.c:219
void sctp_abort_an_association(struct sctp_inpcb *inp, struct sctp_tcb *stcb, struct mbuf *op_err, int so_locked SCTP_UNUSED)
Definition: sctputil.c:4257
OPENSSL_EXPORT X509_EXTENSION int loc
Definition: x509.h:996
#define SCTP_UNUSED
Definition: sctp_os_userspace.h:807
struct mbuf * sctp_generate_no_user_data_cause(uint32_t tsn)
Definition: sctputil.c:5043
Definition: quicdatachannel.h:29
uint32_t vrf_id
Definition: sctp_pcb.h:115
endif
Definition: downloads.php:90
unsigned char uint8_t
Definition: ptypes.h:89
uint32_t sctp_get_ifa_hash_val(struct sockaddr *addr)
Definition: sctputil.c:5408
struct sctp_paramhdr * sctp_get_next_param(struct mbuf *m, int offset, struct sctp_paramhdr *pull, int pull_limit)
Definition: sctputil.c:2729
unsigned short uint16_t
Definition: ptypes.h:97
uint32_t sctp_get_prev_mtu(uint32_t val)
Definition: sctputil.c:854
void sctp_timer_stop(int t_type, struct sctp_inpcb *inp, struct sctp_tcb *stcb, struct sctp_nets *net, uint32_t from)
Definition: sctputil.c:2360
struct mbuf * sctp_add_pad_tombuf(struct mbuf *m, int padlen)
Definition: sctputil.c:2741
Definition: sctp_structs.h:848
void sctp_log_nagle_event(struct sctp_tcb *stcb, int action)
Definition: sctputil.c:177
int sctp_connectx_helper_add(struct sctp_tcb *stcb, struct sockaddr *addr, int totaddr, int *error)
Definition: sctputil.c:7008
Definition: sctp_pcb.h:352
GLboolean GLboolean GLboolean GLboolean a
Definition: gl2ext.h:306
uint32_t sctp_calculate_len(struct mbuf *m)
Definition: sctputil.c:2517
Definition: sctp_pcb.h:614
short sb[N]
Definition: gcc-loops.cpp:21
Definition: user_mbuf.h:231
void sctp_mtu_size_reset(struct sctp_inpcb *inp, struct sctp_association *asoc, uint32_t mtu)
Definition: sctputil.c:2531
void sctp_log_block(uint8_t from, struct sctp_association *asoc, size_t sendlen)
Definition: sctputil.c:574
Definition: user_socketvar.h:85
GLfloat f
Definition: gl2.h:417
void sctp_timer_start(int t_type, struct sctp_inpcb *inp, struct sctp_tcb *stcb, struct sctp_nets *net)
Definition: sctputil.c:2067
short sa[N]
Definition: gcc-loops.cpp:20
Definition: sctp_pcb.h:103
void sctp_print_mapping_array(struct sctp_association *asoc)
Definition: sctputil.c:1281
void sctp_print_address(struct sockaddr *sa)
Definition: sctputil.c:4589
str
Definition: make-dist.py:305
void sctp_bindx_add_address(struct socket *so, struct sctp_inpcb *inp, struct sockaddr *sa, sctp_assoc_t assoc_id, uint32_t vrf_id, int *error, void *p)
Definition: sctputil.c:7191
int sctp_is_there_an_abort_here(struct mbuf *m, int iphlen, uint32_t *vtagfill)
Definition: sctputil.c:4417
int sctp_local_addr_count(struct sctp_tcb *stcb)
Definition: sctputil.c:7455
void sctp_log_cwnd(struct sctp_tcb *stcb, struct sctp_nets *net, int augment, uint8_t from)
Definition: sctputil.c:333
uint32_t sctp_calculate_rto(struct sctp_tcb *stcb, struct sctp_association *asoc, struct sctp_nets *net, struct timeval *told, int safe, int rtt_from_sack)
Definition: sctputil.c:2568
void sctp_stop_timers_for_shutdown(struct sctp_tcb *stcb)
Definition: sctputil.c:806
uint32_t sctp_get_next_mtu(uint32_t val)
Definition: sctputil.c:874
void sctp_ulp_notify(uint32_t notification, struct sctp_tcb *stcb, uint32_t error, void *data, int so_locked SCTP_UNUSED)
Definition: sctputil.c:3783
void sctp_fill_random_store(struct sctp_pcb *m)
Definition: sctputil.c:888
DOMString e
Definition: WebCryptoAPI.idl:115
void sctp_log_sack(uint32_t old_cumack, uint32_t cumack, uint32_t tsn, uint16_t gaps, uint16_t dups, int from)
Definition: sctputil.c:198
void sctp_report_all_outbound(struct sctp_tcb *stcb, uint16_t error, int holds_lock, int so_locked SCTP_UNUSED)
Definition: sctputil.c:3989
void sctp_notify_stream_reset_add(struct sctp_tcb *stcb, uint16_t numberin, uint16_t numberout, int flag)
Definition: sctputil.c:3551
GLboolean GLboolean GLboolean b
Definition: gl2ext.h:306
struct sctp_ifa * sctp_find_ifa_by_addr(struct sockaddr *addr, uint32_t vrf_id, int holds_lock)
Definition: sctputil.c:5460
struct sctp_tcb * sctp_connectx_helper_find(struct sctp_inpcb *inp, struct sockaddr *addr, unsigned int *totaddr, unsigned int *num_v4, unsigned int *num_v6, int *error, unsigned int limit, int *bad_addr)
Definition: sctputil.c:7105
void rto_logging(struct sctp_nets *net, int from)
Definition: sctputil.c:136
uint32_t sctp_assoc_t
Definition: sctp_uio.h:65
void sctp_log_lock(struct sctp_inpcb *inp, struct sctp_tcb *stcb, uint8_t from)
Definition: sctputil.c:371
void sctp_log_strm_del(struct sctp_queued_to_read *control, struct sctp_queued_to_read *poschk, int from)
Definition: sctputil.c:302
void sctp_log_closing(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int16_t loc)
Definition: sctputil.c:110
void sctp_pull_off_control_to_new_inp(struct sctp_inpcb *old_inp, struct sctp_inpcb *new_inp, struct sctp_tcb *stcb, int waitflags)
Definition: sctputil.c:4662
void sctp_sblog(struct sockbuf *sb, struct sctp_tcb *stcb, int from, int incr)
Definition: sctputil.c:87
void sctp_log_rwnd_set(uint8_t from, uint32_t peers_rwnd, uint32_t flight_size, uint32_t overhead, uint32_t a_rwndval)
Definition: sctputil.c:473
void sctp_iterator_worker(void)
Definition: sctputil.c:1507
int32_t sctp_map_assoc_state(int kernel_state)
Definition: sctputil.c:967
int sctp_soreceive(struct socket *so, struct sockaddr **psa, struct uio *uio, struct mbuf **mp0, struct mbuf **controlp, int *flagsp)
Definition: sctputil.c:6788
#define d
Definition: float-mm.c:30
int sctp_cmpaddr(struct sockaddr *sa1, struct sockaddr *sa2)
Definition: sctputil.c:4537
void sctp_log_rwnd(uint8_t from, uint32_t peers_rwnd, uint32_t snd_size, uint32_t overhead)
Definition: sctputil.c:453
void sctp_log_fr(uint32_t biggest_tsn, uint32_t biggest_new_tsn, uint32_t tsn, int from)
Definition: sctputil.c:239
void sctp_log_strm_del_alt(struct sctp_tcb *stcb, uint32_t tsn, uint16_t sseq, uint16_t stream, int from)
Definition: sctputil.c:155
Definition: sctp_structs.h:487