xref: /freebsd/sys/netinet/sctp_output.h (revision aa0a1e58)
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  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions are met:
8  *
9  * a) Redistributions of source code must retain the above copyright notice,
10  *   this list of conditions and the following disclaimer.
11  *
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.
15  *
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.
19  *
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.
31  */
32 
33 /* $KAME: sctp_output.h,v 1.14 2005/03/06 16:04:18 itojun Exp $	 */
34 
35 #include <sys/cdefs.h>
36 __FBSDID("$FreeBSD$");
37 
38 #ifndef __sctp_output_h__
39 #define __sctp_output_h__
40 
41 #include <netinet/sctp_header.h>
42 
43 #if defined(_KERNEL) || defined(__Userspace__)
44 
45 
46 struct mbuf *
47 sctp_add_addresses_to_i_ia(struct sctp_inpcb *inp,
48     struct sctp_scoping *scope,
49     struct mbuf *m_at,
50     int cnt_inits_to);
51 
52 
53 int sctp_is_addr_restricted(struct sctp_tcb *, struct sctp_ifa *);
54 
55 
56 int
57 sctp_is_address_in_scope(struct sctp_ifa *ifa,
58     int ipv4_addr_legal,
59     int ipv6_addr_legal,
60     int loopback_scope,
61     int ipv4_local_scope,
62     int local_scope,
63     int site_scope,
64     int do_update);
65 int
66     sctp_is_addr_in_ep(struct sctp_inpcb *inp, struct sctp_ifa *ifa);
67 
68 struct sctp_ifa *
69 sctp_source_address_selection(struct sctp_inpcb *inp,
70     struct sctp_tcb *stcb,
71     sctp_route_t * ro, struct sctp_nets *net,
72     int non_asoc_addr_ok, uint32_t vrf_id);
73 
74 int
75     sctp_v6src_match_nexthop(struct sockaddr_in6 *src6, sctp_route_t * ro);
76 int
77     sctp_v4src_match_nexthop(struct sctp_ifa *sifa, sctp_route_t * ro);
78 
79 void
80 sctp_send_initiate(struct sctp_inpcb *, struct sctp_tcb *, int
81 #if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING)
82     SCTP_UNUSED
83 #endif
84 );
85 
86 void
87 sctp_send_initiate_ack(struct sctp_inpcb *, struct sctp_tcb *,
88     struct mbuf *, int, int, struct sctphdr *, struct sctp_init_chunk *,
89     uint32_t, uint16_t, int);
90 
91 struct mbuf *
92 sctp_arethere_unrecognized_parameters(struct mbuf *, int, int *,
93     struct sctp_chunkhdr *, int *);
94 void sctp_queue_op_err(struct sctp_tcb *, struct mbuf *);
95 
96 int
97 sctp_send_cookie_echo(struct mbuf *, int, struct sctp_tcb *,
98     struct sctp_nets *);
99 
100 void sctp_send_cookie_ack(struct sctp_tcb *);
101 
102 void
103 sctp_send_heartbeat_ack(struct sctp_tcb *, struct mbuf *, int, int,
104     struct sctp_nets *);
105 
106 void
107 sctp_remove_from_wheel(struct sctp_tcb *stcb,
108     struct sctp_association *asoc,
109     struct sctp_stream_out *strq, int holds_lock);
110 
111 
112 void sctp_send_shutdown(struct sctp_tcb *, struct sctp_nets *);
113 
114 void sctp_send_shutdown_ack(struct sctp_tcb *, struct sctp_nets *);
115 
116 void sctp_send_shutdown_complete(struct sctp_tcb *, struct sctp_nets *, int);
117 
118 void
119 sctp_send_shutdown_complete2(struct mbuf *, int, struct sctphdr *,
120     uint32_t, uint16_t);
121 
122 void sctp_send_asconf(struct sctp_tcb *, struct sctp_nets *, int addr_locked);
123 
124 void sctp_send_asconf_ack(struct sctp_tcb *);
125 
126 int sctp_get_frag_point(struct sctp_tcb *, struct sctp_association *);
127 
128 void sctp_toss_old_cookies(struct sctp_tcb *, struct sctp_association *);
129 
130 void sctp_toss_old_asconf(struct sctp_tcb *);
131 
132 void sctp_fix_ecn_echo(struct sctp_association *);
133 
134 void sctp_move_chunks_from_net(struct sctp_tcb *stcb, struct sctp_nets *net);
135 
136 int
137 sctp_output(struct sctp_inpcb *, struct mbuf *, struct sockaddr *,
138     struct mbuf *, struct thread *, int);
139 
140 void
141 sctp_chunk_output(struct sctp_inpcb *, struct sctp_tcb *, int, int
142 #if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING)
143     SCTP_UNUSED
144 #endif
145 );
146 void
147 sctp_send_abort_tcb(struct sctp_tcb *, struct mbuf *, int
148 #if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING)
149     SCTP_UNUSED
150 #endif
151 );
152 
153 void send_forward_tsn(struct sctp_tcb *, struct sctp_association *);
154 
155 void sctp_send_sack(struct sctp_tcb *);
156 
157 int sctp_send_hb(struct sctp_tcb *, int, struct sctp_nets *);
158 
159 void sctp_send_ecn_echo(struct sctp_tcb *, struct sctp_nets *, uint32_t);
160 
161 
162 void
163 sctp_send_packet_dropped(struct sctp_tcb *, struct sctp_nets *, struct mbuf *,
164     int, int);
165 
166 
167 
168 void sctp_send_cwr(struct sctp_tcb *, struct sctp_nets *, uint32_t, uint8_t);
169 
170 
171 void
172 sctp_add_stream_reset_out(struct sctp_tmit_chunk *chk,
173     int number_entries, uint16_t * list,
174     uint32_t seq, uint32_t resp_seq, uint32_t last_sent);
175 
176 void
177 sctp_add_stream_reset_in(struct sctp_tmit_chunk *chk,
178     int number_entries, uint16_t * list,
179     uint32_t seq);
180 
181 void
182 sctp_add_stream_reset_tsn(struct sctp_tmit_chunk *chk,
183     uint32_t seq);
184 
185 void
186 sctp_add_stream_reset_result(struct sctp_tmit_chunk *chk,
187     uint32_t resp_seq, uint32_t result);
188 
189 void
190 sctp_add_stream_reset_result_tsn(struct sctp_tmit_chunk *chk,
191     uint32_t resp_seq, uint32_t result,
192     uint32_t send_una, uint32_t recv_next);
193 
194 int
195 sctp_send_str_reset_req(struct sctp_tcb *stcb,
196     int number_entries,
197     uint16_t * list,
198     uint8_t send_out_req,
199     uint32_t resp_seq,
200     uint8_t send_in_req,
201     uint8_t send_tsn_req,
202     uint8_t add_str,
203     uint16_t adding);
204 
205 
206 void
207 sctp_send_abort(struct mbuf *, int, struct sctphdr *, uint32_t,
208     struct mbuf *, uint32_t, uint16_t);
209 
210 void sctp_send_operr_to(struct mbuf *, int, struct mbuf *, uint32_t, uint32_t, uint16_t);
211 
212 #endif				/* _KERNEL || __Userspace__ */
213 
214 #if defined(_KERNEL) || defined (__Userspace__)
215 int
216 sctp_sosend(struct socket *so,
217     struct sockaddr *addr,
218     struct uio *uio,
219     struct mbuf *top,
220     struct mbuf *control,
221     int flags,
222     struct thread *p
223 );
224 
225 #endif
226 #endif
227