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$"); 35163953Srrs 36235828Stuexen#ifndef _NETINET_SCTP_INDATA_H_ 37235828Stuexen#define _NETINET_SCTP_INDATA_H_ 38163953Srrs 39180387Srrs#if defined(_KERNEL) || defined(__Userspace__) 40163953Srrs 41163953Srrsstruct sctp_queued_to_read * 42163953Srrssctp_build_readq_entry(struct sctp_tcb *stcb, 43163953Srrs struct sctp_nets *net, 44163953Srrs uint32_t tsn, uint32_t ppid, 45163953Srrs uint32_t context, uint16_t stream_no, 46163953Srrs uint16_t stream_seq, uint8_t flags, 47163953Srrs struct mbuf *dm); 48163953Srrs 49163953Srrs 50252585Stuexen#define sctp_build_readq_entry_mac(_ctl, in_it, context, net, tsn, ppid, stream_no, stream_seq, flags, dm) do { \ 51163953Srrs if (_ctl) { \ 52166023Srrs atomic_add_int(&((net)->ref_count), 1); \ 53163953Srrs (_ctl)->sinfo_stream = stream_no; \ 54163953Srrs (_ctl)->sinfo_ssn = stream_seq; \ 55163953Srrs (_ctl)->sinfo_flags = (flags << 8); \ 56163953Srrs (_ctl)->sinfo_ppid = ppid; \ 57252585Stuexen (_ctl)->sinfo_context = context; \ 58163953Srrs (_ctl)->sinfo_timetolive = 0; \ 59163953Srrs (_ctl)->sinfo_tsn = tsn; \ 60163953Srrs (_ctl)->sinfo_cumtsn = tsn; \ 61166023Srrs (_ctl)->sinfo_assoc_id = sctp_get_associd((in_it)); \ 62166023Srrs (_ctl)->length = 0; \ 63166023Srrs (_ctl)->held_length = 0; \ 64163953Srrs (_ctl)->whoFrom = net; \ 65163953Srrs (_ctl)->data = dm; \ 66163953Srrs (_ctl)->tail_mbuf = NULL; \ 67169352Srrs (_ctl)->aux_data = NULL; \ 68166023Srrs (_ctl)->stcb = (in_it); \ 69166023Srrs (_ctl)->port_from = (in_it)->rport; \ 70166023Srrs (_ctl)->spec_flags = 0; \ 71163953Srrs (_ctl)->do_not_ref_stcb = 0; \ 72163953Srrs (_ctl)->end_added = 0; \ 73166023Srrs (_ctl)->pdapi_aborted = 0; \ 74168943Srrs (_ctl)->some_taken = 0; \ 75163953Srrs } \ 76163953Srrs} while (0) 77163953Srrs 78163953Srrs 79163953Srrs 80163953Srrsstruct mbuf * 81163953Srrssctp_build_ctl_nchunk(struct sctp_inpcb *inp, 82163953Srrs struct sctp_sndrcvinfo *sinfo); 83163953Srrs 84163953Srrsvoid sctp_set_rwnd(struct sctp_tcb *, struct sctp_association *); 85163953Srrs 86163953Srrsuint32_t 87163953Srrssctp_calc_rwnd(struct sctp_tcb *stcb, struct sctp_association *asoc); 88163953Srrs 89163953Srrsvoid 90163953Srrssctp_express_handle_sack(struct sctp_tcb *stcb, uint32_t cumack, 91218186Srrs uint32_t rwnd, int *abort_now, int ecne_seen); 92163953Srrs 93163953Srrsvoid 94202526Stuexensctp_handle_sack(struct mbuf *m, int offset_seg, int offset_dup, 95228653Stuexen struct sctp_tcb *stcb, 96202526Stuexen uint16_t num_seg, uint16_t num_nr_seg, uint16_t num_dup, 97202526Stuexen int *abort_now, uint8_t flags, 98218186Srrs uint32_t cum_ack, uint32_t rwnd, int ecne_seen); 99163953Srrs 100163953Srrs/* draft-ietf-tsvwg-usctp */ 101163953Srrsvoid 102163953Srrssctp_handle_forward_tsn(struct sctp_tcb *, 103170992Srrs struct sctp_forward_tsn_chunk *, int *, struct mbuf *, int); 104163953Srrs 105163953Srrsstruct sctp_tmit_chunk * 106163953Srrs sctp_try_advance_peer_ack_point(struct sctp_tcb *, struct sctp_association *); 107163953Srrs 108163953Srrsvoid sctp_service_queues(struct sctp_tcb *, struct sctp_association *); 109163953Srrs 110163953Srrsvoid 111228653Stuexen sctp_update_acked(struct sctp_tcb *, struct sctp_shutdown_chunk *, int *); 112163953Srrs 113163953Srrsint 114237715Stuexensctp_process_data(struct mbuf **, int, int *, int, 115169208Srrs struct sctp_inpcb *, struct sctp_tcb *, 116294147Stuexen struct sctp_nets *, uint32_t *); 117163953Srrs 118206137Stuexenvoid sctp_slide_mapping_arrays(struct sctp_tcb *stcb); 119163953Srrs 120228653Stuexenvoid sctp_sack_check(struct sctp_tcb *, int); 121206137Stuexen 122163953Srrs#endif 123163953Srrs#endif 124