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. --- 17 unchanged lines hidden (view full) --- 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_var.h,v 1.24 2005/03/06 16:04:19 itojun Exp $ */ 32 33#include <sys/cdefs.h> |
34__FBSDID("$FreeBSD: head/sys/netinet/sctp_var.h 167598 2007-03-15 11:27:14Z rrs $"); |
35 36#ifndef _NETINET_SCTP_VAR_H_ 37#define _NETINET_SCTP_VAR_H_ 38 |
39#include <netinet/sctp_uio.h> 40 |
41#if defined(_KERNEL) 42 |
43extern struct pr_usrreqs sctp_usrreqs; 44 45 46#define sctp_feature_on(inp, feature) (inp->sctp_features |= feature) 47#define sctp_feature_off(inp, feature) (inp->sctp_features &= ~feature) 48#define sctp_is_feature_on(inp, feature) (inp->sctp_features & feature) 49#define sctp_is_feature_off(inp, feature) ((inp->sctp_features & feature) == 0) 50 51#define sctp_sbspace(asoc, sb) ((long) (((sb)->sb_hiwat > (asoc)->sb_cc) ? ((sb)->sb_hiwat - (asoc)->sb_cc) : 0)) 52 53#define sctp_sbspace_failedmsgs(sb) ((long) (((sb)->sb_hiwat > (sb)->sb_cc) ? ((sb)->sb_hiwat - (sb)->sb_cc) : 0)) 54 55#define sctp_sbspace_sub(a,b) ((a > b) ? (a - b) : 0) 56 |
57/* 58 * I tried to cache the readq entries at one point. But the reality 59 * is that it did not add any performance since this meant we had to 60 * lock the STCB on read. And at that point once you have to do an 61 * extra lock, it really does not matter if the lock is in the ZONE 62 * stuff or in our code. Note that this same problem would occur with 63 * an mbuf cache as well so it is not really worth doing, at least 64 * right now :-D |
65 */ 66 67#define sctp_free_a_readq(_stcb, _readq) { \ 68 SCTP_ZONE_FREE(sctppcbinfo.ipi_zone_readq, (_readq)); \ 69 SCTP_DECR_READQ_COUNT(); \ 70} 71 72#define sctp_alloc_a_readq(_stcb, _readq) { \ --- 54 unchanged lines hidden (view full) --- 127 atomic_subtract_int(&sctppcbinfo.ipi_free_chunks, 1); \ 128 (_stcb)->asoc.free_chunk_cnt--; \ 129 } \ 130} 131 132 133 134#define sctp_free_remote_addr(__net) { \ |
135 if ((__net)) { \ |
136 if (atomic_fetchadd_int(&(__net)->ref_count, -1) == 1) { \ 137 SCTP_OS_TIMER_STOP(&(__net)->rxt_timer.timer); \ 138 SCTP_OS_TIMER_STOP(&(__net)->pmtu_timer.timer); \ 139 SCTP_OS_TIMER_STOP(&(__net)->fr_timer.timer); \ |
140 if ((__net)->ro.ro_rt) { \ 141 RTFREE((__net)->ro.ro_rt); \ 142 (__net)->ro.ro_rt = NULL; \ 143 } \ 144 if ((__net)->src_addr_selected) { \ 145 sctp_free_ifa((__net)->ro._s_addr); \ 146 (__net)->ro._s_addr = NULL; \ 147 } \ 148 (__net)->src_addr_selected = 0; \ |
149 (__net)->dest_state = SCTP_ADDR_NOT_REACHABLE; \ 150 SCTP_ZONE_FREE(sctppcbinfo.ipi_zone_net, (__net)); \ 151 SCTP_DECR_RADDR_COUNT(); \ 152 } \ 153 } \ 154} 155 156#define sctp_sbfree(ctl, stcb, sb, m) { \ --- 70 unchanged lines hidden (view full) --- 227 (data) = SCTP_BUF_NEXT(_m); \ 228 SCTP_BUF_NEXT(_m) = NULL; \ 229 sctp_m_free(_m); \ 230 _m = (data); \ 231 } \ 232} while (0) 233 234 |
235struct sctp_nets; 236struct sctp_inpcb; 237struct sctp_tcb; 238struct sctphdr; 239 240void sctp_ctlinput __P((int, struct sockaddr *, void *)); 241int sctp_ctloutput __P((struct socket *, struct sockopt *)); 242void sctp_input __P((struct mbuf *, int)); |
243void sctp_drain __P((void)); 244void sctp_init __P((void)); 245 246 247void sctp_pcbinfo_cleanup(void); 248 249int sctp_shutdown __P((struct socket *)); 250void sctp_notify --- 22 unchanged lines hidden (view full) --- 273 int sctp_peeraddr(struct socket *, 274 struct sockaddr ** 275); 276 277 int sctp_listen(struct socket *, int, struct thread *); 278 279 int sctp_accept(struct socket *, struct sockaddr **); 280 |
281#endif /* _KERNEL */ 282 283#endif /* !_NETINET_SCTP_VAR_H_ */ |