sctp_output.h (8357B)
1 /*- 2 * SPDX-License-Identifier: BSD-3-Clause 3 * 4 * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved. 5 * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. 6 * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions are met: 10 * 11 * a) Redistributions of source code must retain the above copyright notice, 12 * this list of conditions and the following disclaimer. 13 * 14 * b) Redistributions in binary form must reproduce the above copyright 15 * notice, this list of conditions and the following disclaimer in 16 * the documentation and/or other materials provided with the distribution. 17 * 18 * c) Neither the name of Cisco Systems, Inc. nor the names of its 19 * contributors may be used to endorse or promote products derived 20 * from this software without specific prior written permission. 21 * 22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 24 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 26 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 27 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 28 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 29 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 30 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 32 * THE POSSIBILITY OF SUCH DAMAGE. 33 */ 34 35 #ifndef _NETINET_SCTP_OUTPUT_H_ 36 #define _NETINET_SCTP_OUTPUT_H_ 37 38 #include <netinet/sctp_header.h> 39 40 #if defined(_KERNEL) || defined(__Userspace__) 41 42 struct mbuf * 43 sctp_add_addresses_to_i_ia(struct sctp_inpcb *inp, 44 struct sctp_tcb *stcb, 45 struct sctp_scoping *scope, 46 struct mbuf *m_at, 47 int cnt_inits_to, 48 uint16_t *padding_len, uint16_t *chunk_len); 49 50 int sctp_is_addr_restricted(struct sctp_tcb *, struct sctp_ifa *); 51 52 int 53 sctp_is_address_in_scope(struct sctp_ifa *ifa, 54 struct sctp_scoping *scope, 55 int do_update); 56 57 int 58 sctp_is_addr_in_ep(struct sctp_inpcb *inp, struct sctp_ifa *ifa); 59 60 struct sctp_ifa * 61 sctp_source_address_selection(struct sctp_inpcb *inp, 62 struct sctp_tcb *stcb, 63 sctp_route_t *ro, struct sctp_nets *net, 64 int non_asoc_addr_ok, uint32_t vrf_id); 65 66 #if defined(__FreeBSD__) || defined(__APPLE__) || defined(__Userspace__) 67 int sctp_v6src_match_nexthop(struct sockaddr_in6 *src6, sctp_route_t *ro); 68 69 int sctp_v4src_match_nexthop(struct sctp_ifa *sifa, sctp_route_t *ro); 70 #endif 71 72 void sctp_send_initiate(struct sctp_inpcb *, struct sctp_tcb *, int); 73 74 void 75 sctp_send_initiate_ack(struct sctp_inpcb *, struct sctp_tcb *, 76 struct sctp_nets *, struct mbuf *, 77 int, int, 78 struct sockaddr *, struct sockaddr *, 79 struct sctphdr *, struct sctp_init_chunk *, 80 #if defined(__FreeBSD__) && !defined(__Userspace__) 81 uint8_t, uint32_t, 82 #endif 83 uint32_t, uint16_t); 84 85 struct mbuf * 86 sctp_arethere_unrecognized_parameters(struct mbuf *, int, int *, 87 struct sctp_chunkhdr *, int *, int *, 88 uint32_t *); 89 90 void sctp_queue_op_err(struct sctp_tcb *, struct mbuf *); 91 92 int 93 sctp_send_cookie_echo(struct mbuf *, int, int, struct sctp_tcb *, 94 struct sctp_nets *); 95 96 void sctp_send_cookie_ack(struct sctp_tcb *); 97 98 void 99 sctp_send_heartbeat_ack(struct sctp_tcb *, struct mbuf *, int, int, 100 struct sctp_nets *); 101 102 void 103 sctp_remove_from_wheel(struct sctp_tcb *stcb, 104 struct sctp_association *asoc, 105 struct sctp_stream_out *strq, int holds_lock); 106 107 void sctp_send_shutdown(struct sctp_tcb *, struct sctp_nets *); 108 109 void sctp_send_shutdown_ack(struct sctp_tcb *, struct sctp_nets *); 110 111 void sctp_send_shutdown_complete(struct sctp_tcb *, struct sctp_nets *, int); 112 113 void sctp_send_shutdown_complete2(struct sockaddr *, struct sockaddr *, 114 struct sctphdr *, 115 #if defined(__FreeBSD__) && !defined(__Userspace__) 116 uint8_t, uint32_t, uint16_t, 117 #endif 118 uint32_t, uint16_t); 119 120 void sctp_send_asconf(struct sctp_tcb *, struct sctp_nets *, int addr_locked); 121 122 void sctp_send_asconf_ack(struct sctp_tcb *); 123 124 uint32_t sctp_get_frag_point(struct sctp_tcb *); 125 126 void sctp_toss_old_cookies(struct sctp_tcb *, struct sctp_association *); 127 128 void sctp_toss_old_asconf(struct sctp_tcb *); 129 130 void sctp_fix_ecn_echo(struct sctp_association *); 131 132 void sctp_move_chunks_from_net(struct sctp_tcb *stcb, struct sctp_nets *net); 133 134 #define SCTP_DATA_CHUNK_OVERHEAD(stcb) ((stcb)->asoc.idata_supported ? \ 135 sizeof(struct sctp_idata_chunk) : \ 136 sizeof(struct sctp_data_chunk)) 137 138 #if defined(__FreeBSD__) && !defined(__Userspace__) 139 int 140 sctp_output(struct sctp_inpcb *, struct mbuf *, struct sockaddr *, 141 struct mbuf *, struct thread *, int); 142 #elif defined(_WIN32) && !defined(__Userspace__) 143 sctp_output(struct sctp_inpcb *, struct mbuf *, struct sockaddr *, 144 struct mbuf *, PKTHREAD, int); 145 #else 146 #if defined(__Userspace__) 147 /* sctp_output is called bu sctp_sendm. Not using sctp_sendm for __Userspace__ */ 148 #endif 149 int 150 sctp_output(struct sctp_inpcb *, 151 struct mbuf *, 152 struct sockaddr *, 153 struct mbuf *, 154 struct proc *, int); 155 #endif 156 157 void sctp_chunk_output(struct sctp_inpcb *, struct sctp_tcb *, int, int); 158 159 void sctp_send_abort_tcb(struct sctp_tcb *, struct mbuf *, int); 160 161 void send_forward_tsn(struct sctp_tcb *, struct sctp_association *); 162 163 void sctp_send_sack(struct sctp_tcb *, int); 164 165 void sctp_send_hb(struct sctp_tcb *, struct sctp_nets *, int); 166 167 void sctp_send_ecn_echo(struct sctp_tcb *, struct sctp_nets *, uint32_t); 168 169 void 170 sctp_send_packet_dropped(struct sctp_tcb *, struct sctp_nets *, struct mbuf *, 171 int, int, int); 172 173 void sctp_send_cwr(struct sctp_tcb *, struct sctp_nets *, uint32_t, uint8_t); 174 175 void 176 sctp_add_stream_reset_result(struct sctp_tmit_chunk *, uint32_t, uint32_t); 177 178 void 179 sctp_send_deferred_reset_response(struct sctp_tcb *, 180 struct sctp_stream_reset_list *, 181 int); 182 183 void 184 sctp_add_stream_reset_result_tsn(struct sctp_tmit_chunk *, 185 uint32_t, uint32_t, uint32_t, uint32_t); 186 int 187 sctp_send_stream_reset_out_if_possible(struct sctp_tcb *, int); 188 189 int 190 sctp_send_str_reset_req(struct sctp_tcb *, uint16_t , uint16_t *, 191 uint8_t, uint8_t, uint8_t, uint16_t, uint16_t, uint8_t); 192 193 void 194 sctp_send_abort(struct mbuf *, int, struct sockaddr *, struct sockaddr *, 195 struct sctphdr *, uint32_t, struct mbuf *, 196 #if defined(__FreeBSD__) && !defined(__Userspace__) 197 uint8_t, uint32_t, uint16_t, 198 #endif 199 uint32_t, uint16_t); 200 201 void 202 sctp_send_operr_to(struct sockaddr *, struct sockaddr *, 203 struct sctphdr *, uint32_t, struct mbuf *, 204 #if defined(__FreeBSD__) && !defined(__Userspace__) 205 uint8_t, uint32_t, uint16_t, 206 #endif 207 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 #if defined(__APPLE__) && !defined(__Userspace__) 219 int flags 220 #else 221 int flags, 222 #if defined(__FreeBSD__) && !defined(__Userspace__) 223 struct thread *p 224 #elif defined(_WIN32) && !defined(__Userspace__) 225 PKTHREAD p 226 #else 227 #if defined(__Userspace__) 228 /* proc is a dummy in __Userspace__ and will not be passed to sctp_lower_sosend */ 229 #endif 230 struct proc *p 231 #endif 232 #endif 233 ); 234 235 #endif 236 #endif