2 * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved.
3 * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved.
4 * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
9 * a) Redistributions of source code must retain the above copyright notice,
10 * this list of conditions and the following disclaimer.
12 * b) Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in
14 * the documentation and/or other materials provided with the distribution.
16 * c) Neither the name of Cisco Systems, Inc. nor the names of its
17 * contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
30 * THE POSSIBILITY OF SUCH DAMAGE.
34 #include <sys/cdefs.h>
35 __FBSDID("$FreeBSD: head/sys/netinet/sctp_pcb.h 269858 2014-08-12 11:30:16Z tuexen $");
38 #ifndef _NETINET_SCTP_PCB_H_
39 #define _NETINET_SCTP_PCB_H_
41 #include <netinet/sctp_os.h>
42 #include <netinet/sctp.h>
43 #include <netinet/sctp_constants.h>
44 #include <netinet/sctp_sysctl.h>
46 LIST_HEAD(sctppcbhead, sctp_inpcb);
47 LIST_HEAD(sctpasochead, sctp_tcb);
48 LIST_HEAD(sctpladdr, sctp_laddr);
49 LIST_HEAD(sctpvtaghead, sctp_tagblock);
50 LIST_HEAD(sctp_vrflist, sctp_vrf);
51 LIST_HEAD(sctp_ifnlist, sctp_ifn);
52 LIST_HEAD(sctp_ifalist, sctp_ifa);
53 TAILQ_HEAD(sctp_readhead, sctp_queued_to_read);
54 TAILQ_HEAD(sctp_streamhead, sctp_stream_queue_pending);
56 #include <netinet/sctp_structs.h>
57 #include <netinet/sctp_auth.h>
59 #define SCTP_PCBHASH_ALLADDR(port, mask) (port & mask)
60 #define SCTP_PCBHASH_ASOC(tag, mask) (tag & mask)
63 LIST_ENTRY (sctp_vrf) next_vrf;
64 struct sctp_ifalist *vrf_addr_hash;
65 struct sctp_ifnlist ifnlist;
67 uint32_t tbl_id_v4; /* default v4 table id */
68 uint32_t tbl_id_v6; /* default v6 table id */
69 uint32_t total_ifa_count;
70 u_long vrf_addr_hashmark;
75 struct sctp_ifalist ifalist;
77 LIST_ENTRY(sctp_ifn) next_ifn;
78 LIST_ENTRY(sctp_ifn) next_bucket;
79 void *ifn_p; /* never access without appropriate lock */
82 uint32_t ifn_index; /* shorthand way to look at ifn for reference */
83 uint32_t refcount; /* number of reference held should be >= ifa_count */
84 uint32_t ifa_count; /* IFA's we hold (in our list - ifalist)*/
85 uint32_t num_v6; /* number of v6 addresses */
86 uint32_t num_v4; /* number of v4 addresses */
87 uint32_t registered_af; /* registered address family for i/f events */
88 char ifn_name[SCTP_IFNAMSIZ];
91 /* SCTP local IFA flags */
92 #define SCTP_ADDR_VALID 0x00000001 /* its up and active */
93 #define SCTP_BEING_DELETED 0x00000002 /* being deleted,
94 * when refcount = 0. Note
95 * that it is pulled from the ifn list
96 * and ifa_p is nulled right away but
97 * it cannot be freed until the last *net
98 * pointing to it is deleted.
100 #define SCTP_ADDR_DEFER_USE 0x00000004 /* Hold off using this one */
101 #define SCTP_ADDR_IFA_UNUSEABLE 0x00000008
104 LIST_ENTRY(sctp_ifa) next_ifa;
105 LIST_ENTRY(sctp_ifa) next_bucket;
106 struct sctp_ifn *ifn_p; /* back pointer to parent ifn */
107 void *ifa; /* pointer to ifa, needed for flag
108 * update for that we MUST lock
109 * appropriate locks. This is for V6.
111 union sctp_sockstore address;
112 uint32_t refcount; /* number of folks refering to this */
114 uint32_t localifa_flags;
115 uint32_t vrf_id; /* vrf_id of this addr (for deleting) */
123 LIST_ENTRY(sctp_laddr) sctp_nxt_addr; /* next in list */
124 struct sctp_ifa *ifa;
125 uint32_t action; /* Used during asconf and adding
126 * if no-zero src-addr selection will
127 * not consider this address.
129 struct timeval start_time; /* time when this address was created */
132 struct sctp_block_entry {
136 struct sctp_timewait {
137 uint32_t tv_sec_at_expire; /* the seconds from boot to expire */
138 uint32_t v_tag; /* the vtag that can not be reused */
139 uint16_t lport; /* the local port used in vtag */
140 uint16_t rport; /* the remote port used in vtag */
143 struct sctp_tagblock {
144 LIST_ENTRY(sctp_tagblock) sctp_nxt_tagblock;
145 struct sctp_timewait vtag_block[SCTP_NUMBER_IN_VTAG_BLOCK];
150 #if defined(__FreeBSD__)
152 struct socket *udp4_tun_socket;
155 struct socket *udp6_tun_socket;
158 struct sctpasochead *sctp_asochash;
161 struct sctppcbhead *sctp_ephash;
165 * The TCP model represents a substantial overhead in that we get an
166 * additional hash table to keep explicit connections in. The
167 * listening TCP endpoint will exist in the usual ephash above and
168 * accept only INIT's. It will be incapable of sending off an INIT.
169 * When a dg arrives we must look in the normal ephash. If we find a
170 * TCP endpoint that will tell us to go to the specific endpoint
171 * hash and re-hash to find the right assoc/socket. If we find a UDP
172 * model socket we then must complete the lookup. If this fails,
173 * i.e. no association can be found then we must continue to see if
174 * a sctp_peeloff()'d socket is in the tcpephash (a spun off socket
175 * acts like a TCP model connected socket).
177 struct sctppcbhead *sctp_tcpephash;
179 uint32_t hashtblsize;
181 struct sctp_vrflist *sctp_vrfhash;
184 struct sctp_ifnlist *vrf_ifn_hash;
185 u_long vrf_ifn_hashmark;
187 struct sctppcbhead listhead;
188 struct sctpladdr addr_wq;
190 #if defined(__APPLE__)
191 struct inpcbhead inplisthead;
192 struct inpcbinfo sctbinfo;
195 sctp_zone_t ipi_zone_ep;
196 sctp_zone_t ipi_zone_asoc;
197 sctp_zone_t ipi_zone_laddr;
198 sctp_zone_t ipi_zone_net;
199 sctp_zone_t ipi_zone_chunk;
200 sctp_zone_t ipi_zone_readq;
201 sctp_zone_t ipi_zone_strmoq;
202 sctp_zone_t ipi_zone_asconf;
203 sctp_zone_t ipi_zone_asconf_ack;
205 #if defined(__FreeBSD__) && __FreeBSD_version >= 503000
206 #if __FreeBSD_version <= 602000
207 struct mtx ipi_ep_mtx;
209 struct rwlock ipi_ep_mtx;
211 struct mtx ipi_iterator_wq_mtx;
212 #if __FreeBSD_version <= 602000
213 struct mtx ipi_addr_mtx;
215 struct rwlock ipi_addr_mtx;
217 struct mtx ipi_pktlog_mtx;
218 struct mtx wq_addr_mtx;
219 #elif defined(SCTP_PROCESS_LEVEL_LOCKS)
220 userland_mutex_t ipi_ep_mtx;
221 userland_mutex_t ipi_addr_mtx;
222 userland_mutex_t ipi_count_mtx;
223 userland_mutex_t ipi_pktlog_mtx;
224 userland_mutex_t wq_addr_mtx;
225 #elif defined(__APPLE__)
226 #ifdef _KERN_LOCKS_H_
227 lck_mtx_t *ipi_addr_mtx;
228 lck_mtx_t *ipi_count_mtx;
229 lck_mtx_t *ipi_pktlog_mtx;
230 lck_mtx_t *logging_mtx;
231 lck_mtx_t *wq_addr_mtx;
235 #endif /* _KERN_LOCKS_H_ */
236 #elif defined(__Windows__)
237 struct rwlock ipi_ep_lock;
238 struct rwlock ipi_addr_lock;
239 struct spinlock ipi_pktlog_mtx;
240 struct rwlock wq_addr_mtx;
241 #elif defined(__Userspace__)
242 /* TODO decide on __Userspace__ locks */
244 uint32_t ipi_count_ep;
246 /* assoc/tcb zone info */
247 uint32_t ipi_count_asoc;
249 /* local addrlist zone info */
250 uint32_t ipi_count_laddr;
252 /* remote addrlist zone info */
253 uint32_t ipi_count_raddr;
255 /* chunk structure list for output */
256 uint32_t ipi_count_chunk;
258 /* socket queue zone info */
259 uint32_t ipi_count_readq;
261 /* socket queue zone info */
262 uint32_t ipi_count_strmoq;
265 uint32_t ipi_count_vrfs;
268 uint32_t ipi_count_ifns;
271 uint32_t ipi_count_ifas;
273 /* system wide number of free chunks hanging around */
274 uint32_t ipi_free_chunks;
275 uint32_t ipi_free_strmoq;
277 struct sctpvtaghead vtag_timewait[SCTP_STACK_VTAG_HASH_SIZE];
279 /* address work queue handling */
280 struct sctp_timer addr_wq_timer;
282 #if defined(_SCTP_NEEDS_CALLOUT_) || defined(_USER_SCTP_NEEDS_CALLOUT_)
283 struct calloutlist callqueue;
288 struct sctp_base_info {
289 /* All static structures that
290 * anchor the system must be here.
292 struct sctp_epinfo sctppcbinfo;
293 #if defined(__FreeBSD__) && defined(SMP) && defined(SCTP_USE_PERCPU_STAT)
294 struct sctpstat *sctpstat;
296 struct sctpstat sctpstat;
298 struct sctp_sysctl sctpsysctl;
300 char sctp_pcb_initialized;
301 #if defined(SCTP_PACKET_LOGGING)
302 int packet_log_writers;
304 uint8_t packet_log_buffer[SCTP_PACKET_LOG_SIZE];
306 #if defined(__APPLE__)
307 int sctp_main_timer_ticks;
309 #if defined(__Userspace__)
310 userland_mutex_t timer_mtx;
311 userland_thread_t timer_thread;
312 uint8_t timer_thread_should_exit;
313 #if !defined(__Userspace_os_Windows)
314 #if defined(INET) || defined(INET6)
316 userland_thread_t recvthreadroute;
320 int userspace_rawsctp;
321 int userspace_udpsctp;
322 userland_thread_t recvthreadraw;
323 userland_thread_t recvthreadudp;
326 int userspace_rawsctp6;
327 int userspace_udpsctp6;
328 userland_thread_t recvthreadraw6;
329 userland_thread_t recvthreadudp6;
331 int (*conn_output)(void *addr, void *buffer, size_t length, uint8_t tos, uint8_t set_df);
332 void (*debug_printf)(const char *format, ...);
337 * Here we have all the relevant information for each SCTP entity created. We
338 * will need to modify this as approprate. We also need to figure out how to
339 * access /dev/random.
342 unsigned int time_of_secret_change; /* number of seconds from
344 uint32_t secret_key[SCTP_HOW_MANY_SECRETS][SCTP_NUMBER_OF_SECRETS];
345 unsigned int size_of_a_cookie;
347 unsigned int sctp_timeoutticks[SCTP_NUM_TMRS];
348 unsigned int sctp_minrto;
349 unsigned int sctp_maxrto;
350 unsigned int initial_rto;
351 int initial_init_rto_max;
353 unsigned int sctp_sack_freq;
354 uint32_t sctp_sws_sender;
355 uint32_t sctp_sws_receiver;
357 uint32_t sctp_default_cc_module;
358 uint32_t sctp_default_ss_module;
359 /* authentication related fields */
360 struct sctp_keyhead shared_keys;
361 sctp_auth_chklist_t *local_auth_chunks;
362 sctp_hmaclist_t *local_hmacs;
363 uint16_t default_keyid;
365 /* various thresholds */
366 /* Max times I will init at a guy */
367 uint16_t max_init_times;
369 /* Max times I will send before we consider someone dead */
370 uint16_t max_send_times;
372 uint16_t def_net_failure;
374 uint16_t def_net_pf_threshold;
376 /* number of streams to pre-open on a association */
377 uint16_t pre_open_stream_count;
378 uint16_t max_open_streams_intome;
380 /* random number generator */
381 uint32_t random_counter;
382 uint8_t random_numbers[SCTP_SIGNATURE_ALOC_SIZE];
383 uint8_t random_store[SCTP_SIGNATURE_ALOC_SIZE];
386 * This timer is kept running per endpoint. When it fires it will
387 * change the secret key. The default is once a hour
389 struct sctp_timer signature_change;
391 /* Zero copy full buffer timer */
392 struct sctp_timer zero_copy_timer;
393 /* Zero copy app to transport (sendq) read repulse timer */
394 struct sctp_timer zero_copy_sendq_timer;
395 uint32_t def_cookie_life;
398 uint32_t initial_sequence_debug;
399 uint32_t adaptation_layer_indicator;
400 uint8_t adaptation_layer_indicator_provided;
403 uint32_t fr_max_burst;
405 uint32_t default_flowlabel;
407 uint8_t default_dscp;
408 char current_secret_number;
409 char last_secret_number;
410 uint16_t port; /* remote UDP encapsulation port */
413 #ifndef SCTP_ALIGNMENT
414 #define SCTP_ALIGNMENT 32
418 #define SCTP_ALIGNM1 (SCTP_ALIGNMENT-1)
421 #define sctp_lport ip_inp.inp.inp_lport
423 struct sctp_pcbtsn_rlog {
430 #define SCTP_READ_LOG_SIZE 135 /* we choose the number to make a pcb a page */
435 * put an inpcb in front of it all, kind of a waste but we need to
436 * for compatability with all the other stuff.
440 char align[(sizeof(struct in6pcb) + SCTP_ALIGNM1) &
444 #if defined(__APPLE__)
445 /* leave some space in case i386 inpcb is bigger than ppc */
446 uint8_t padding[128];
449 /* Socket buffer lock protects read_queue and of course sb_cc */
450 struct sctp_readhead read_queue;
452 LIST_ENTRY(sctp_inpcb) sctp_list; /* lists all endpoints */
453 /* hash of all endpoints for model */
454 LIST_ENTRY(sctp_inpcb) sctp_hash;
455 /* count of local addresses bound, 0 if bound all */
458 /* list of addrs in use by the EP, NULL if bound-all */
459 struct sctpladdr sctp_addr_list;
460 /* used for source address selection rotation when we are subset bound */
461 struct sctp_laddr *next_addr_touse;
463 /* back pointer to our socket */
464 struct socket *sctp_socket;
465 uint64_t sctp_features; /* Feature flags */
466 uint32_t sctp_flags; /* INP state flag set */
467 uint32_t sctp_mobility_features; /* Mobility Feature flags */
468 struct sctp_pcb sctp_ep;/* SCTP ep data */
469 /* head of the hash of all associations */
470 struct sctpasochead *sctp_tcbhash;
471 u_long sctp_hashmark;
472 /* head of the list of all associations */
473 struct sctpasochead sctp_asoc_list;
474 #ifdef SCTP_TRACK_FREED_ASOCS
475 struct sctpasochead sctp_asoc_free_list;
477 struct sctp_iterator *inp_starting_point_for_iterator;
478 uint32_t sctp_frag_point;
479 uint32_t partial_delivery_point;
480 uint32_t sctp_context;
481 uint8_t local_strreset_support;
482 uint32_t sctp_cmt_on_off;
483 uint8_t ecn_supported;
484 uint8_t prsctp_supported;
485 uint8_t auth_supported;
486 uint8_t asconf_supported;
487 uint8_t reconfig_supported;
488 uint8_t nrsack_supported;
489 uint8_t pktdrop_supported;
490 struct sctp_nonpad_sndrcvinfo def_send;
492 * These three are here for the sosend_dgram
493 * (pkt, pkt_last and control).
494 * routine. However, I don't think anyone in
495 * the current FreeBSD kernel calls this. So
496 * they are candidates with sctp_sendm for
500 pakhandle_type pak_to_read;
501 pakhandle_type pak_to_read_sendq;
503 struct mbuf *pkt, *pkt_last;
504 struct mbuf *control;
505 #if !(defined(__FreeBSD__) || defined(__APPLE__) || defined(__Windows__) || defined(__Userspace__))
513 /* TODO __Userspace__ where is our inp_vlag going to be? */
515 uint8_t inp_ip_tos; /* defined as macro in user_inpcb.h */
518 #if defined(__FreeBSD__) && __FreeBSD_version >= 503000
520 struct mtx inp_create_mtx;
521 struct mtx inp_rdata_mtx;
523 #elif defined(SCTP_PROCESS_LEVEL_LOCKS)
524 userland_mutex_t inp_mtx;
525 userland_mutex_t inp_create_mtx;
526 userland_mutex_t inp_rdata_mtx;
528 #elif defined(__APPLE__)
529 #if defined(SCTP_APPLE_RWLOCK)
534 lck_mtx_t *inp_create_mtx;
535 lck_mtx_t *inp_rdata_mtx;
536 #elif defined(__Windows__)
537 struct rwlock inp_lock;
538 struct spinlock inp_create_lock;
539 struct spinlock inp_rdata_lock;
541 #elif defined(__Userspace__)
542 /* TODO decide on __Userspace__ locks */
545 #if defined(__APPLE__)
548 uint32_t lock_caller1;
549 uint32_t lock_caller2;
550 uint32_t lock_caller3;
551 uint32_t unlock_caller1;
552 uint32_t unlock_caller2;
553 uint32_t unlock_caller3;
554 uint32_t getlock_caller1;
555 uint32_t getlock_caller2;
556 uint32_t getlock_caller3;
558 uint32_t lock_gen_count;
559 uint32_t unlock_gen_count;
560 uint32_t getlock_gen_count;
562 uint32_t i_am_here_file;
563 uint32_t i_am_here_line;
571 uint32_t total_sends;
572 uint32_t total_recvs;
573 uint32_t last_abort_code;
574 uint32_t total_nospaces;
575 struct sctpasochead *sctp_asocidhash;
576 u_long hashasocidmark;
577 uint32_t sctp_associd_counter;
579 #ifdef SCTP_ASOCLOG_OF_TSNS
580 struct sctp_pcbtsn_rlog readlog[SCTP_READ_LOG_SIZE];
581 uint32_t readlog_index;
583 #if defined(__Userspace__)
585 int (*recv_callback)(struct socket *, union sctp_sockstore, void *, size_t,
586 struct sctp_rcvinfo, int, void *);
587 uint32_t send_sb_threshold;
588 int (*send_callback)(struct socket *, uint32_t);
592 #if defined(__Userspace__)
593 int register_recv_cb (struct socket *,
594 int (*)(struct socket *, union sctp_sockstore, void *, size_t,
595 struct sctp_rcvinfo, int, void *));
596 int register_send_cb (struct socket *, uint32_t, int (*)(struct socket *, uint32_t));
597 int register_ulp_info (struct socket *, void *);
601 struct socket *sctp_socket; /* back pointer to socket */
602 struct sctp_inpcb *sctp_ep; /* back pointer to ep */
603 LIST_ENTRY(sctp_tcb) sctp_tcbhash; /* next link in hash
605 LIST_ENTRY(sctp_tcb) sctp_tcblist; /* list of all of the
607 LIST_ENTRY(sctp_tcb) sctp_tcbasocidhash; /* next link in asocid
610 LIST_ENTRY(sctp_tcb) sctp_asocs; /* vtag hash list */
611 struct sctp_block_entry *block_entry; /* pointer locked by socket
613 struct sctp_association asoc;
615 * freed_by_sorcv_sincelast is protected by the sockbuf_lock NOT the
616 * tcb_lock. Its special in this way to help avoid extra mutex calls
617 * in the reading of data.
619 uint32_t freed_by_sorcv_sincelast;
620 uint32_t total_sends;
621 uint32_t total_recvs;
622 int freed_from_where;
623 uint16_t rport; /* remote port in network format */
625 #if defined(__FreeBSD__) && __FreeBSD_version >= 503000
627 struct mtx tcb_send_mtx;
628 #elif defined(SCTP_PROCESS_LEVEL_LOCKS)
629 userland_mutex_t tcb_mtx;
630 userland_mutex_t tcb_send_mtx;
631 #elif defined(__APPLE__)
633 lck_mtx_t* tcb_send_mtx;
634 #elif defined(__Windows__)
635 struct spinlock tcb_lock;
636 struct spinlock tcb_send_lock;
637 #elif defined(__Userspace__)
638 /* TODO decide on __Userspace__ locks */
640 #if defined(__APPLE__)
648 #if defined(__FreeBSD__) && __FreeBSD_version >= 503000
650 #include <netinet/sctp_lock_bsd.h>
652 #elif defined(__APPLE__)
654 * Apple MacOS X 10.4 "Tiger"
657 #include <netinet/sctp_lock_apple_fg.h>
659 #elif defined(SCTP_PROCESS_LEVEL_LOCKS)
661 #include <netinet/sctp_process_lock.h>
663 #elif defined(__Windows__)
665 #include <netinet/sctp_lock_windows.h>
667 #elif defined(__Userspace__)
669 #include <netinet/sctp_lock_userspace.h>
673 * Pre-5.x FreeBSD, and others.
675 #include <netinet/sctp_lock_empty.h>
678 /* TODO where to put non-_KERNEL things for __Userspace__? */
679 #if defined(_KERNEL) || defined(__Userspace__)
681 /* Attention Julian, this is the extern that
682 * goes with the base info. sctp_pcb.c has
683 * the real definition.
685 #if defined(__FreeBSD__) && __FreeBSD_version >= 801000
686 VNET_DECLARE(struct sctp_base_info, system_base_info) ;
688 extern struct sctp_base_info system_base_info;
692 int SCTP6_ARE_ADDR_EQUAL(struct sockaddr_in6 *a, struct sockaddr_in6 *b);
695 void sctp_fill_pcbinfo(struct sctp_pcbinfo *);
698 sctp_find_ifn(void *ifn, uint32_t ifn_index);
700 struct sctp_vrf *sctp_allocate_vrf(int vrfid);
701 struct sctp_vrf *sctp_find_vrf(uint32_t vrfid);
702 void sctp_free_vrf(struct sctp_vrf *vrf);
705 * Change address state, can be used if
706 * O/S supports telling transports about
707 * changes to IFA/IFN's (link layer triggers).
708 * If a ifn goes down, we will do src-addr-selection
709 * and NOT use that, as a source address. This does
710 * not stop the routing system from routing out
711 * that interface, but we won't put it as a source.
713 void sctp_mark_ifa_addr_down(uint32_t vrf_id, struct sockaddr *addr, const char *if_name, uint32_t ifn_index);
714 void sctp_mark_ifa_addr_up(uint32_t vrf_id, struct sockaddr *addr, const char *if_name, uint32_t ifn_index);
717 sctp_add_addr_to_vrf(uint32_t vrfid,
718 void *ifn, uint32_t ifn_index, uint32_t ifn_type,
720 void *ifa, struct sockaddr *addr, uint32_t ifa_flags,
723 void sctp_update_ifn_mtu(uint32_t ifn_index, uint32_t mtu);
725 void sctp_free_ifn(struct sctp_ifn *sctp_ifnp);
726 void sctp_free_ifa(struct sctp_ifa *sctp_ifap);
729 void sctp_del_addr_from_vrf(uint32_t vrfid, struct sockaddr *addr,
730 uint32_t ifn_index, const char *if_name);
734 struct sctp_nets *sctp_findnet(struct sctp_tcb *, struct sockaddr *);
736 struct sctp_inpcb *sctp_pcb_findep(struct sockaddr *, int, int, uint32_t);
738 #if defined(__FreeBSD__) && __FreeBSD_version >= 500000
739 int sctp_inpcb_bind(struct socket *, struct sockaddr *,
740 struct sctp_ifa *,struct thread *);
741 #elif defined(__Windows__)
742 int sctp_inpcb_bind(struct socket *, struct sockaddr *,
743 struct sctp_ifa *,PKTHREAD);
745 /* struct proc is a dummy for __Userspace__ */
746 int sctp_inpcb_bind(struct socket *, struct sockaddr *,
747 struct sctp_ifa *, struct proc *);
751 sctp_findassociation_addr(struct mbuf *, int,
752 struct sockaddr *, struct sockaddr *,
753 struct sctphdr *, struct sctp_chunkhdr *, struct sctp_inpcb **,
754 struct sctp_nets **, uint32_t vrf_id);
757 sctp_findassociation_addr_sa(struct sockaddr *,
758 struct sockaddr *, struct sctp_inpcb **, struct sctp_nets **, int, uint32_t);
761 sctp_move_pcb_and_assoc(struct sctp_inpcb *, struct sctp_inpcb *,
765 * For this call ep_addr, the to is the destination endpoint address of the
766 * peer (relative to outbound). The from field is only used if the TCP model
767 * is enabled and helps distingush amongst the subset bound (non-boundall).
768 * The TCP model MAY change the actual ep field, this is why it is passed.
771 sctp_findassociation_ep_addr(struct sctp_inpcb **,
772 struct sockaddr *, struct sctp_nets **, struct sockaddr *,
776 sctp_findasoc_ep_asocid_locked(struct sctp_inpcb *inp, sctp_assoc_t asoc_id, int want_lock);
779 sctp_findassociation_ep_asocid(struct sctp_inpcb *,
783 sctp_findassociation_ep_asconf(struct mbuf *, int, struct sockaddr *,
784 struct sctphdr *, struct sctp_inpcb **, struct sctp_nets **, uint32_t vrf_id);
786 int sctp_inpcb_alloc(struct socket *so, uint32_t vrf_id);
788 int sctp_is_address_on_local_host(struct sockaddr *addr, uint32_t vrf_id);
790 void sctp_inpcb_free(struct sctp_inpcb *, int, int);
792 #if defined(__FreeBSD__) && __FreeBSD_version >= 500000
794 sctp_aloc_assoc(struct sctp_inpcb *, struct sockaddr *,
795 int *, uint32_t, uint32_t, struct thread *);
796 #elif defined(__Windows__)
798 sctp_aloc_assoc(struct sctp_inpcb *, struct sockaddr *,
799 int *, uint32_t, uint32_t, PKTHREAD);
801 /* proc will be NULL for __Userspace__ */
803 sctp_aloc_assoc(struct sctp_inpcb *, struct sockaddr *,
804 int *, uint32_t, uint32_t, struct proc *);
807 int sctp_free_assoc(struct sctp_inpcb *, struct sctp_tcb *, int, int);
810 void sctp_delete_from_timewait(uint32_t, uint16_t, uint16_t);
812 int sctp_is_in_timewait(uint32_t tag, uint16_t lport, uint16_t rport);
815 sctp_add_vtag_to_timewait(uint32_t tag, uint32_t time, uint16_t lport, uint16_t rport);
817 void sctp_add_local_addr_ep(struct sctp_inpcb *, struct sctp_ifa *, uint32_t);
819 int sctp_insert_laddr(struct sctpladdr *, struct sctp_ifa *, uint32_t);
821 void sctp_remove_laddr(struct sctp_laddr *);
823 void sctp_del_local_addr_ep(struct sctp_inpcb *, struct sctp_ifa *);
825 int sctp_add_remote_addr(struct sctp_tcb *, struct sockaddr *, struct sctp_nets **, int, int);
827 void sctp_remove_net(struct sctp_tcb *, struct sctp_nets *);
829 int sctp_del_remote_addr(struct sctp_tcb *, struct sockaddr *);
831 void sctp_pcb_init(void);
833 void sctp_pcb_finish(void);
835 void sctp_add_local_addr_restricted(struct sctp_tcb *, struct sctp_ifa *);
836 void sctp_del_local_addr_restricted(struct sctp_tcb *, struct sctp_ifa *);
839 sctp_load_addresses_from_init(struct sctp_tcb *, struct mbuf *, int, int,
840 struct sockaddr *, struct sockaddr *, struct sockaddr *);
843 sctp_set_primary_addr(struct sctp_tcb *, struct sockaddr *,
846 int sctp_is_vtag_good(uint32_t, uint16_t lport, uint16_t rport, struct timeval *);
848 /* void sctp_drain(void); */
850 int sctp_destination_is_reachable(struct sctp_tcb *, struct sockaddr *);
852 int sctp_swap_inpcb_for_listen(struct sctp_inpcb *inp);
855 * Null in last arg inpcb indicate run on ALL ep's. Specific inp in last arg
856 * indicates run on ONLY assoc's of the specified endpoint.
859 sctp_initiate_iterator(inp_func inpf,
868 #if defined(__FreeBSD__) && defined(SCTP_MCORE_INPUT) && defined(SMP)
870 sctp_queue_to_mcore(struct mbuf *m, int off, int cpu_to_use);
876 sctp_validate_no_locks(struct sctp_inpcb *inp);
880 #endif /* !__sctp_pcb_h__ */