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