sctp_pcb.h revision 205629
1194612Sed/*- 2194612Sed * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved. 3194612Sed * 4194612Sed * Redistribution and use in source and binary forms, with or without 5194612Sed * modification, are permitted provided that the following conditions are met: 6194612Sed * 7194612Sed * a) Redistributions of source code must retain the above copyright notice, 8194612Sed * this list of conditions and the following disclaimer. 9194612Sed * 10194612Sed * b) Redistributions in binary form must reproduce the above copyright 11194612Sed * notice, this list of conditions and the following disclaimer in 12194612Sed * the documentation and/or other materials provided with the distribution. 13194612Sed * 14194612Sed * c) Neither the name of Cisco Systems, Inc. nor the names of its 15194612Sed * contributors may be used to endorse or promote products derived 16218893Sdim * from this software without specific prior written permission. 17194612Sed * 18194612Sed * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19218893Sdim * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20194612Sed * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21218893Sdim * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22194612Sed * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23194612Sed * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24198090Srdivacky * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25198090Srdivacky * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26198090Srdivacky * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27198090Srdivacky * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 28198090Srdivacky * THE POSSIBILITY OF SUCH DAMAGE. 29198090Srdivacky */ 30198090Srdivacky 31198090Srdivacky/* $KAME: sctp_pcb.h,v 1.21 2005/07/16 01:18:47 suz Exp $ */ 32198090Srdivacky 33198090Srdivacky#include <sys/cdefs.h> 34198090Srdivacky__FBSDID("$FreeBSD: head/sys/netinet/sctp_pcb.h 205629 2010-03-24 20:02:40Z rrs $"); 35198090Srdivacky 36198090Srdivacky#ifndef __sctp_pcb_h__ 37194612Sed#define __sctp_pcb_h__ 38198090Srdivacky 39198090Srdivacky#include <netinet/sctp_os.h> 40198090Srdivacky#include <netinet/sctp.h> 41203954Srdivacky#include <netinet/sctp_constants.h> 42194612Sed#include <netinet/sctp_sysctl.h> 43194612Sed 44194612SedLIST_HEAD(sctppcbhead, sctp_inpcb); 45194612SedLIST_HEAD(sctpasochead, sctp_tcb); 46194612SedLIST_HEAD(sctpladdr, sctp_laddr); 47194612SedLIST_HEAD(sctpvtaghead, sctp_tagblock); 48194612SedLIST_HEAD(sctp_vrflist, sctp_vrf); 49194612SedLIST_HEAD(sctp_ifnlist, sctp_ifn); 50194612SedLIST_HEAD(sctp_ifalist, sctp_ifa); 51194612SedTAILQ_HEAD(sctp_readhead, sctp_queued_to_read); 52223017SdimTAILQ_HEAD(sctp_streamhead, sctp_stream_queue_pending); 53223017Sdim 54218893Sdim#include <netinet/sctp_structs.h> 55223017Sdim#include <netinet/sctp_auth.h> 56223017Sdim 57203954Srdivacky#define SCTP_PCBHASH_ALLADDR(port, mask) (port & mask) 58194612Sed#define SCTP_PCBHASH_ASOC(tag, mask) (tag & mask) 59194612Sed 60223017Sdimstruct sctp_vrf { 61223017Sdim LIST_ENTRY(sctp_vrf) next_vrf; 62194612Sed struct sctp_ifalist *vrf_addr_hash; 63203954Srdivacky struct sctp_ifnlist ifnlist; 64194612Sed uint32_t vrf_id; 65194612Sed uint32_t tbl_id_v4; /* default v4 table id */ 66218893Sdim uint32_t tbl_id_v6; /* default v6 table id */ 67194612Sed uint32_t total_ifa_count; 68194612Sed u_long vrf_addr_hashmark; 69194612Sed uint32_t refcount; 70194612Sed}; 71194612Sed 72194612Sedstruct sctp_ifn { 73194612Sed struct sctp_ifalist ifalist; 74194612Sed struct sctp_vrf *vrf; 75194612Sed LIST_ENTRY(sctp_ifn) next_ifn; 76194612Sed LIST_ENTRY(sctp_ifn) next_bucket; 77194612Sed void *ifn_p; /* never access without appropriate lock */ 78194612Sed uint32_t ifn_mtu; 79194612Sed uint32_t ifn_type; 80194612Sed uint32_t ifn_index; /* shorthand way to look at ifn for reference */ 81194612Sed uint32_t refcount; /* number of reference held should be >= 82194612Sed * ifa_count */ 83194612Sed uint32_t ifa_count; /* IFA's we hold (in our list - ifalist) */ 84194612Sed uint32_t num_v6; /* number of v6 addresses */ 85194612Sed uint32_t num_v4; /* number of v4 addresses */ 86194612Sed uint32_t registered_af; /* registered address family for i/f events */ 87203954Srdivacky char ifn_name[SCTP_IFNAMSIZ]; 88194612Sed}; 89203954Srdivacky 90194612Sed/* SCTP local IFA flags */ 91194612Sed#define SCTP_ADDR_VALID 0x00000001 /* its up and active */ 92194612Sed#define SCTP_BEING_DELETED 0x00000002 /* being deleted, when 93203954Srdivacky * refcount = 0. Note that it 94194612Sed * is pulled from the ifn list 95194612Sed * and ifa_p is nulled right 96198090Srdivacky * away but it cannot be freed 97198090Srdivacky * until the last *net 98198090Srdivacky * pointing to it is deleted. */ 99198090Srdivacky#define SCTP_ADDR_DEFER_USE 0x00000004 /* Hold off using this one */ 100203954Srdivacky#define SCTP_ADDR_IFA_UNUSEABLE 0x00000008 101198090Srdivacky 102198090Srdivackystruct sctp_ifa { 103198090Srdivacky LIST_ENTRY(sctp_ifa) next_ifa; 104198090Srdivacky LIST_ENTRY(sctp_ifa) next_bucket; 105198090Srdivacky struct sctp_ifn *ifn_p; /* back pointer to parent ifn */ 106198090Srdivacky void *ifa; /* pointer to ifa, needed for flag update for 107198090Srdivacky * that we MUST lock appropriate locks. This 108194612Sed * is for V6. */ 109194612Sed union sctp_sockstore address; 110203954Srdivacky uint32_t refcount; /* number of folks refering to this */ 111203954Srdivacky uint32_t flags; 112198090Srdivacky uint32_t localifa_flags; 113198090Srdivacky uint32_t vrf_id; /* vrf_id of this addr (for deleting) */ 114198090Srdivacky uint8_t src_is_loop; 115203954Srdivacky uint8_t src_is_priv; 116198090Srdivacky uint8_t src_is_glob; 117198090Srdivacky uint8_t resv; 118198090Srdivacky}; 119198090Srdivacky 120198090Srdivackystruct sctp_laddr { 121194612Sed LIST_ENTRY(sctp_laddr) sctp_nxt_addr; /* next in list */ 122194612Sed struct sctp_ifa *ifa; 123194612Sed uint32_t action; /* Used during asconf and adding if no-zero 124195340Sed * src-addr selection will not consider this 125194612Sed * address. */ 126203954Srdivacky struct timeval start_time; /* time when this address was created */ 127194612Sed}; 128194612Sed 129194612Sedstruct sctp_block_entry { 130195340Sed int error; 131203954Srdivacky}; 132195340Sed 133195340Sedstruct sctp_timewait { 134195340Sed uint32_t tv_sec_at_expire; /* the seconds from boot to expire */ 135194612Sed uint32_t v_tag; /* the vtag that can not be reused */ 136194612Sed uint16_t lport; /* the local port used in vtag */ 137194612Sed uint16_t rport; /* the remote port used in vtag */ 138195340Sed}; 139195340Sed 140195340Sedstruct sctp_tagblock { 141195340Sed LIST_ENTRY(sctp_tagblock) sctp_nxt_tagblock; 142195340Sed struct sctp_timewait vtag_block[SCTP_NUMBER_IN_VTAG_BLOCK]; 143218893Sdim}; 144199989Srdivacky 145203954Srdivacky 146194612Sedstruct sctp_epinfo { 147194612Sed struct socket *udp_tun_socket; 148194612Sed struct sctpasochead *sctp_asochash; 149194612Sed u_long hashasocmark; 150203954Srdivacky 151194612Sed struct sctppcbhead *sctp_ephash; 152199989Srdivacky u_long hashmark; 153194612Sed 154194612Sed /*- 155199989Srdivacky * The TCP model represents a substantial overhead in that we get an 156194612Sed * additional hash table to keep explicit connections in. The 157194612Sed * listening TCP endpoint will exist in the usual ephash above and 158199989Srdivacky * accept only INIT's. It will be incapable of sending off an INIT. 159199989Srdivacky * When a dg arrives we must look in the normal ephash. If we find a 160199989Srdivacky * TCP endpoint that will tell us to go to the specific endpoint 161199989Srdivacky * hash and re-hash to find the right assoc/socket. If we find a UDP 162199989Srdivacky * model socket we then must complete the lookup. If this fails, 163199989Srdivacky * i.e. no association can be found then we must continue to see if 164199989Srdivacky * a sctp_peeloff()'d socket is in the tcpephash (a spun off socket 165199989Srdivacky * acts like a TCP model connected socket). 166199989Srdivacky */ 167199989Srdivacky struct sctppcbhead *sctp_tcpephash; 168203954Srdivacky u_long hashtcpmark; 169195340Sed uint32_t hashtblsize; 170218893Sdim 171218893Sdim struct sctp_vrflist *sctp_vrfhash; 172218893Sdim u_long hashvrfmark; 173218893Sdim 174199989Srdivacky struct sctp_ifnlist *vrf_ifn_hash; 175207618Srdivacky u_long vrf_ifn_hashmark; 176206274Srdivacky 177218893Sdim struct sctppcbhead listhead; 178199989Srdivacky struct sctpladdr addr_wq; 179194612Sed 180195340Sed struct sctpiterators iteratorhead; 181218893Sdim int threads_must_exit; 182199989Srdivacky /* ep zone info */ 183206274Srdivacky sctp_zone_t ipi_zone_ep; 184206274Srdivacky sctp_zone_t ipi_zone_asoc; 185218893Sdim sctp_zone_t ipi_zone_laddr; 186206274Srdivacky sctp_zone_t ipi_zone_net; 187206274Srdivacky sctp_zone_t ipi_zone_chunk; 188218893Sdim sctp_zone_t ipi_zone_readq; 189195340Sed sctp_zone_t ipi_zone_strmoq; 190195340Sed sctp_zone_t ipi_zone_asconf; 191195340Sed sctp_zone_t ipi_zone_asconf_ack; 192195340Sed 193195340Sed struct rwlock ipi_ep_mtx; 194195340Sed struct mtx it_mtx; 195199989Srdivacky struct mtx ipi_iterator_wq_mtx; 196195340Sed struct rwlock ipi_addr_mtx; 197195340Sed struct mtx ipi_pktlog_mtx; 198195340Sed uint32_t ipi_count_ep; 199195340Sed 200195340Sed /* assoc/tcb zone info */ 201195340Sed uint32_t ipi_count_asoc; 202203954Srdivacky 203195340Sed /* local addrlist zone info */ 204195340Sed uint32_t ipi_count_laddr; 205195340Sed 206202878Srdivacky /* remote addrlist zone info */ 207202878Srdivacky uint32_t ipi_count_raddr; 208202878Srdivacky 209202878Srdivacky /* chunk structure list for output */ 210202878Srdivacky uint32_t ipi_count_chunk; 211203954Srdivacky 212202878Srdivacky /* socket queue zone info */ 213202878Srdivacky uint32_t ipi_count_readq; 214202878Srdivacky 215202878Srdivacky /* socket queue zone info */ 216202878Srdivacky uint32_t ipi_count_strmoq; 217202878Srdivacky 218195340Sed /* Number of vrfs */ 219203954Srdivacky uint32_t ipi_count_vrfs; 220202878Srdivacky 221199989Srdivacky /* Number of ifns */ 222199989Srdivacky uint32_t ipi_count_ifns; 223195340Sed 224203954Srdivacky /* Number of ifas */ 225195340Sed uint32_t ipi_count_ifas; 226195340Sed 227195340Sed /* system wide number of free chunks hanging around */ 228195340Sed uint32_t ipi_free_chunks; 229195340Sed uint32_t ipi_free_strmoq; 230195340Sed 231195340Sed 232195340Sed struct sctpvtaghead vtag_timewait[SCTP_STACK_VTAG_HASH_SIZE]; 233 234 /* address work queue handling */ 235#if defined(SCTP_USE_THREAD_BASED_ITERATOR) 236 uint32_t iterator_running; 237 SCTP_PROCESS_STRUCT thread_proc; 238#endif 239 struct sctp_timer addr_wq_timer; 240 241}; 242 243 244struct sctp_base_info { 245 /* 246 * All static structures that anchor the system must be here. 247 */ 248 struct sctp_epinfo sctppcbinfo; 249#if defined(__FreeBSD__) && defined(SMP) && defined(SCTP_USE_PERCPU_STAT) 250 struct sctpstat sctpstat[MAXCPU]; 251#else 252 struct sctpstat sctpstat; 253#endif 254 struct sctp_sysctl sctpsysctl; 255 uint8_t first_time; 256 char sctp_pcb_initialized; 257#if defined(SCTP_PACKET_LOGGING) 258 int packet_log_writers; 259 int packet_log_end; 260 uint8_t packet_log_buffer[SCTP_PACKET_LOG_SIZE]; 261#endif 262}; 263 264/*- 265 * Here we have all the relevant information for each SCTP entity created. We 266 * will need to modify this as approprate. We also need to figure out how to 267 * access /dev/random. 268 */ 269struct sctp_pcb { 270 unsigned int time_of_secret_change; /* number of seconds from 271 * timeval.tv_sec */ 272 uint32_t secret_key[SCTP_HOW_MANY_SECRETS][SCTP_NUMBER_OF_SECRETS]; 273 unsigned int size_of_a_cookie; 274 275 unsigned int sctp_timeoutticks[SCTP_NUM_TMRS]; 276 unsigned int sctp_minrto; 277 unsigned int sctp_maxrto; 278 unsigned int initial_rto; 279 int initial_init_rto_max; 280 281 unsigned int sctp_sack_freq; 282 uint32_t sctp_sws_sender; 283 uint32_t sctp_sws_receiver; 284 285 uint32_t sctp_default_cc_module; 286 /* authentication related fields */ 287 struct sctp_keyhead shared_keys; 288 sctp_auth_chklist_t *local_auth_chunks; 289 sctp_hmaclist_t *local_hmacs; 290 uint16_t default_keyid; 291 292 /* various thresholds */ 293 /* Max times I will init at a guy */ 294 uint16_t max_init_times; 295 296 /* Max times I will send before we consider someone dead */ 297 uint16_t max_send_times; 298 299 uint16_t def_net_failure; 300 301 /* number of streams to pre-open on a association */ 302 uint16_t pre_open_stream_count; 303 uint16_t max_open_streams_intome; 304 305 /* random number generator */ 306 uint32_t random_counter; 307 uint8_t random_numbers[SCTP_SIGNATURE_ALOC_SIZE]; 308 uint8_t random_store[SCTP_SIGNATURE_ALOC_SIZE]; 309 310 /* 311 * This timer is kept running per endpoint. When it fires it will 312 * change the secret key. The default is once a hour 313 */ 314 struct sctp_timer signature_change; 315 316 /* Zero copy full buffer timer */ 317 struct sctp_timer zero_copy_timer; 318 /* Zero copy app to transport (sendq) read repulse timer */ 319 struct sctp_timer zero_copy_sendq_timer; 320 uint32_t def_cookie_life; 321 /* defaults to 0 */ 322 int auto_close_time; 323 uint32_t initial_sequence_debug; 324 uint32_t adaptation_layer_indicator; 325 uint32_t store_at; 326 uint8_t max_burst; 327 char current_secret_number; 328 char last_secret_number; 329}; 330 331#ifndef SCTP_ALIGNMENT 332#define SCTP_ALIGNMENT 32 333#endif 334 335#ifndef SCTP_ALIGNM1 336#define SCTP_ALIGNM1 (SCTP_ALIGNMENT-1) 337#endif 338 339#define sctp_lport ip_inp.inp.inp_lport 340 341struct sctp_pcbtsn_rlog { 342 uint32_t vtag; 343 uint16_t strm; 344 uint16_t seq; 345 uint16_t sz; 346 uint16_t flgs; 347}; 348 349#define SCTP_READ_LOG_SIZE 135 /* we choose the number to make a pcb a page */ 350 351 352struct sctp_inpcb { 353 /*- 354 * put an inpcb in front of it all, kind of a waste but we need to 355 * for compatability with all the other stuff. 356 */ 357 union { 358 struct inpcb inp; 359 char align[(sizeof(struct in6pcb) + SCTP_ALIGNM1) & 360 ~SCTP_ALIGNM1]; 361 } ip_inp; 362 363 364 /* Socket buffer lock protects read_queue and of course sb_cc */ 365 struct sctp_readhead read_queue; 366 367 LIST_ENTRY(sctp_inpcb) sctp_list; /* lists all endpoints */ 368 /* hash of all endpoints for model */ 369 LIST_ENTRY(sctp_inpcb) sctp_hash; 370 /* count of local addresses bound, 0 if bound all */ 371 int laddr_count; 372 373 /* list of addrs in use by the EP, NULL if bound-all */ 374 struct sctpladdr sctp_addr_list; 375 /* 376 * used for source address selection rotation when we are subset 377 * bound 378 */ 379 struct sctp_laddr *next_addr_touse; 380 381 /* back pointer to our socket */ 382 struct socket *sctp_socket; 383 uint32_t sctp_flags; /* INP state flag set */ 384 uint32_t sctp_features; /* Feature flags */ 385 uint32_t sctp_mobility_features; /* Mobility Feature flags */ 386 struct sctp_pcb sctp_ep;/* SCTP ep data */ 387 /* head of the hash of all associations */ 388 struct sctpasochead *sctp_tcbhash; 389 u_long sctp_hashmark; 390 /* head of the list of all associations */ 391 struct sctpasochead sctp_asoc_list; 392#ifdef SCTP_TRACK_FREED_ASOCS 393 struct sctpasochead sctp_asoc_free_list; 394#endif 395 struct sctp_iterator *inp_starting_point_for_iterator; 396 uint32_t sctp_frag_point; 397 uint32_t partial_delivery_point; 398 uint32_t sctp_context; 399 struct sctp_nonpad_sndrcvinfo def_send; 400 /*- 401 * These three are here for the sosend_dgram 402 * (pkt, pkt_last and control). 403 * routine. However, I don't think anyone in 404 * the current FreeBSD kernel calls this. So 405 * they are candidates with sctp_sendm for 406 * de-supporting. 407 */ 408 struct mbuf *pkt, *pkt_last; 409 struct mbuf *control; 410 struct mtx inp_mtx; 411 struct mtx inp_create_mtx; 412 struct mtx inp_rdata_mtx; 413 int32_t refcount; 414 uint32_t def_vrf_id; 415 uint32_t total_sends; 416 uint32_t total_recvs; 417 uint32_t last_abort_code; 418 uint32_t total_nospaces; 419 struct sctpasochead *sctp_asocidhash; 420 u_long hashasocidmark; 421 uint32_t sctp_associd_counter; 422 423#ifdef SCTP_ASOCLOG_OF_TSNS 424 struct sctp_pcbtsn_rlog readlog[SCTP_READ_LOG_SIZE]; 425 uint32_t readlog_index; 426#endif 427}; 428 429struct sctp_tcb { 430 struct socket *sctp_socket; /* back pointer to socket */ 431 struct sctp_inpcb *sctp_ep; /* back pointer to ep */ 432 LIST_ENTRY(sctp_tcb) sctp_tcbhash; /* next link in hash 433 * table */ 434 LIST_ENTRY(sctp_tcb) sctp_tcblist; /* list of all of the 435 * TCB's */ 436 LIST_ENTRY(sctp_tcb) sctp_tcbasocidhash; /* next link in asocid 437 * hash table */ 438 LIST_ENTRY(sctp_tcb) sctp_asocs; /* vtag hash list */ 439 struct sctp_block_entry *block_entry; /* pointer locked by socket 440 * send buffer */ 441 struct sctp_association asoc; 442 /*- 443 * freed_by_sorcv_sincelast is protected by the sockbuf_lock NOT the 444 * tcb_lock. Its special in this way to help avoid extra mutex calls 445 * in the reading of data. 446 */ 447 uint32_t freed_by_sorcv_sincelast; 448 uint32_t total_sends; 449 uint32_t total_recvs; 450 int freed_from_where; 451 uint16_t rport; /* remote port in network format */ 452 uint16_t resv; 453 struct mtx tcb_mtx; 454 struct mtx tcb_send_mtx; 455}; 456 457 458 459#include <netinet/sctp_lock_bsd.h> 460 461 462/* TODO where to put non-_KERNEL things for __Userspace__? */ 463#if defined(_KERNEL) || defined(__Userspace__) 464 465/* Attention Julian, this is the extern that 466 * goes with the base info. sctp_pcb.c has 467 * the real definition. 468 */ 469VNET_DECLARE(struct sctp_base_info, system_base_info); 470 471#ifdef INET6 472int SCTP6_ARE_ADDR_EQUAL(struct sockaddr_in6 *a, struct sockaddr_in6 *b); 473 474#endif 475 476void sctp_fill_pcbinfo(struct sctp_pcbinfo *); 477 478struct sctp_ifn * 479 sctp_find_ifn(void *ifn, uint32_t ifn_index); 480 481struct sctp_vrf *sctp_allocate_vrf(int vrfid); 482struct sctp_vrf *sctp_find_vrf(uint32_t vrfid); 483void sctp_free_vrf(struct sctp_vrf *vrf); 484 485/*- 486 * Change address state, can be used if 487 * O/S supports telling transports about 488 * changes to IFA/IFN's (link layer triggers). 489 * If a ifn goes down, we will do src-addr-selection 490 * and NOT use that, as a source address. This does 491 * not stop the routing system from routing out 492 * that interface, but we won't put it as a source. 493 */ 494void sctp_mark_ifa_addr_down(uint32_t vrf_id, struct sockaddr *addr, const char *if_name, uint32_t ifn_index); 495void sctp_mark_ifa_addr_up(uint32_t vrf_id, struct sockaddr *addr, const char *if_name, uint32_t ifn_index); 496 497struct sctp_ifa * 498sctp_add_addr_to_vrf(uint32_t vrfid, 499 void *ifn, uint32_t ifn_index, uint32_t ifn_type, 500 const char *if_name, 501 void *ifa, struct sockaddr *addr, uint32_t ifa_flags, 502 int dynamic_add); 503 504void sctp_update_ifn_mtu(uint32_t ifn_index, uint32_t mtu); 505 506void sctp_free_ifn(struct sctp_ifn *sctp_ifnp); 507void sctp_free_ifa(struct sctp_ifa *sctp_ifap); 508 509 510void 511sctp_del_addr_from_vrf(uint32_t vrfid, struct sockaddr *addr, 512 uint32_t ifn_index, const char *if_name); 513 514 515 516struct sctp_nets *sctp_findnet(struct sctp_tcb *, struct sockaddr *); 517 518struct sctp_inpcb *sctp_pcb_findep(struct sockaddr *, int, int, uint32_t); 519 520int 521sctp_inpcb_bind(struct socket *, struct sockaddr *, 522 struct sctp_ifa *, struct thread *); 523 524struct sctp_tcb * 525sctp_findassociation_addr(struct mbuf *, int, int, 526 struct sctphdr *, struct sctp_chunkhdr *, struct sctp_inpcb **, 527 struct sctp_nets **, uint32_t vrf_id); 528 529struct sctp_tcb * 530sctp_findassociation_addr_sa(struct sockaddr *, 531 struct sockaddr *, struct sctp_inpcb **, struct sctp_nets **, int, uint32_t); 532 533void 534sctp_move_pcb_and_assoc(struct sctp_inpcb *, struct sctp_inpcb *, 535 struct sctp_tcb *); 536 537/*- 538 * For this call ep_addr, the to is the destination endpoint address of the 539 * peer (relative to outbound). The from field is only used if the TCP model 540 * is enabled and helps distingush amongst the subset bound (non-boundall). 541 * The TCP model MAY change the actual ep field, this is why it is passed. 542 */ 543struct sctp_tcb * 544sctp_findassociation_ep_addr(struct sctp_inpcb **, 545 struct sockaddr *, struct sctp_nets **, struct sockaddr *, 546 struct sctp_tcb *); 547 548struct sctp_tcb * 549 sctp_findasoc_ep_asocid_locked(struct sctp_inpcb *inp, sctp_assoc_t asoc_id, int want_lock); 550 551struct sctp_tcb * 552sctp_findassociation_ep_asocid(struct sctp_inpcb *, 553 sctp_assoc_t, int); 554 555struct sctp_tcb * 556sctp_findassociation_ep_asconf(struct mbuf *, int, int, 557 struct sctphdr *, struct sctp_inpcb **, struct sctp_nets **, uint32_t vrf_id); 558 559int sctp_inpcb_alloc(struct socket *so, uint32_t vrf_id); 560 561int sctp_is_address_on_local_host(struct sockaddr *addr, uint32_t vrf_id); 562 563void sctp_inpcb_free(struct sctp_inpcb *, int, int); 564 565struct sctp_tcb * 566sctp_aloc_assoc(struct sctp_inpcb *, struct sockaddr *, 567 int, int *, uint32_t, uint32_t, struct thread *); 568 569int sctp_free_assoc(struct sctp_inpcb *, struct sctp_tcb *, int, int); 570 571 572void sctp_delete_from_timewait(uint32_t, uint16_t, uint16_t); 573 574int sctp_is_in_timewait(uint32_t tag, uint16_t lport, uint16_t rport); 575 576void 577 sctp_add_vtag_to_timewait(uint32_t tag, uint32_t time, uint16_t lport, uint16_t rport); 578 579void sctp_add_local_addr_ep(struct sctp_inpcb *, struct sctp_ifa *, uint32_t); 580 581int sctp_insert_laddr(struct sctpladdr *, struct sctp_ifa *, uint32_t); 582 583void sctp_remove_laddr(struct sctp_laddr *); 584 585void sctp_del_local_addr_ep(struct sctp_inpcb *, struct sctp_ifa *); 586 587int sctp_add_remote_addr(struct sctp_tcb *, struct sockaddr *, int, int); 588 589void sctp_remove_net(struct sctp_tcb *, struct sctp_nets *); 590 591int sctp_del_remote_addr(struct sctp_tcb *, struct sockaddr *); 592 593void sctp_pcb_init(void); 594 595void sctp_pcb_finish(void); 596 597void sctp_add_local_addr_restricted(struct sctp_tcb *, struct sctp_ifa *); 598void sctp_del_local_addr_restricted(struct sctp_tcb *, struct sctp_ifa *); 599 600int 601sctp_load_addresses_from_init(struct sctp_tcb *, struct mbuf *, int, int, 602 int, struct sctphdr *, struct sockaddr *); 603 604int 605sctp_set_primary_addr(struct sctp_tcb *, struct sockaddr *, 606 struct sctp_nets *); 607 608int sctp_is_vtag_good(struct sctp_inpcb *, uint32_t, uint16_t lport, uint16_t rport, struct timeval *, int); 609 610/* void sctp_drain(void); */ 611 612int sctp_destination_is_reachable(struct sctp_tcb *, struct sockaddr *); 613 614int sctp_swap_inpcb_for_listen(struct sctp_inpcb *inp); 615 616/*- 617 * Null in last arg inpcb indicate run on ALL ep's. Specific inp in last arg 618 * indicates run on ONLY assoc's of the specified endpoint. 619 */ 620int 621sctp_initiate_iterator(inp_func inpf, 622 asoc_func af, 623 inp_func inpe, 624 uint32_t, uint32_t, 625 uint32_t, void *, 626 uint32_t, 627 end_func ef, 628 struct sctp_inpcb *, 629 uint8_t co_off); 630 631#endif /* _KERNEL */ 632#endif /* !__sctp_pcb_h__ */ 633