]> CyberLeo.Net >> Repos - FreeBSD/stable/8.git/blob - sys/netinet/sctp_pcb.h
MFC r233660:
[FreeBSD/stable/8.git] / sys / netinet / sctp_pcb.h
1 /*-
2  * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved.
3  * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved.
4  * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved.
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * a) Redistributions of source code must retain the above copyright notice,
9  *    this list of conditions and the following disclaimer.
10  *
11  * b) Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in
13  *    the documentation and/or other materials provided with the distribution.
14  *
15  * c) Neither the name of Cisco Systems, Inc. nor the names of its
16  *    contributors may be used to endorse or promote products derived
17  *    from this software without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
21  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
29  * THE POSSIBILITY OF SUCH DAMAGE.
30  */
31
32 /* $KAME: sctp_pcb.h,v 1.21 2005/07/16 01:18:47 suz Exp $        */
33
34 #include <sys/cdefs.h>
35 __FBSDID("$FreeBSD$");
36
37 #ifndef __sctp_pcb_h__
38 #define __sctp_pcb_h__
39
40 #include <netinet/sctp_os.h>
41 #include <netinet/sctp.h>
42 #include <netinet/sctp_constants.h>
43 #include <netinet/sctp_sysctl.h>
44
45 LIST_HEAD(sctppcbhead, sctp_inpcb);
46 LIST_HEAD(sctpasochead, sctp_tcb);
47 LIST_HEAD(sctpladdr, sctp_laddr);
48 LIST_HEAD(sctpvtaghead, sctp_tagblock);
49 LIST_HEAD(sctp_vrflist, sctp_vrf);
50 LIST_HEAD(sctp_ifnlist, sctp_ifn);
51 LIST_HEAD(sctp_ifalist, sctp_ifa);
52 TAILQ_HEAD(sctp_readhead, sctp_queued_to_read);
53 TAILQ_HEAD(sctp_streamhead, sctp_stream_queue_pending);
54
55 #include <netinet/sctp_structs.h>
56 #include <netinet/sctp_auth.h>
57
58 #define SCTP_PCBHASH_ALLADDR(port, mask) (port & mask)
59 #define SCTP_PCBHASH_ASOC(tag, mask) (tag & mask)
60
61 struct sctp_vrf {
62         LIST_ENTRY(sctp_vrf) next_vrf;
63         struct sctp_ifalist *vrf_addr_hash;
64         struct sctp_ifnlist ifnlist;
65         uint32_t vrf_id;
66         uint32_t tbl_id_v4;     /* default v4 table id */
67         uint32_t tbl_id_v6;     /* default v6 table id */
68         uint32_t total_ifa_count;
69         u_long vrf_addr_hashmark;
70         uint32_t refcount;
71 };
72
73 struct sctp_ifn {
74         struct sctp_ifalist ifalist;
75         struct sctp_vrf *vrf;
76                  LIST_ENTRY(sctp_ifn) next_ifn;
77                  LIST_ENTRY(sctp_ifn) next_bucket;
78         void *ifn_p;            /* never access without appropriate lock */
79         uint32_t ifn_mtu;
80         uint32_t ifn_type;
81         uint32_t ifn_index;     /* shorthand way to look at ifn for reference */
82         uint32_t refcount;      /* number of reference held should be >=
83                                  * 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];
89 };
90
91 /* SCTP local IFA flags */
92 #define SCTP_ADDR_VALID         0x00000001      /* its up and active */
93 #define SCTP_BEING_DELETED      0x00000002      /* being deleted, when
94                                                  * refcount = 0. Note that it
95                                                  * is pulled from the ifn list
96                                                  * and ifa_p is nulled right
97                                                  * away but it cannot be freed
98                                                  * until the last *net
99                                                  * pointing to it is deleted. */
100 #define SCTP_ADDR_DEFER_USE     0x00000004      /* Hold off using this one */
101 #define SCTP_ADDR_IFA_UNUSEABLE 0x00000008
102
103 struct sctp_ifa {
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 update for
108                                  * that we MUST lock appropriate locks. This
109                                  * is for V6. */
110         union sctp_sockstore address;
111         uint32_t refcount;      /* number of folks refering to this */
112         uint32_t flags;
113         uint32_t localifa_flags;
114         uint32_t vrf_id;        /* vrf_id of this addr (for deleting) */
115         uint8_t src_is_loop;
116         uint8_t src_is_priv;
117         uint8_t src_is_glob;
118         uint8_t resv;
119 };
120
121 struct sctp_laddr {
122         LIST_ENTRY(sctp_laddr) sctp_nxt_addr;   /* next in list */
123         struct sctp_ifa *ifa;
124         uint32_t action;        /* Used during asconf and adding if no-zero
125                                  * src-addr selection will not consider this
126                                  * address. */
127         struct timeval start_time;      /* time when this address was created */
128 };
129
130 struct sctp_block_entry {
131         int error;
132 };
133
134 struct sctp_timewait {
135         uint32_t tv_sec_at_expire;      /* the seconds from boot to expire */
136         uint32_t v_tag;         /* the vtag that can not be reused */
137         uint16_t lport;         /* the local port used in vtag */
138         uint16_t rport;         /* the remote port used in vtag */
139 };
140
141 struct sctp_tagblock {
142         LIST_ENTRY(sctp_tagblock) sctp_nxt_tagblock;
143         struct sctp_timewait vtag_block[SCTP_NUMBER_IN_VTAG_BLOCK];
144 };
145
146
147 struct sctp_epinfo {
148         struct socket *udp_tun_socket;
149         struct sctpasochead *sctp_asochash;
150         u_long hashasocmark;
151
152         struct sctppcbhead *sctp_ephash;
153         u_long hashmark;
154
155         /*-
156          * The TCP model represents a substantial overhead in that we get an
157          * additional hash table to keep explicit connections in. The
158          * listening TCP endpoint will exist in the usual ephash above and
159          * accept only INIT's. It will be incapable of sending off an INIT.
160          * When a dg arrives we must look in the normal ephash. If we find a
161          * TCP endpoint that will tell us to go to the specific endpoint
162          * hash and re-hash to find the right assoc/socket. If we find a UDP
163          * model socket we then must complete the lookup. If this fails,
164          * i.e. no association can be found then we must continue to see if
165          * a sctp_peeloff()'d socket is in the tcpephash (a spun off socket
166          * acts like a TCP model connected socket).
167          */
168         struct sctppcbhead *sctp_tcpephash;
169         u_long hashtcpmark;
170         uint32_t hashtblsize;
171
172         struct sctp_vrflist *sctp_vrfhash;
173         u_long hashvrfmark;
174
175         struct sctp_ifnlist *vrf_ifn_hash;
176         u_long vrf_ifn_hashmark;
177
178         struct sctppcbhead listhead;
179         struct sctpladdr addr_wq;
180
181         /* ep zone info */
182         sctp_zone_t ipi_zone_ep;
183         sctp_zone_t ipi_zone_asoc;
184         sctp_zone_t ipi_zone_laddr;
185         sctp_zone_t ipi_zone_net;
186         sctp_zone_t ipi_zone_chunk;
187         sctp_zone_t ipi_zone_readq;
188         sctp_zone_t ipi_zone_strmoq;
189         sctp_zone_t ipi_zone_asconf;
190         sctp_zone_t ipi_zone_asconf_ack;
191
192         struct rwlock ipi_ep_mtx;
193         struct mtx ipi_iterator_wq_mtx;
194         struct rwlock ipi_addr_mtx;
195         struct mtx ipi_pktlog_mtx;
196         struct mtx wq_addr_mtx;
197         uint32_t ipi_count_ep;
198
199         /* assoc/tcb zone info */
200         uint32_t ipi_count_asoc;
201
202         /* local addrlist zone info */
203         uint32_t ipi_count_laddr;
204
205         /* remote addrlist zone info */
206         uint32_t ipi_count_raddr;
207
208         /* chunk structure list for output */
209         uint32_t ipi_count_chunk;
210
211         /* socket queue zone info */
212         uint32_t ipi_count_readq;
213
214         /* socket queue zone info */
215         uint32_t ipi_count_strmoq;
216
217         /* Number of vrfs */
218         uint32_t ipi_count_vrfs;
219
220         /* Number of ifns */
221         uint32_t ipi_count_ifns;
222
223         /* Number of ifas */
224         uint32_t ipi_count_ifas;
225
226         /* system wide number of free chunks hanging around */
227         uint32_t ipi_free_chunks;
228         uint32_t ipi_free_strmoq;
229
230         struct sctpvtaghead vtag_timewait[SCTP_STACK_VTAG_HASH_SIZE];
231
232         /* address work queue handling */
233         struct sctp_timer addr_wq_timer;
234
235 };
236
237
238 struct sctp_base_info {
239         /*
240          * All static structures that anchor the system must be here.
241          */
242         struct sctp_epinfo sctppcbinfo;
243 #if defined(__FreeBSD__) && defined(SMP) && defined(SCTP_USE_PERCPU_STAT)
244         struct sctpstat *sctpstat;
245 #else
246         struct sctpstat sctpstat;
247 #endif
248         struct sctp_sysctl sctpsysctl;
249         uint8_t first_time;
250         char sctp_pcb_initialized;
251 #if defined(SCTP_PACKET_LOGGING)
252         int packet_log_writers;
253         int packet_log_end;
254         uint8_t packet_log_buffer[SCTP_PACKET_LOG_SIZE];
255 #endif
256 };
257
258 /*-
259  * Here we have all the relevant information for each SCTP entity created. We
260  * will need to modify this as approprate. We also need to figure out how to
261  * access /dev/random.
262  */
263 struct sctp_pcb {
264         unsigned int time_of_secret_change;     /* number of seconds from
265                                                  * timeval.tv_sec */
266         uint32_t secret_key[SCTP_HOW_MANY_SECRETS][SCTP_NUMBER_OF_SECRETS];
267         unsigned int size_of_a_cookie;
268
269         unsigned int sctp_timeoutticks[SCTP_NUM_TMRS];
270         unsigned int sctp_minrto;
271         unsigned int sctp_maxrto;
272         unsigned int initial_rto;
273         int initial_init_rto_max;
274
275         unsigned int sctp_sack_freq;
276         uint32_t sctp_sws_sender;
277         uint32_t sctp_sws_receiver;
278
279         uint32_t sctp_default_cc_module;
280         uint32_t sctp_default_ss_module;
281         /* authentication related fields */
282         struct sctp_keyhead shared_keys;
283         sctp_auth_chklist_t *local_auth_chunks;
284         sctp_hmaclist_t *local_hmacs;
285         uint16_t default_keyid;
286
287         /* various thresholds */
288         /* Max times I will init at a guy */
289         uint16_t max_init_times;
290
291         /* Max times I will send before we consider someone dead */
292         uint16_t max_send_times;
293
294         uint16_t def_net_failure;
295
296         uint16_t def_net_pf_threshold;
297
298         /* number of streams to pre-open on a association */
299         uint16_t pre_open_stream_count;
300         uint16_t max_open_streams_intome;
301
302         /* random number generator */
303         uint32_t random_counter;
304         uint8_t random_numbers[SCTP_SIGNATURE_ALOC_SIZE];
305         uint8_t random_store[SCTP_SIGNATURE_ALOC_SIZE];
306
307         /*
308          * This timer is kept running per endpoint.  When it fires it will
309          * change the secret key.  The default is once a hour
310          */
311         struct sctp_timer signature_change;
312
313         /* Zero copy full buffer timer */
314         struct sctp_timer zero_copy_timer;
315         /* Zero copy app to transport (sendq) read repulse timer */
316         struct sctp_timer zero_copy_sendq_timer;
317         uint32_t def_cookie_life;
318         /* defaults to 0 */
319         int auto_close_time;
320         uint32_t initial_sequence_debug;
321         uint32_t adaptation_layer_indicator;
322         uint32_t store_at;
323         uint32_t max_burst;
324         uint32_t fr_max_burst;
325 #ifdef INET6
326         uint32_t default_flowlabel;
327 #endif
328         uint8_t default_dscp;
329         char current_secret_number;
330         char last_secret_number;
331         uint16_t port;          /* remote UDP encapsulation port */
332 };
333
334 #ifndef SCTP_ALIGNMENT
335 #define SCTP_ALIGNMENT 32
336 #endif
337
338 #ifndef SCTP_ALIGNM1
339 #define SCTP_ALIGNM1 (SCTP_ALIGNMENT-1)
340 #endif
341
342 #define sctp_lport ip_inp.inp.inp_lport
343
344 struct sctp_pcbtsn_rlog {
345         uint32_t vtag;
346         uint16_t strm;
347         uint16_t seq;
348         uint16_t sz;
349         uint16_t flgs;
350 };
351
352 #define SCTP_READ_LOG_SIZE 135  /* we choose the number to make a pcb a page */
353
354
355 struct sctp_inpcb {
356         /*-
357          * put an inpcb in front of it all, kind of a waste but we need to
358          * for compatability with all the other stuff.
359          */
360         union {
361                 struct inpcb inp;
362                 char align[(sizeof(struct in6pcb) + SCTP_ALIGNM1) &
363                         ~SCTP_ALIGNM1];
364         }     ip_inp;
365
366
367         /* Socket buffer lock protects read_queue and of course sb_cc */
368         struct sctp_readhead read_queue;
369
370                       LIST_ENTRY(sctp_inpcb) sctp_list; /* lists all endpoints */
371         /* hash of all endpoints for model */
372                       LIST_ENTRY(sctp_inpcb) sctp_hash;
373         /* count of local addresses bound, 0 if bound all */
374         int laddr_count;
375
376         /* list of addrs in use by the EP, NULL if bound-all */
377         struct sctpladdr sctp_addr_list;
378         /*
379          * used for source address selection rotation when we are subset
380          * bound
381          */
382         struct sctp_laddr *next_addr_touse;
383
384         /* back pointer to our socket */
385         struct socket *sctp_socket;
386         uint32_t sctp_flags;    /* INP state flag set */
387         uint32_t sctp_features; /* Feature flags */
388         uint32_t sctp_mobility_features;        /* Mobility  Feature flags */
389         struct sctp_pcb sctp_ep;/* SCTP ep data */
390         /* head of the hash of all associations */
391         struct sctpasochead *sctp_tcbhash;
392         u_long sctp_hashmark;
393         /* head of the list of all associations */
394         struct sctpasochead sctp_asoc_list;
395 #ifdef SCTP_TRACK_FREED_ASOCS
396         struct sctpasochead sctp_asoc_free_list;
397 #endif
398         struct sctp_iterator *inp_starting_point_for_iterator;
399         uint32_t sctp_frag_point;
400         uint32_t partial_delivery_point;
401         uint32_t sctp_context;
402         uint8_t local_strreset_support;
403         uint32_t sctp_cmt_on_off;
404         uint32_t sctp_ecn_enable;
405         struct sctp_nonpad_sndrcvinfo def_send;
406         /*-
407          * These three are here for the sosend_dgram
408          * (pkt, pkt_last and control).
409          * routine. However, I don't think anyone in
410          * the current FreeBSD kernel calls this. So
411          * they are candidates with sctp_sendm for
412          * de-supporting.
413          */
414         struct mbuf *pkt, *pkt_last;
415         struct mbuf *control;
416         struct mtx inp_mtx;
417         struct mtx inp_create_mtx;
418         struct mtx inp_rdata_mtx;
419         int32_t refcount;
420         uint32_t def_vrf_id;
421         uint32_t total_sends;
422         uint32_t total_recvs;
423         uint32_t last_abort_code;
424         uint32_t total_nospaces;
425         struct sctpasochead *sctp_asocidhash;
426         u_long hashasocidmark;
427         uint32_t sctp_associd_counter;
428
429 #ifdef SCTP_ASOCLOG_OF_TSNS
430         struct sctp_pcbtsn_rlog readlog[SCTP_READ_LOG_SIZE];
431         uint32_t readlog_index;
432 #endif
433 };
434
435 struct sctp_tcb {
436         struct socket *sctp_socket;     /* back pointer to socket */
437         struct sctp_inpcb *sctp_ep;     /* back pointer to ep */
438                    LIST_ENTRY(sctp_tcb) sctp_tcbhash;   /* next link in hash
439                                                          * table */
440                    LIST_ENTRY(sctp_tcb) sctp_tcblist;   /* list of all of the
441                                                          * TCB's */
442                    LIST_ENTRY(sctp_tcb) sctp_tcbasocidhash;     /* next link in asocid
443                                                                  * hash table */
444                    LIST_ENTRY(sctp_tcb) sctp_asocs;     /* vtag hash list */
445         struct sctp_block_entry *block_entry;   /* pointer locked by  socket
446                                                  * send buffer */
447         struct sctp_association asoc;
448         /*-
449          * freed_by_sorcv_sincelast is protected by the sockbuf_lock NOT the
450          * tcb_lock. Its special in this way to help avoid extra mutex calls
451          * in the reading of data.
452          */
453         uint32_t freed_by_sorcv_sincelast;
454         uint32_t total_sends;
455         uint32_t total_recvs;
456         int freed_from_where;
457         uint16_t rport;         /* remote port in network format */
458         uint16_t resv;
459         struct mtx tcb_mtx;
460         struct mtx tcb_send_mtx;
461 };
462
463
464
465 #include <netinet/sctp_lock_bsd.h>
466
467
468 /* TODO where to put non-_KERNEL things for __Userspace__? */
469 #if defined(_KERNEL) || defined(__Userspace__)
470
471 /* Attention Julian, this is the extern that
472  * goes with the base info. sctp_pcb.c has
473  * the real definition.
474  */
475 VNET_DECLARE(struct sctp_base_info, system_base_info);
476
477 #ifdef INET6
478 int SCTP6_ARE_ADDR_EQUAL(struct sockaddr_in6 *a, struct sockaddr_in6 *b);
479
480 #endif
481
482 void sctp_fill_pcbinfo(struct sctp_pcbinfo *);
483
484 struct sctp_ifn *
485          sctp_find_ifn(void *ifn, uint32_t ifn_index);
486
487 struct sctp_vrf *sctp_allocate_vrf(int vrfid);
488 struct sctp_vrf *sctp_find_vrf(uint32_t vrfid);
489 void sctp_free_vrf(struct sctp_vrf *vrf);
490
491 /*-
492  * Change address state, can be used if
493  * O/S supports telling transports about
494  * changes to IFA/IFN's (link layer triggers).
495  * If a ifn goes down, we will do src-addr-selection
496  * and NOT use that, as a source address. This does
497  * not stop the routing system from routing out
498  * that interface, but we won't put it as a source.
499  */
500 void sctp_mark_ifa_addr_down(uint32_t vrf_id, struct sockaddr *addr, const char *if_name, uint32_t ifn_index);
501 void sctp_mark_ifa_addr_up(uint32_t vrf_id, struct sockaddr *addr, const char *if_name, uint32_t ifn_index);
502
503 struct sctp_ifa *
504 sctp_add_addr_to_vrf(uint32_t vrfid,
505     void *ifn, uint32_t ifn_index, uint32_t ifn_type,
506     const char *if_name,
507     void *ifa, struct sockaddr *addr, uint32_t ifa_flags,
508     int dynamic_add);
509
510 void sctp_update_ifn_mtu(uint32_t ifn_index, uint32_t mtu);
511
512 void sctp_free_ifn(struct sctp_ifn *sctp_ifnp);
513 void sctp_free_ifa(struct sctp_ifa *sctp_ifap);
514
515
516 void 
517 sctp_del_addr_from_vrf(uint32_t vrfid, struct sockaddr *addr,
518     uint32_t ifn_index, const char *if_name);
519
520
521
522 struct sctp_nets *sctp_findnet(struct sctp_tcb *, struct sockaddr *);
523
524 struct sctp_inpcb *sctp_pcb_findep(struct sockaddr *, int, int, uint32_t);
525
526 int 
527 sctp_inpcb_bind(struct socket *, struct sockaddr *,
528     struct sctp_ifa *, struct thread *);
529
530 struct sctp_tcb *
531 sctp_findassociation_addr(struct mbuf *, int,
532     struct sctphdr *, struct sctp_chunkhdr *, struct sctp_inpcb **,
533     struct sctp_nets **, uint32_t vrf_id);
534
535 struct sctp_tcb *
536 sctp_findassociation_addr_sa(struct sockaddr *,
537     struct sockaddr *, struct sctp_inpcb **, struct sctp_nets **, int, uint32_t);
538
539 void
540 sctp_move_pcb_and_assoc(struct sctp_inpcb *, struct sctp_inpcb *,
541     struct sctp_tcb *);
542
543 /*-
544  * For this call ep_addr, the to is the destination endpoint address of the
545  * peer (relative to outbound). The from field is only used if the TCP model
546  * is enabled and helps distingush amongst the subset bound (non-boundall).
547  * The TCP model MAY change the actual ep field, this is why it is passed.
548  */
549 struct sctp_tcb *
550 sctp_findassociation_ep_addr(struct sctp_inpcb **,
551     struct sockaddr *, struct sctp_nets **, struct sockaddr *,
552     struct sctp_tcb *);
553
554 struct sctp_tcb *
555          sctp_findasoc_ep_asocid_locked(struct sctp_inpcb *inp, sctp_assoc_t asoc_id, int want_lock);
556
557 struct sctp_tcb *
558 sctp_findassociation_ep_asocid(struct sctp_inpcb *,
559     sctp_assoc_t, int);
560
561 struct sctp_tcb *
562 sctp_findassociation_ep_asconf(struct mbuf *, int,
563     struct sctphdr *, struct sctp_inpcb **, struct sctp_nets **, uint32_t vrf_id);
564
565 int sctp_inpcb_alloc(struct socket *so, uint32_t vrf_id);
566
567 int sctp_is_address_on_local_host(struct sockaddr *addr, uint32_t vrf_id);
568
569 void sctp_inpcb_free(struct sctp_inpcb *, int, int);
570
571 struct sctp_tcb *
572 sctp_aloc_assoc(struct sctp_inpcb *, struct sockaddr *,
573     int *, uint32_t, uint32_t, struct thread *);
574
575 int sctp_free_assoc(struct sctp_inpcb *, struct sctp_tcb *, int, int);
576
577
578 void sctp_delete_from_timewait(uint32_t, uint16_t, uint16_t);
579
580 int sctp_is_in_timewait(uint32_t tag, uint16_t lport, uint16_t rport);
581
582 void
583      sctp_add_vtag_to_timewait(uint32_t tag, uint32_t time, uint16_t lport, uint16_t rport);
584
585 void sctp_add_local_addr_ep(struct sctp_inpcb *, struct sctp_ifa *, uint32_t);
586
587 int sctp_insert_laddr(struct sctpladdr *, struct sctp_ifa *, uint32_t);
588
589 void sctp_remove_laddr(struct sctp_laddr *);
590
591 void sctp_del_local_addr_ep(struct sctp_inpcb *, struct sctp_ifa *);
592
593 int sctp_add_remote_addr(struct sctp_tcb *, struct sockaddr *, struct sctp_nets **, int, int);
594
595 void sctp_remove_net(struct sctp_tcb *, struct sctp_nets *);
596
597 int sctp_del_remote_addr(struct sctp_tcb *, struct sockaddr *);
598
599 void sctp_pcb_init(void);
600
601 void sctp_pcb_finish(void);
602
603 void sctp_add_local_addr_restricted(struct sctp_tcb *, struct sctp_ifa *);
604 void sctp_del_local_addr_restricted(struct sctp_tcb *, struct sctp_ifa *);
605
606 int
607 sctp_load_addresses_from_init(struct sctp_tcb *, struct mbuf *, int,
608     int, struct sctphdr *, struct sockaddr *);
609
610 int
611 sctp_set_primary_addr(struct sctp_tcb *, struct sockaddr *,
612     struct sctp_nets *);
613
614 int sctp_is_vtag_good(uint32_t, uint16_t lport, uint16_t rport, struct timeval *);
615
616 /* void sctp_drain(void); */
617
618 int sctp_destination_is_reachable(struct sctp_tcb *, struct sockaddr *);
619
620 int sctp_swap_inpcb_for_listen(struct sctp_inpcb *inp);
621
622 /*-
623  * Null in last arg inpcb indicate run on ALL ep's. Specific inp in last arg
624  * indicates run on ONLY assoc's of the specified endpoint.
625  */
626 int
627 sctp_initiate_iterator(inp_func inpf,
628     asoc_func af,
629     inp_func inpe,
630     uint32_t, uint32_t,
631     uint32_t, void *,
632     uint32_t,
633     end_func ef,
634     struct sctp_inpcb *,
635     uint8_t co_off);
636
637 #if defined(__FreeBSD__) && defined(SCTP_MCORE_INPUT) && defined(SMP)
638 void
639      sctp_queue_to_mcore(struct mbuf *m, int off, int cpu_to_use);
640
641 #endif
642
643 #ifdef INVARIANTS
644 void
645      sctp_validate_no_locks(struct sctp_inpcb *inp);
646
647 #endif
648
649 #endif                          /* _KERNEL */
650 #endif                          /* !__sctp_pcb_h__ */