xref: /f-stack/freebsd/sys/khelp.h (revision 22ce4aff)
1a9643ea8Slogwang /*-
2*22ce4affSfengbojiang  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3*22ce4affSfengbojiang  *
4a9643ea8Slogwang  * Copyright (c) 2010 Lawrence Stewart <[email protected]>
5a9643ea8Slogwang  * Copyright (c) 2010 The FreeBSD Foundation
6a9643ea8Slogwang  * All rights reserved.
7a9643ea8Slogwang  *
8a9643ea8Slogwang  * This software was developed by Lawrence Stewart while studying at the Centre
9a9643ea8Slogwang  * for Advanced Internet Architectures, Swinburne University of Technology, made
10a9643ea8Slogwang  * possible in part by grants from the FreeBSD Foundation and Cisco University
11a9643ea8Slogwang  * Research Program Fund at Community Foundation Silicon Valley.
12a9643ea8Slogwang  *
13a9643ea8Slogwang  * Portions of this software were developed at the Centre for Advanced
14a9643ea8Slogwang  * Internet Architectures, Swinburne University of Technology, Melbourne,
15a9643ea8Slogwang  * Australia by Lawrence Stewart under sponsorship from the FreeBSD Foundation.
16a9643ea8Slogwang  *
17a9643ea8Slogwang  * Redistribution and use in source and binary forms, with or without
18a9643ea8Slogwang  * modification, are permitted provided that the following conditions
19a9643ea8Slogwang  * are met:
20a9643ea8Slogwang  * 1. Redistributions of source code must retain the above copyright
21a9643ea8Slogwang  *    notice, this list of conditions and the following disclaimer.
22a9643ea8Slogwang  * 2. Redistributions in binary form must reproduce the above copyright
23a9643ea8Slogwang  *    notice, this list of conditions and the following disclaimer in the
24a9643ea8Slogwang  *    documentation and/or other materials provided with the distribution.
25a9643ea8Slogwang  *
26a9643ea8Slogwang  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
27a9643ea8Slogwang  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28a9643ea8Slogwang  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29a9643ea8Slogwang  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
30a9643ea8Slogwang  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31a9643ea8Slogwang  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32a9643ea8Slogwang  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33a9643ea8Slogwang  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34a9643ea8Slogwang  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35a9643ea8Slogwang  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36a9643ea8Slogwang  * SUCH DAMAGE.
37a9643ea8Slogwang  *
38a9643ea8Slogwang  * $FreeBSD$
39a9643ea8Slogwang  */
40a9643ea8Slogwang 
41a9643ea8Slogwang /*
42a9643ea8Slogwang  * A KPI for managing kernel helper modules which perform useful functionality
43a9643ea8Slogwang  * within the kernel. Originally released as part of the NewTCP research project
44a9643ea8Slogwang  * at Swinburne University of Technology's Centre for Advanced Internet
45a9643ea8Slogwang  * Architectures, Melbourne, Australia, which was made possible in part by a
46a9643ea8Slogwang  * grant from the Cisco University Research Program Fund at Community Foundation
47a9643ea8Slogwang  * Silicon Valley. More details are available at:
48a9643ea8Slogwang  *   http://caia.swin.edu.au/urp/newtcp/
49a9643ea8Slogwang  */
50a9643ea8Slogwang 
51a9643ea8Slogwang #ifndef	_SYS_KHELP_H_
52a9643ea8Slogwang #define	_SYS_KHELP_H_
53a9643ea8Slogwang 
54a9643ea8Slogwang struct helper;
55a9643ea8Slogwang struct hookinfo;
56a9643ea8Slogwang struct osd;
57a9643ea8Slogwang 
58a9643ea8Slogwang /* Helper classes. */
59a9643ea8Slogwang #define	HELPER_CLASS_TCP	0x00000001
60a9643ea8Slogwang #define	HELPER_CLASS_SOCKET	0x00000002
61a9643ea8Slogwang 
62a9643ea8Slogwang /* Public KPI functions. */
63a9643ea8Slogwang int	khelp_register_helper(struct helper *h);
64a9643ea8Slogwang 
65a9643ea8Slogwang int	khelp_deregister_helper(struct helper *h);
66a9643ea8Slogwang 
67a9643ea8Slogwang int	khelp_init_osd(uint32_t classes, struct osd *hosd);
68a9643ea8Slogwang 
69a9643ea8Slogwang int	khelp_destroy_osd(struct osd *hosd);
70a9643ea8Slogwang 
71a9643ea8Slogwang void *	khelp_get_osd(struct osd *hosd, int32_t id);
72a9643ea8Slogwang 
73a9643ea8Slogwang int32_t	khelp_get_id(char *hname);
74a9643ea8Slogwang 
75a9643ea8Slogwang int	khelp_add_hhook(struct hookinfo *hki, uint32_t flags);
76a9643ea8Slogwang 
77a9643ea8Slogwang int	khelp_remove_hhook(struct hookinfo *hki);
78a9643ea8Slogwang 
79a9643ea8Slogwang #endif /* _SYS_KHELP_H_ */
80