1215166Slstewart/*- 2215166Slstewart * Copyright (c) 2009-2010 Lawrence Stewart <lstewart@freebsd.org> 3215166Slstewart * All rights reserved. 4215166Slstewart * 5215166Slstewart * This software was developed by Lawrence Stewart while studying at the Centre 6220560Slstewart * for Advanced Internet Architectures, Swinburne University of Technology, made 7220560Slstewart * possible in part by a grant from the Cisco University Research Program Fund 8220560Slstewart * at Community Foundation Silicon Valley. 9215166Slstewart * 10215166Slstewart * Redistribution and use in source and binary forms, with or without 11215166Slstewart * modification, are permitted provided that the following conditions 12215166Slstewart * are met: 13215166Slstewart * 1. Redistributions of source code must retain the above copyright 14215166Slstewart * notice, this list of conditions and the following disclaimer. 15215166Slstewart * 2. Redistributions in binary form must reproduce the above copyright 16215166Slstewart * notice, this list of conditions and the following disclaimer in the 17215166Slstewart * documentation and/or other materials provided with the distribution. 18215166Slstewart * 19215166Slstewart * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 20215166Slstewart * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21215166Slstewart * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22215166Slstewart * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 23215166Slstewart * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24215166Slstewart * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 25215166Slstewart * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26215166Slstewart * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27215166Slstewart * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28215166Slstewart * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29215166Slstewart * SUCH DAMAGE. 30215166Slstewart * 31215166Slstewart * $FreeBSD$ 32215166Slstewart */ 33215166Slstewart 34215166Slstewart/* 35215166Slstewart * This software was first released in 2009 by Lawrence Stewart as part of the 36220560Slstewart * NewTCP research project at Swinburne University of Technology's Centre for 37220560Slstewart * Advanced Internet Architectures, Melbourne, Australia, which was made 38220560Slstewart * possible in part by a grant from the Cisco University Research Program Fund 39220560Slstewart * at Community Foundation Silicon Valley. More details are available at: 40215166Slstewart * http://caia.swin.edu.au/urp/newtcp/ 41215166Slstewart */ 42215166Slstewart 43215166Slstewart#ifndef _NETINET_CC_MODULE_H_ 44215166Slstewart#define _NETINET_CC_MODULE_H_ 45215166Slstewart 46215166Slstewart/* 47215166Slstewart * Allows a CC algorithm to manipulate a commonly named CC variable regardless 48215166Slstewart * of the transport protocol and associated C struct. 49215166Slstewart * XXXLAS: Out of action until the work to support SCTP is done. 50215166Slstewart * 51215166Slstewart#define CCV(ccv, what) \ 52215166Slstewart(*( \ 53215166Slstewart (ccv)->type == IPPROTO_TCP ? &(ccv)->ccvc.tcp->what : \ 54215166Slstewart &(ccv)->ccvc.sctp->what \ 55215166Slstewart)) 56215166Slstewart */ 57215166Slstewart#define CCV(ccv, what) (ccv)->ccvc.tcp->what 58215166Slstewart 59215166Slstewart#define DECLARE_CC_MODULE(ccname, ccalgo) \ 60215166Slstewart static moduledata_t cc_##ccname = { \ 61215166Slstewart .name = #ccname, \ 62215166Slstewart .evhand = cc_modevent, \ 63215166Slstewart .priv = ccalgo \ 64215166Slstewart }; \ 65215166Slstewart DECLARE_MODULE(ccname, cc_##ccname, \ 66215166Slstewart SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY) 67215166Slstewart 68215166Slstewartint cc_modevent(module_t mod, int type, void *data); 69215166Slstewart 70215166Slstewart#endif /* _NETINET_CC_MODULE_H_ */ 71