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_indata.h,v 1.9 2005/03/06 16:04:17 itojun Exp $ */ 32f8829a4aSRandall Stewart 33f8829a4aSRandall Stewart #include <sys/cdefs.h> 34f8829a4aSRandall Stewart __FBSDID("$FreeBSD$"); 35f8829a4aSRandall Stewart 36f8829a4aSRandall Stewart #ifndef __sctp_indata_h__ 37f8829a4aSRandall Stewart #define __sctp_indata_h__ 38f8829a4aSRandall Stewart 39f8829a4aSRandall Stewart 40f8829a4aSRandall Stewart 41f8829a4aSRandall Stewart 42f8829a4aSRandall Stewart 43f8829a4aSRandall Stewart #if defined(_KERNEL) 44f8829a4aSRandall Stewart 45f8829a4aSRandall Stewart 46f8829a4aSRandall Stewart struct sctp_queued_to_read * 47f8829a4aSRandall Stewart sctp_build_readq_entry(struct sctp_tcb *stcb, 48f8829a4aSRandall Stewart struct sctp_nets *net, 49f8829a4aSRandall Stewart uint32_t tsn, uint32_t ppid, 50f8829a4aSRandall Stewart uint32_t context, uint16_t stream_no, 51f8829a4aSRandall Stewart uint16_t stream_seq, uint8_t flags, 52f8829a4aSRandall Stewart struct mbuf *dm); 53f8829a4aSRandall Stewart 54f8829a4aSRandall Stewart 55f8829a4aSRandall Stewart #define sctp_build_readq_entry_mac(_ctl, in_it, a, net, tsn, ppid, context, stream_no, stream_seq, flags, dm) do { \ 56f8829a4aSRandall Stewart if (_ctl) { \ 5744b7479bSRandall Stewart atomic_add_int(&((net)->ref_count), 1); \ 58f8829a4aSRandall Stewart (_ctl)->sinfo_stream = stream_no; \ 59f8829a4aSRandall Stewart (_ctl)->sinfo_ssn = stream_seq; \ 60f8829a4aSRandall Stewart (_ctl)->sinfo_flags = (flags << 8); \ 61f8829a4aSRandall Stewart (_ctl)->sinfo_ppid = ppid; \ 6244b7479bSRandall Stewart (_ctl)->sinfo_context = a; \ 63f8829a4aSRandall Stewart (_ctl)->sinfo_timetolive = 0; \ 64f8829a4aSRandall Stewart (_ctl)->sinfo_tsn = tsn; \ 65f8829a4aSRandall Stewart (_ctl)->sinfo_cumtsn = tsn; \ 6644b7479bSRandall Stewart (_ctl)->sinfo_assoc_id = sctp_get_associd((in_it)); \ 67f8829a4aSRandall Stewart (_ctl)->length = 0; \ 6844b7479bSRandall Stewart (_ctl)->held_length = 0; \ 6944b7479bSRandall Stewart (_ctl)->whoFrom = net; \ 70f8829a4aSRandall Stewart (_ctl)->data = dm; \ 71f8829a4aSRandall Stewart (_ctl)->tail_mbuf = NULL; \ 7244b7479bSRandall Stewart (_ctl)->stcb = (in_it); \ 7344b7479bSRandall Stewart (_ctl)->port_from = (in_it)->rport; \ 7444b7479bSRandall Stewart (_ctl)->spec_flags = 0; \ 75f8829a4aSRandall Stewart (_ctl)->do_not_ref_stcb = 0; \ 76f8829a4aSRandall Stewart (_ctl)->end_added = 0; \ 7744b7479bSRandall Stewart (_ctl)->pdapi_aborted = 0; \ 7844b7479bSRandall Stewart (_ctl)->resv = 0; \ 79f8829a4aSRandall Stewart } \ 80f8829a4aSRandall Stewart } while (0) 81f8829a4aSRandall Stewart 82f8829a4aSRandall Stewart 83f8829a4aSRandall Stewart 84f8829a4aSRandall Stewart struct mbuf * 85f8829a4aSRandall Stewart sctp_build_ctl_nchunk(struct sctp_inpcb *inp, 86f8829a4aSRandall Stewart struct sctp_sndrcvinfo *sinfo); 87f8829a4aSRandall Stewart 88f8829a4aSRandall Stewart void sctp_set_rwnd(struct sctp_tcb *, struct sctp_association *); 89f8829a4aSRandall Stewart 90f8829a4aSRandall Stewart uint32_t 91f8829a4aSRandall Stewart sctp_calc_rwnd(struct sctp_tcb *stcb, struct sctp_association *asoc); 92f8829a4aSRandall Stewart 93f8829a4aSRandall Stewart void 94f8829a4aSRandall Stewart sctp_express_handle_sack(struct sctp_tcb *stcb, uint32_t cumack, 95f8829a4aSRandall Stewart uint32_t rwnd, int nonce_sum_flag, int *abort_now); 96f8829a4aSRandall Stewart 97f8829a4aSRandall Stewart void 98f8829a4aSRandall Stewart sctp_handle_sack(struct sctp_sack_chunk *, struct sctp_tcb *, 99f8829a4aSRandall Stewart struct sctp_nets *, int *); 100f8829a4aSRandall Stewart 101f8829a4aSRandall Stewart /* draft-ietf-tsvwg-usctp */ 102f8829a4aSRandall Stewart void 103f8829a4aSRandall Stewart sctp_handle_forward_tsn(struct sctp_tcb *, 104f8829a4aSRandall Stewart struct sctp_forward_tsn_chunk *, int *); 105f8829a4aSRandall Stewart 106f8829a4aSRandall Stewart struct sctp_tmit_chunk * 107f8829a4aSRandall Stewart sctp_try_advance_peer_ack_point(struct sctp_tcb *, struct sctp_association *); 108f8829a4aSRandall Stewart 109f8829a4aSRandall Stewart void sctp_service_queues(struct sctp_tcb *, struct sctp_association *); 110f8829a4aSRandall Stewart 111f8829a4aSRandall Stewart void 112f8829a4aSRandall Stewart sctp_update_acked(struct sctp_tcb *, struct sctp_shutdown_chunk *, 113f8829a4aSRandall Stewart struct sctp_nets *, int *); 114f8829a4aSRandall Stewart 115f8829a4aSRandall Stewart int 116f8829a4aSRandall Stewart sctp_process_data(struct mbuf **, int, int *, int, struct sctphdr *, 117f8829a4aSRandall Stewart struct sctp_inpcb *, struct sctp_tcb *, struct sctp_nets *, uint32_t *); 118f8829a4aSRandall Stewart 119f8829a4aSRandall Stewart void sctp_sack_check(struct sctp_tcb *, int, int, int *); 120f8829a4aSRandall Stewart 121f8829a4aSRandall Stewart #endif 122f8829a4aSRandall Stewart #endif 123