xref: /freebsd-src/sys/netinet/cc/cc_module.h (revision 00d3b74406db80084e8939450c6b86326dd1de30)
1dbc42409SLawrence Stewart /*-
24d846d26SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause
3fe267a55SPedro F. Giffuni  *
4dbc42409SLawrence Stewart  * Copyright (c) 2009-2010 Lawrence Stewart <lstewart@freebsd.org>
5dbc42409SLawrence Stewart  * All rights reserved.
6dbc42409SLawrence Stewart  *
7dbc42409SLawrence Stewart  * This software was developed by Lawrence Stewart while studying at the Centre
8891b8ed4SLawrence Stewart  * for Advanced Internet Architectures, Swinburne University of Technology, made
9891b8ed4SLawrence Stewart  * possible in part by a grant from the Cisco University Research Program Fund
10891b8ed4SLawrence Stewart  * at Community Foundation Silicon Valley.
11dbc42409SLawrence Stewart  *
12dbc42409SLawrence Stewart  * Redistribution and use in source and binary forms, with or without
13dbc42409SLawrence Stewart  * modification, are permitted provided that the following conditions
14dbc42409SLawrence Stewart  * are met:
15dbc42409SLawrence Stewart  * 1. Redistributions of source code must retain the above copyright
16dbc42409SLawrence Stewart  *    notice, this list of conditions and the following disclaimer.
17dbc42409SLawrence Stewart  * 2. Redistributions in binary form must reproduce the above copyright
18dbc42409SLawrence Stewart  *    notice, this list of conditions and the following disclaimer in the
19dbc42409SLawrence Stewart  *    documentation and/or other materials provided with the distribution.
20dbc42409SLawrence Stewart  *
21dbc42409SLawrence Stewart  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
22dbc42409SLawrence Stewart  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23dbc42409SLawrence Stewart  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24dbc42409SLawrence Stewart  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
25dbc42409SLawrence Stewart  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26dbc42409SLawrence Stewart  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27dbc42409SLawrence Stewart  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28dbc42409SLawrence Stewart  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29dbc42409SLawrence Stewart  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30dbc42409SLawrence Stewart  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31dbc42409SLawrence Stewart  * SUCH DAMAGE.
32dbc42409SLawrence Stewart  */
33dbc42409SLawrence Stewart 
34dbc42409SLawrence Stewart /*
35dbc42409SLawrence Stewart  * This software was first released in 2009 by Lawrence Stewart as part of the
36891b8ed4SLawrence Stewart  * NewTCP research project at Swinburne University of Technology's Centre for
37891b8ed4SLawrence Stewart  * Advanced Internet Architectures, Melbourne, Australia, which was made
38891b8ed4SLawrence Stewart  * possible in part by a grant from the Cisco University Research Program Fund
39891b8ed4SLawrence Stewart  * at Community Foundation Silicon Valley. More details are available at:
40dbc42409SLawrence Stewart  *   http://caia.swin.edu.au/urp/newtcp/
41dbc42409SLawrence Stewart  */
42dbc42409SLawrence Stewart 
43dbc42409SLawrence Stewart #ifndef _NETINET_CC_MODULE_H_
44dbc42409SLawrence Stewart #define _NETINET_CC_MODULE_H_
45dbc42409SLawrence Stewart 
46*00d3b744SMichael Tuexen #define	CCV(ccv, what) (ccv)->tp->what
47dbc42409SLawrence Stewart 
48dbc42409SLawrence Stewart #define	DECLARE_CC_MODULE(ccname, ccalgo) 				\
49dbc42409SLawrence Stewart 	static moduledata_t cc_##ccname = {				\
50dbc42409SLawrence Stewart 		.name = #ccname,					\
51dbc42409SLawrence Stewart 		.evhand = cc_modevent,					\
52dbc42409SLawrence Stewart 		.priv = ccalgo						\
53dbc42409SLawrence Stewart 	};								\
54dbc42409SLawrence Stewart 	DECLARE_MODULE(ccname, cc_##ccname,				\
55dbc42409SLawrence Stewart 	    SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY)
56dbc42409SLawrence Stewart 
57dbc42409SLawrence Stewart int	cc_modevent(module_t mod, int type, void *data);
58dbc42409SLawrence Stewart 
59dbc42409SLawrence Stewart #endif /* _NETINET_CC_MODULE_H_ */
60