1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/netwerk/sctp/src/netinet/sctp_indata.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,131 @@ 1.4 +/*- 1.5 + * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved. 1.6 + * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. 1.7 + * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. 1.8 + * 1.9 + * Redistribution and use in source and binary forms, with or without 1.10 + * modification, are permitted provided that the following conditions are met: 1.11 + * 1.12 + * a) Redistributions of source code must retain the above copyright notice, 1.13 + * this list of conditions and the following disclaimer. 1.14 + * 1.15 + * b) Redistributions in binary form must reproduce the above copyright 1.16 + * notice, this list of conditions and the following disclaimer in 1.17 + * the documentation and/or other materials provided with the distribution. 1.18 + * 1.19 + * c) Neither the name of Cisco Systems, Inc. nor the names of its 1.20 + * contributors may be used to endorse or promote products derived 1.21 + * from this software without specific prior written permission. 1.22 + * 1.23 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 1.24 + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 1.25 + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1.26 + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 1.27 + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 1.28 + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 1.29 + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 1.30 + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 1.31 + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 1.32 + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 1.33 + * THE POSSIBILITY OF SUCH DAMAGE. 1.34 + */ 1.35 + 1.36 +#ifdef __FreeBSD__ 1.37 +#include <sys/cdefs.h> 1.38 +__FBSDID("$FreeBSD: head/sys/netinet/sctp_indata.h 252585 2013-07-03 18:48:43Z tuexen $"); 1.39 +#endif 1.40 + 1.41 +#ifndef _NETINET_SCTP_INDATA_H_ 1.42 +#define _NETINET_SCTP_INDATA_H_ 1.43 + 1.44 +#if defined(_KERNEL) || defined(__Userspace__) 1.45 + 1.46 +struct sctp_queued_to_read * 1.47 +sctp_build_readq_entry(struct sctp_tcb *stcb, 1.48 + struct sctp_nets *net, 1.49 + uint32_t tsn, uint32_t ppid, 1.50 + uint32_t context, uint16_t stream_no, 1.51 + uint16_t stream_seq, uint8_t flags, 1.52 + struct mbuf *dm); 1.53 + 1.54 + 1.55 +#define sctp_build_readq_entry_mac(_ctl, in_it, context, net, tsn, ppid, stream_no, stream_seq, flags, dm) do { \ 1.56 + if (_ctl) { \ 1.57 + atomic_add_int(&((net)->ref_count), 1); \ 1.58 + (_ctl)->sinfo_stream = stream_no; \ 1.59 + (_ctl)->sinfo_ssn = stream_seq; \ 1.60 + (_ctl)->sinfo_flags = (flags << 8); \ 1.61 + (_ctl)->sinfo_ppid = ppid; \ 1.62 + (_ctl)->sinfo_context = context; \ 1.63 + (_ctl)->sinfo_timetolive = 0; \ 1.64 + (_ctl)->sinfo_tsn = tsn; \ 1.65 + (_ctl)->sinfo_cumtsn = tsn; \ 1.66 + (_ctl)->sinfo_assoc_id = sctp_get_associd((in_it)); \ 1.67 + (_ctl)->length = 0; \ 1.68 + (_ctl)->held_length = 0; \ 1.69 + (_ctl)->whoFrom = net; \ 1.70 + (_ctl)->data = dm; \ 1.71 + (_ctl)->tail_mbuf = NULL; \ 1.72 + (_ctl)->aux_data = NULL; \ 1.73 + (_ctl)->stcb = (in_it); \ 1.74 + (_ctl)->port_from = (in_it)->rport; \ 1.75 + (_ctl)->spec_flags = 0; \ 1.76 + (_ctl)->do_not_ref_stcb = 0; \ 1.77 + (_ctl)->end_added = 0; \ 1.78 + (_ctl)->pdapi_aborted = 0; \ 1.79 + (_ctl)->some_taken = 0; \ 1.80 + } \ 1.81 +} while (0) 1.82 + 1.83 + 1.84 + 1.85 +struct mbuf * 1.86 +sctp_build_ctl_nchunk(struct sctp_inpcb *inp, 1.87 + struct sctp_sndrcvinfo *sinfo); 1.88 + 1.89 +void sctp_set_rwnd(struct sctp_tcb *, struct sctp_association *); 1.90 + 1.91 +uint32_t 1.92 +sctp_calc_rwnd(struct sctp_tcb *stcb, struct sctp_association *asoc); 1.93 + 1.94 +void 1.95 +sctp_express_handle_sack(struct sctp_tcb *stcb, uint32_t cumack, 1.96 + uint32_t rwnd, int *abort_now, int ecne_seen); 1.97 + 1.98 +void 1.99 +sctp_handle_sack(struct mbuf *m, int offset_seg, int offset_dup, 1.100 + struct sctp_tcb *stcb, 1.101 + uint16_t num_seg, uint16_t num_nr_seg, uint16_t num_dup, 1.102 + int *abort_now, uint8_t flags, 1.103 + uint32_t cum_ack, uint32_t rwnd, int ecne_seen); 1.104 + 1.105 +/* draft-ietf-tsvwg-usctp */ 1.106 +void 1.107 +sctp_handle_forward_tsn(struct sctp_tcb *, 1.108 + struct sctp_forward_tsn_chunk *, int *, struct mbuf *, int); 1.109 + 1.110 +struct sctp_tmit_chunk * 1.111 +sctp_try_advance_peer_ack_point(struct sctp_tcb *, struct sctp_association *); 1.112 + 1.113 +void sctp_service_queues(struct sctp_tcb *, struct sctp_association *); 1.114 + 1.115 +void 1.116 +sctp_update_acked(struct sctp_tcb *, struct sctp_shutdown_chunk *, int *); 1.117 + 1.118 +int 1.119 +sctp_process_data(struct mbuf **, int, int *, int, 1.120 + struct sockaddr *src, struct sockaddr *dst, 1.121 + struct sctphdr *, 1.122 + struct sctp_inpcb *, struct sctp_tcb *, 1.123 + struct sctp_nets *, uint32_t *, 1.124 +#if defined(__FreeBSD__) 1.125 + uint8_t, uint32_t, 1.126 +#endif 1.127 + uint32_t, uint16_t); 1.128 + 1.129 +void sctp_slide_mapping_arrays(struct sctp_tcb *stcb); 1.130 + 1.131 +void sctp_sack_check(struct sctp_tcb *, int); 1.132 + 1.133 +#endif 1.134 +#endif