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