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