sctp_output.h revision 285792
1163953Srrs/*-
2169382Srrs * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved.
3235828Stuexen * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved.
4235828Stuexen * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved.
5163953Srrs *
6163953Srrs * Redistribution and use in source and binary forms, with or without
7163953Srrs * modification, are permitted provided that the following conditions are met:
8163953Srrs *
9163953Srrs * a) Redistributions of source code must retain the above copyright notice,
10228653Stuexen *    this list of conditions and the following disclaimer.
11163953Srrs *
12163953Srrs * b) Redistributions in binary form must reproduce the above copyright
13163953Srrs *    notice, this list of conditions and the following disclaimer in
14228653Stuexen *    the documentation and/or other materials provided with the distribution.
15163953Srrs *
16163953Srrs * c) Neither the name of Cisco Systems, Inc. nor the names of its
17163953Srrs *    contributors may be used to endorse or promote products derived
18163953Srrs *    from this software without specific prior written permission.
19163953Srrs *
20163953Srrs * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21163953Srrs * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22163953Srrs * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23163953Srrs * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24163953Srrs * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25163953Srrs * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26163953Srrs * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27163953Srrs * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28163953Srrs * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29163953Srrs * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
30163953Srrs * THE POSSIBILITY OF SUCH DAMAGE.
31163953Srrs */
32163953Srrs
33163953Srrs#include <sys/cdefs.h>
34163953Srrs__FBSDID("$FreeBSD: head/sys/netinet/sctp_output.h 285792 2015-07-22 11:30:37Z rrs $");
35163953Srrs
36235828Stuexen#ifndef _NETINET_SCTP_OUTPUT_H_
37235828Stuexen#define _NETINET_SCTP_OUTPUT_H_
38163953Srrs
39163953Srrs#include <netinet/sctp_header.h>
40163953Srrs
41180387Srrs#if defined(_KERNEL) || defined(__Userspace__)
42167598Srrs
43167598Srrs
44167598Srrsstruct mbuf *
45167598Srrssctp_add_addresses_to_i_ia(struct sctp_inpcb *inp,
46221904Stuexen    struct sctp_tcb *stcb,
47167598Srrs    struct sctp_scoping *scope,
48167598Srrs    struct mbuf *m_at,
49244021Stuexen    int cnt_inits_to,
50244021Stuexen    uint16_t * padding_len, uint16_t * chunk_len);
51167598Srrs
52167598Srrs
53167598Srrsint sctp_is_addr_restricted(struct sctp_tcb *, struct sctp_ifa *);
54167598Srrs
55167598Srrs
56167598Srrsint
57167598Srrssctp_is_address_in_scope(struct sctp_ifa *ifa,
58246595Stuexen    struct sctp_scoping *scope,
59167598Srrs    int do_update);
60246595Stuexen
61167598Srrsint
62167598Srrs    sctp_is_addr_in_ep(struct sctp_inpcb *inp, struct sctp_ifa *ifa);
63167598Srrs
64167598Srrsstruct sctp_ifa *
65167598Srrssctp_source_address_selection(struct sctp_inpcb *inp,
66167598Srrs    struct sctp_tcb *stcb,
67168299Srrs    sctp_route_t * ro, struct sctp_nets *net,
68167598Srrs    int non_asoc_addr_ok, uint32_t vrf_id);
69167598Srrs
70171990Srrsint
71171990Srrs    sctp_v6src_match_nexthop(struct sockaddr_in6 *src6, sctp_route_t * ro);
72171990Srrsint
73171990Srrs    sctp_v4src_match_nexthop(struct sctp_ifa *sifa, sctp_route_t * ro);
74167598Srrs
75172090Srrsvoid
76172090Srrssctp_send_initiate(struct sctp_inpcb *, struct sctp_tcb *, int
77172090Srrs#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING)
78172090Srrs    SCTP_UNUSED
79172090Srrs#endif
80172090Srrs);
81163953Srrs
82163953Srrsvoid
83237049Stuexensctp_send_initiate_ack(struct sctp_inpcb *, struct sctp_tcb *, struct mbuf *,
84237715Stuexen    int, int,
85237715Stuexen    struct sockaddr *, struct sockaddr *,
86237715Stuexen    struct sctphdr *, struct sctp_init_chunk *,
87237049Stuexen    uint8_t, uint32_t,
88179157Srrs    uint32_t, uint16_t, int);
89163953Srrs
90163953Srrsstruct mbuf *
91163953Srrssctp_arethere_unrecognized_parameters(struct mbuf *, int, int *,
92185694Srrs    struct sctp_chunkhdr *, int *);
93163953Srrsvoid sctp_queue_op_err(struct sctp_tcb *, struct mbuf *);
94163953Srrs
95163953Srrsint
96163953Srrssctp_send_cookie_echo(struct mbuf *, int, struct sctp_tcb *,
97163953Srrs    struct sctp_nets *);
98163953Srrs
99169378Srrsvoid sctp_send_cookie_ack(struct sctp_tcb *);
100169378Srrs
101163953Srrsvoid
102163953Srrssctp_send_heartbeat_ack(struct sctp_tcb *, struct mbuf *, int, int,
103163953Srrs    struct sctp_nets *);
104163953Srrs
105189121Srrsvoid
106189121Srrssctp_remove_from_wheel(struct sctp_tcb *stcb,
107189121Srrs    struct sctp_association *asoc,
108189121Srrs    struct sctp_stream_out *strq, int holds_lock);
109163953Srrs
110189121Srrs
111169378Srrsvoid sctp_send_shutdown(struct sctp_tcb *, struct sctp_nets *);
112163953Srrs
113169378Srrsvoid sctp_send_shutdown_ack(struct sctp_tcb *, struct sctp_nets *);
114163953Srrs
115204141Stuexenvoid sctp_send_shutdown_complete(struct sctp_tcb *, struct sctp_nets *, int);
116163953Srrs
117169378Srrsvoid
118237715Stuexensctp_send_shutdown_complete2(struct sockaddr *, struct sockaddr *,
119237715Stuexen    struct sctphdr *,
120284515Stuexen    uint8_t, uint32_t, uint16_t,
121179157Srrs    uint32_t, uint16_t);
122163953Srrs
123172190Srrsvoid sctp_send_asconf(struct sctp_tcb *, struct sctp_nets *, int addr_locked);
124163953Srrs
125171990Srrsvoid sctp_send_asconf_ack(struct sctp_tcb *);
126163953Srrs
127163953Srrsint sctp_get_frag_point(struct sctp_tcb *, struct sctp_association *);
128163953Srrs
129163953Srrsvoid sctp_toss_old_cookies(struct sctp_tcb *, struct sctp_association *);
130163953Srrs
131163953Srrsvoid sctp_toss_old_asconf(struct sctp_tcb *);
132163953Srrs
133163953Srrsvoid sctp_fix_ecn_echo(struct sctp_association *);
134163953Srrs
135212712Stuexenvoid sctp_move_chunks_from_net(struct sctp_tcb *stcb, struct sctp_nets *net);
136212712Stuexen
137163953Srrsint
138163953Srrssctp_output(struct sctp_inpcb *, struct mbuf *, struct sockaddr *,
139163953Srrs    struct mbuf *, struct thread *, int);
140163953Srrs
141172090Srrsvoid
142172090Srrssctp_chunk_output(struct sctp_inpcb *, struct sctp_tcb *, int, int
143172090Srrs#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING)
144172090Srrs    SCTP_UNUSED
145172090Srrs#endif
146172090Srrs);
147172090Srrsvoid
148172090Srrssctp_send_abort_tcb(struct sctp_tcb *, struct mbuf *, int
149172090Srrs#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING)
150172090Srrs    SCTP_UNUSED
151172090Srrs#endif
152172090Srrs);
153163953Srrs
154163953Srrsvoid send_forward_tsn(struct sctp_tcb *, struct sctp_association *);
155163953Srrs
156221627Stuexenvoid sctp_send_sack(struct sctp_tcb *, int);
157163953Srrs
158224641Stuexenvoid sctp_send_hb(struct sctp_tcb *, struct sctp_nets *, int);
159163953Srrs
160163953Srrsvoid sctp_send_ecn_echo(struct sctp_tcb *, struct sctp_nets *, uint32_t);
161163953Srrs
162163953Srrs
163163953Srrsvoid
164163953Srrssctp_send_packet_dropped(struct sctp_tcb *, struct sctp_nets *, struct mbuf *,
165237542Stuexen    int, int, int);
166163953Srrs
167163953Srrs
168163953Srrs
169218072Srrsvoid sctp_send_cwr(struct sctp_tcb *, struct sctp_nets *, uint32_t, uint8_t);
170163953Srrs
171163953Srrs
172163953Srrsvoid
173285792Srrs     sctp_add_stream_reset_result(struct sctp_tmit_chunk *, uint32_t, uint32_t);
174163953Srrs
175163953Srrsvoid
176285792Srrssctp_send_deferred_reset_response(struct sctp_tcb *,
177285792Srrs    struct sctp_stream_reset_list *,
178285792Srrs    int);
179163953Srrs
180163953Srrsvoid
181240826Stuexensctp_add_stream_reset_result_tsn(struct sctp_tmit_chunk *,
182240826Stuexen    uint32_t, uint32_t, uint32_t, uint32_t);
183285792Srrsint
184285792Srrs    sctp_send_stream_reset_out_if_possible(struct sctp_tcb *);
185163953Srrs
186163953Srrsint
187285792Srrssctp_send_str_reset_req(struct sctp_tcb *, uint16_t, uint16_t *,
188272751Stuexen    uint8_t, uint8_t, uint8_t, uint16_t, uint16_t, uint8_t);
189163953Srrs
190163953Srrsvoid
191237715Stuexensctp_send_abort(struct mbuf *, int, struct sockaddr *, struct sockaddr *,
192237715Stuexen    struct sctphdr *, uint32_t, struct mbuf *,
193284515Stuexen    uint8_t, uint32_t, uint16_t,
194237049Stuexen    uint32_t, uint16_t);
195163953Srrs
196236956Stuexenvoid
197237715Stuexensctp_send_operr_to(struct sockaddr *, struct sockaddr *,
198237715Stuexen    struct sctphdr *, uint32_t, struct mbuf *,
199284515Stuexen    uint8_t, uint32_t, uint16_t,
200237049Stuexen    uint32_t, uint16_t);
201163953Srrs
202180387Srrs#endif				/* _KERNEL || __Userspace__ */
203180387Srrs
204237049Stuexen#if defined(_KERNEL) || defined(__Userspace__)
205163953Srrsint
206163953Srrssctp_sosend(struct socket *so,
207163953Srrs    struct sockaddr *addr,
208163953Srrs    struct uio *uio,
209163953Srrs    struct mbuf *top,
210163953Srrs    struct mbuf *control,
211163953Srrs    int flags,
212163953Srrs    struct thread *p
213163953Srrs);
214163953Srrs
215163953Srrs#endif
216163953Srrs#endif
217