Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / usrsctp / usrsctplib / 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 #ifdef __FreeBSD__
34 #include <sys/cdefs.h>
35 __FBSDID("$FreeBSD: head/sys/netinet/sctp_output.h 272751 2014-10-08 15:30:59Z tuexen $");
36 #endif
37
38 #ifndef _NETINET_SCTP_OUTPUT_H_
39 #define _NETINET_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_tcb *stcb,
49                            struct sctp_scoping *scope,
50                            struct mbuf *m_at,
51                            int cnt_inits_to,
52                            uint16_t *padding_len, uint16_t *chunk_len);
53
54
55 int sctp_is_addr_restricted(struct sctp_tcb *, struct sctp_ifa *);
56
57
58 int
59 sctp_is_address_in_scope(struct sctp_ifa *ifa,
60                          struct sctp_scoping *scope,
61                          int do_update);
62
63 int
64 sctp_is_addr_in_ep(struct sctp_inpcb *inp, struct sctp_ifa *ifa);
65
66 struct sctp_ifa *
67 sctp_source_address_selection(struct sctp_inpcb *inp,
68                               struct sctp_tcb *stcb,
69                               sctp_route_t *ro, struct sctp_nets *net,
70                               int non_asoc_addr_ok, uint32_t vrf_id);
71
72 #if defined(__FreeBSD__) || defined(__APPLE__) || defined(__Userspace__)
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 #endif
78
79 void 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 *, struct mbuf *,
87                        int, int,
88                        struct sockaddr *, struct sockaddr *,
89                        struct sctphdr *, struct sctp_init_chunk *,
90 #if defined(__FreeBSD__)
91                        uint8_t, uint32_t,
92 #endif
93                        uint32_t, uint16_t, int);
94
95 struct mbuf *
96 sctp_arethere_unrecognized_parameters(struct mbuf *, int, int *,
97                                       struct sctp_chunkhdr *, int *);
98 void sctp_queue_op_err(struct sctp_tcb *, struct mbuf *);
99
100 int
101 sctp_send_cookie_echo(struct mbuf *, int, struct sctp_tcb *,
102     struct sctp_nets *);
103
104 void sctp_send_cookie_ack(struct sctp_tcb *);
105
106 void
107 sctp_send_heartbeat_ack(struct sctp_tcb *, struct mbuf *, int, int,
108     struct sctp_nets *);
109
110 void
111 sctp_remove_from_wheel(struct sctp_tcb *stcb,
112                                            struct sctp_association *asoc,
113                                            struct sctp_stream_out *strq, int holds_lock);
114
115
116 void sctp_send_shutdown(struct sctp_tcb *, struct sctp_nets *);
117
118 void sctp_send_shutdown_ack(struct sctp_tcb *, struct sctp_nets *);
119
120 void sctp_send_shutdown_complete(struct sctp_tcb *, struct sctp_nets *, int);
121
122 void sctp_send_shutdown_complete2(struct sockaddr *, struct sockaddr *,
123                                   struct sctphdr *,
124 #if defined(__FreeBSD__)
125                                   uint8_t, uint32_t,
126 #endif
127                                   uint32_t, uint16_t);
128
129 void sctp_send_asconf(struct sctp_tcb *, struct sctp_nets *, int addr_locked);
130
131 void sctp_send_asconf_ack(struct sctp_tcb *);
132
133 int sctp_get_frag_point(struct sctp_tcb *, struct sctp_association *);
134
135 void sctp_toss_old_cookies(struct sctp_tcb *, struct sctp_association *);
136
137 void sctp_toss_old_asconf(struct sctp_tcb *);
138
139 void sctp_fix_ecn_echo(struct sctp_association *);
140
141 void sctp_move_chunks_from_net(struct sctp_tcb *stcb, struct sctp_nets *net);
142
143 #if defined(__FreeBSD__) && __FreeBSD_version >= 500000
144 int
145 sctp_output(struct sctp_inpcb *, struct mbuf *, struct sockaddr *,
146     struct mbuf *, struct thread *, int);
147 #elif defined(__Windows__)
148 sctp_output(struct sctp_inpcb *, struct mbuf *, struct sockaddr *,
149     struct mbuf *, PKTHREAD, int);
150 #else
151 #if defined(__Userspace__)
152 /* sctp_output is called bu sctp_sendm. Not using sctp_sendm for __Userspace__ */
153 #endif
154 int
155 sctp_output(struct sctp_inpcb *,
156 #if defined(__Panda__)
157     pakhandle_type,
158 #else
159     struct mbuf *,
160 #endif
161     struct sockaddr *,
162 #if defined(__Panda__)
163     pakhandle_type,
164 #else
165     struct mbuf *,
166 #endif
167     struct proc *, int);
168 #endif
169
170 void sctp_chunk_output(struct sctp_inpcb *, struct sctp_tcb *, int, int
171 #if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING)
172     SCTP_UNUSED
173 #endif
174     );
175 void sctp_send_abort_tcb(struct sctp_tcb *, struct mbuf *, int
176 #if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING)
177     SCTP_UNUSED
178 #endif
179     );
180
181 void send_forward_tsn(struct sctp_tcb *, struct sctp_association *);
182
183 void sctp_send_sack(struct sctp_tcb *, int);
184
185 void sctp_send_hb(struct sctp_tcb *, struct sctp_nets *, int);
186
187 void sctp_send_ecn_echo(struct sctp_tcb *, struct sctp_nets *, uint32_t);
188
189
190 void
191 sctp_send_packet_dropped(struct sctp_tcb *, struct sctp_nets *, struct mbuf *,
192     int, int, int);
193
194
195
196 void sctp_send_cwr(struct sctp_tcb *, struct sctp_nets *, uint32_t, uint8_t);
197
198
199 void
200 sctp_add_stream_reset_out(struct sctp_tmit_chunk *,
201                           int, uint16_t *, uint32_t, uint32_t, uint32_t);
202
203 void
204 sctp_add_stream_reset_result(struct sctp_tmit_chunk *, uint32_t, uint32_t);
205
206 void
207 sctp_add_stream_reset_result_tsn(struct sctp_tmit_chunk *,
208                                  uint32_t, uint32_t, uint32_t, uint32_t);
209
210 int
211 sctp_send_str_reset_req(struct sctp_tcb *, uint16_t , uint16_t *, uint8_t,
212                         uint8_t, uint8_t, uint8_t, uint16_t, uint16_t, uint8_t);
213
214 void
215 sctp_send_abort(struct mbuf *, int, struct sockaddr *, struct sockaddr *,
216                 struct sctphdr *, uint32_t, struct mbuf *,
217 #if defined(__FreeBSD__)
218                 uint8_t, uint32_t,
219 #endif
220                 uint32_t, uint16_t);
221
222 void sctp_send_operr_to(struct sockaddr *, struct sockaddr *,
223                         struct sctphdr *, uint32_t, struct mbuf *,
224 #if defined(__FreeBSD__)
225                         uint8_t, uint32_t,
226 #endif
227                         uint32_t, uint16_t);
228
229 #endif /* _KERNEL || __Userspace__ */
230
231 #if defined(_KERNEL) || defined(__Userspace__)
232 int
233 sctp_sosend(struct socket *so,
234     struct sockaddr *addr,
235     struct uio *uio,
236 #ifdef __Panda__
237     pakhandle_type top,
238     pakhandle_type control,
239 #else
240     struct mbuf *top,
241     struct mbuf *control,
242 #endif
243 #if defined(__APPLE__) || defined(__Panda__)
244     int flags
245 #else
246     int flags,
247 #if defined(__FreeBSD__) && __FreeBSD_version >= 500000
248     struct thread *p
249 #elif defined(__Windows__)
250     PKTHREAD p
251 #else
252 #if defined(__Userspace__)
253     /* proc is a dummy in __Userspace__ and will not be passed to sctp_lower_sosend */
254 #endif
255     struct proc *p
256 #endif
257 #endif
258 );
259
260 #endif
261 #endif
262