xref: /freebsd/sys/netinet/sctp_output.h (revision f8829a4a404303ef77960af851396ac0f7af505b)
1f8829a4aSRandall Stewart /*-
2f8829a4aSRandall Stewart  * Copyright (c) 2001-2006, Cisco Systems, Inc. All rights reserved.
3f8829a4aSRandall Stewart  *
4f8829a4aSRandall Stewart  * Redistribution and use in source and binary forms, with or without
5f8829a4aSRandall Stewart  * modification, are permitted provided that the following conditions are met:
6f8829a4aSRandall Stewart  *
7f8829a4aSRandall Stewart  * a) Redistributions of source code must retain the above copyright notice,
8f8829a4aSRandall Stewart  *   this list of conditions and the following disclaimer.
9f8829a4aSRandall Stewart  *
10f8829a4aSRandall Stewart  * b) Redistributions in binary form must reproduce the above copyright
11f8829a4aSRandall Stewart  *    notice, this list of conditions and the following disclaimer in
12f8829a4aSRandall Stewart  *   the documentation and/or other materials provided with the distribution.
13f8829a4aSRandall Stewart  *
14f8829a4aSRandall Stewart  * c) Neither the name of Cisco Systems, Inc. nor the names of its
15f8829a4aSRandall Stewart  *    contributors may be used to endorse or promote products derived
16f8829a4aSRandall Stewart  *    from this software without specific prior written permission.
17f8829a4aSRandall Stewart  *
18f8829a4aSRandall Stewart  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19f8829a4aSRandall Stewart  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
20f8829a4aSRandall Stewart  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21f8829a4aSRandall Stewart  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
22f8829a4aSRandall Stewart  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23f8829a4aSRandall Stewart  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24f8829a4aSRandall Stewart  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25f8829a4aSRandall Stewart  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26f8829a4aSRandall Stewart  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27f8829a4aSRandall Stewart  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
28f8829a4aSRandall Stewart  * THE POSSIBILITY OF SUCH DAMAGE.
29f8829a4aSRandall Stewart  */
30f8829a4aSRandall Stewart 
31f8829a4aSRandall Stewart /* $KAME: sctp_output.h,v 1.14 2005/03/06 16:04:18 itojun Exp $	 */
32f8829a4aSRandall Stewart 
33f8829a4aSRandall Stewart #include <sys/cdefs.h>
34f8829a4aSRandall Stewart __FBSDID("$FreeBSD$");
35f8829a4aSRandall Stewart 
36f8829a4aSRandall Stewart #ifndef __sctp_output_h__
37f8829a4aSRandall Stewart #define __sctp_output_h__
38f8829a4aSRandall Stewart 
39f8829a4aSRandall Stewart 
40f8829a4aSRandall Stewart 
41f8829a4aSRandall Stewart 
42f8829a4aSRandall Stewart #include <netinet/sctp_header.h>
43f8829a4aSRandall Stewart 
44f8829a4aSRandall Stewart 
45f8829a4aSRandall Stewart 
46f8829a4aSRandall Stewart #if defined(_KERNEL)
47f8829a4aSRandall Stewart void sctp_send_initiate(struct sctp_inpcb *, struct sctp_tcb *);
48f8829a4aSRandall Stewart 
49f8829a4aSRandall Stewart void
50f8829a4aSRandall Stewart sctp_send_initiate_ack(struct sctp_inpcb *, struct sctp_tcb *,
51f8829a4aSRandall Stewart     struct mbuf *, int, int, struct sctphdr *, struct sctp_init_chunk *);
52f8829a4aSRandall Stewart 
53f8829a4aSRandall Stewart struct mbuf *
54f8829a4aSRandall Stewart sctp_arethere_unrecognized_parameters(struct mbuf *, int, int *,
55f8829a4aSRandall Stewart     struct sctp_chunkhdr *);
56f8829a4aSRandall Stewart void sctp_queue_op_err(struct sctp_tcb *, struct mbuf *);
57f8829a4aSRandall Stewart 
58f8829a4aSRandall Stewart int
59f8829a4aSRandall Stewart sctp_send_cookie_echo(struct mbuf *, int, struct sctp_tcb *,
60f8829a4aSRandall Stewart     struct sctp_nets *);
61f8829a4aSRandall Stewart int sctp_send_cookie_ack(struct sctp_tcb *);
62f8829a4aSRandall Stewart 
63f8829a4aSRandall Stewart void
64f8829a4aSRandall Stewart sctp_send_heartbeat_ack(struct sctp_tcb *, struct mbuf *, int, int,
65f8829a4aSRandall Stewart     struct sctp_nets *);
66f8829a4aSRandall Stewart 
67f8829a4aSRandall Stewart 
68f8829a4aSRandall Stewart int sctp_send_shutdown(struct sctp_tcb *, struct sctp_nets *);
69f8829a4aSRandall Stewart 
70f8829a4aSRandall Stewart int sctp_send_shutdown_ack(struct sctp_tcb *, struct sctp_nets *);
71f8829a4aSRandall Stewart 
72f8829a4aSRandall Stewart int sctp_send_shutdown_complete(struct sctp_tcb *, struct sctp_nets *);
73f8829a4aSRandall Stewart 
74f8829a4aSRandall Stewart int sctp_send_shutdown_complete2(struct mbuf *, int, struct sctphdr *);
75f8829a4aSRandall Stewart 
76f8829a4aSRandall Stewart int sctp_send_asconf(struct sctp_tcb *, struct sctp_nets *);
77f8829a4aSRandall Stewart 
78f8829a4aSRandall Stewart int sctp_send_asconf_ack(struct sctp_tcb *, uint32_t);
79f8829a4aSRandall Stewart 
80f8829a4aSRandall Stewart int sctp_get_frag_point(struct sctp_tcb *, struct sctp_association *);
81f8829a4aSRandall Stewart 
82f8829a4aSRandall Stewart void sctp_toss_old_cookies(struct sctp_tcb *, struct sctp_association *);
83f8829a4aSRandall Stewart 
84f8829a4aSRandall Stewart void sctp_toss_old_asconf(struct sctp_tcb *);
85f8829a4aSRandall Stewart 
86f8829a4aSRandall Stewart void sctp_fix_ecn_echo(struct sctp_association *);
87f8829a4aSRandall Stewart 
88f8829a4aSRandall Stewart int
89f8829a4aSRandall Stewart sctp_output(struct sctp_inpcb *, struct mbuf *, struct sockaddr *,
90f8829a4aSRandall Stewart     struct mbuf *, struct thread *, int);
91f8829a4aSRandall Stewart 
92f8829a4aSRandall Stewart 
93f8829a4aSRandall Stewart void
94f8829a4aSRandall Stewart sctp_insert_on_wheel(struct sctp_tcb *stcb,
95f8829a4aSRandall Stewart     struct sctp_association *asoc,
96f8829a4aSRandall Stewart     struct sctp_stream_out *strq, int holdslock);
97f8829a4aSRandall Stewart 
98f8829a4aSRandall Stewart int sctp_chunk_output(struct sctp_inpcb *, struct sctp_tcb *, int);
99f8829a4aSRandall Stewart void sctp_send_abort_tcb(struct sctp_tcb *, struct mbuf *);
100f8829a4aSRandall Stewart 
101f8829a4aSRandall Stewart void send_forward_tsn(struct sctp_tcb *, struct sctp_association *);
102f8829a4aSRandall Stewart 
103f8829a4aSRandall Stewart void sctp_send_sack(struct sctp_tcb *);
104f8829a4aSRandall Stewart 
105f8829a4aSRandall Stewart int sctp_send_hb(struct sctp_tcb *, int, struct sctp_nets *);
106f8829a4aSRandall Stewart 
107f8829a4aSRandall Stewart void sctp_send_ecn_echo(struct sctp_tcb *, struct sctp_nets *, uint32_t);
108f8829a4aSRandall Stewart 
109f8829a4aSRandall Stewart 
110f8829a4aSRandall Stewart void
111f8829a4aSRandall Stewart sctp_send_packet_dropped(struct sctp_tcb *, struct sctp_nets *, struct mbuf *,
112f8829a4aSRandall Stewart     int, int);
113f8829a4aSRandall Stewart 
114f8829a4aSRandall Stewart 
115f8829a4aSRandall Stewart 
116f8829a4aSRandall Stewart void sctp_send_cwr(struct sctp_tcb *, struct sctp_nets *, uint32_t);
117f8829a4aSRandall Stewart 
118f8829a4aSRandall Stewart 
119f8829a4aSRandall Stewart struct mbuf *
120f8829a4aSRandall Stewart sctp_get_mbuf_for_msg(unsigned int space_needed,
121f8829a4aSRandall Stewart     int want_header, int how, int allonebuf, int type);
122f8829a4aSRandall Stewart 
123f8829a4aSRandall Stewart void
124f8829a4aSRandall Stewart sctp_add_stream_reset_out(struct sctp_tmit_chunk *chk,
125f8829a4aSRandall Stewart     int number_entries, uint16_t * list,
126f8829a4aSRandall Stewart     uint32_t seq, uint32_t resp_seq, uint32_t last_sent);
127f8829a4aSRandall Stewart 
128f8829a4aSRandall Stewart void
129f8829a4aSRandall Stewart sctp_add_stream_reset_in(struct sctp_tmit_chunk *chk,
130f8829a4aSRandall Stewart     int number_entries, uint16_t * list,
131f8829a4aSRandall Stewart     uint32_t seq);
132f8829a4aSRandall Stewart 
133f8829a4aSRandall Stewart void
134f8829a4aSRandall Stewart sctp_add_stream_reset_tsn(struct sctp_tmit_chunk *chk,
135f8829a4aSRandall Stewart     uint32_t seq);
136f8829a4aSRandall Stewart 
137f8829a4aSRandall Stewart void
138f8829a4aSRandall Stewart sctp_add_stream_reset_result(struct sctp_tmit_chunk *chk,
139f8829a4aSRandall Stewart     uint32_t resp_seq, uint32_t result);
140f8829a4aSRandall Stewart 
141f8829a4aSRandall Stewart void
142f8829a4aSRandall Stewart sctp_add_stream_reset_result_tsn(struct sctp_tmit_chunk *chk,
143f8829a4aSRandall Stewart     uint32_t resp_seq, uint32_t result,
144f8829a4aSRandall Stewart     uint32_t send_una, uint32_t recv_next);
145f8829a4aSRandall Stewart 
146f8829a4aSRandall Stewart int
147f8829a4aSRandall Stewart sctp_send_str_reset_req(struct sctp_tcb *stcb,
148f8829a4aSRandall Stewart     int number_entries, uint16_t * list,
149f8829a4aSRandall Stewart     uint8_t send_out_req, uint32_t resp_seq,
150f8829a4aSRandall Stewart     uint8_t send_in_req,
151f8829a4aSRandall Stewart     uint8_t send_tsn_req);
152f8829a4aSRandall Stewart 
153f8829a4aSRandall Stewart 
154f8829a4aSRandall Stewart void
155f8829a4aSRandall Stewart sctp_send_abort(struct mbuf *, int, struct sctphdr *, uint32_t,
156f8829a4aSRandall Stewart     struct mbuf *);
157f8829a4aSRandall Stewart 
158f8829a4aSRandall Stewart void sctp_send_operr_to(struct mbuf *, int, struct mbuf *, uint32_t);
159f8829a4aSRandall Stewart 
160f8829a4aSRandall Stewart int
161f8829a4aSRandall Stewart sctp_sosend(struct socket *so,
162f8829a4aSRandall Stewart     struct sockaddr *addr,
163f8829a4aSRandall Stewart     struct uio *uio,
164f8829a4aSRandall Stewart     struct mbuf *top,
165f8829a4aSRandall Stewart     struct mbuf *control,
166f8829a4aSRandall Stewart     int flags,
167f8829a4aSRandall Stewart     struct thread *p
168f8829a4aSRandall Stewart );
169f8829a4aSRandall Stewart 
170f8829a4aSRandall Stewart #endif
171f8829a4aSRandall Stewart #endif
172