xref: /haiku/src/add-ons/kernel/network/ppp/shared/libkernelppp/headers/KPPPModule.h (revision bc3955fea5b07e2e94a27fc05e4bb58fe6f0319b)
1 /*
2  * Copyright 2003-2004, Haiku Inc.
3  * Distributed under the terms of the MIT License.
4  */
5 
6 #ifndef _K_PPP_MODULE__H
7 #define _K_PPP_MODULE__H
8 
9 #include <module.h>
10 
11 class KPPPInterface;
12 
13 
14 //!	This structure is exported by PPP kernel modules.
15 typedef struct ppp_module_info {
16 	module_info minfo;
17 		//!< Default kernel module structure.
18 
19 	//!	You may define this \e optional function if you want to export a private API.
20 	status_t (*control)(uint32 op, void *data, size_t length);
21 
22 	/*!	\brief Signals your module to add its handlers to the PPP interface.
23 
24 		This function \e must be exported.
25 
26 		Multilink-only: Handlers that must run on a bundle's child should be
27 		added to \a subInterface while \a mainInterface handlers are used for the
28 		bundle interfaces. For example, devices must be added to every child
29 		individually because every \a subInterface establishes its own connection
30 		while the IP Control Protocol is added to the \a mainInterface because
31 		it is shared by all interfaces of the bundle.
32 
33 		\param mainInterface The multilink bundle or (if subInterface == NULL) the
34 				actual interface object.
35 		\param subInterface If defined, this is a child interface of a bundle.
36 		\param settings The settings for your module.
37 		\param type Specifies which key caused loading the module. This would be
38 				\c PPP_AUTHENTICATOR_KEY_TYPE for "authenticator". You should check
39 				if \a type is correct (e.g.: loading an authenticator with "device"
40 				should fail).
41 
42 		\return
43 			\c true: Modules could be added successfully.
44 	*/
45 	bool (*add_to)(KPPPInterface& mainInterface, KPPPInterface *subInterface,
46 		driver_parameter *settings, ppp_module_key_type type);
47 } ppp_module_info;
48 
49 
50 #endif
51