xref: /haiku/docs/user/ppp/KernelPPPIntro.dox (revision 17889a8c70dbb3d59c1412f6431968753c767bab)
1/*!
2\page kernelppp The Kernel PPP Kit (libkernelppp.a)
3
4The PPP stack is a kernel module that interfaces with the network stack.
5Thanks to its modular nature new protocols and extensions can be added without
6having to recompile the PPP stack.
7
8The kernel API is mostly intended for developers who want to write extension modules,
9but you can also create and control PPP interfaces from within your kernel module.
10
11Every instance of a PPP interface initially consists of the following classes:
12
13- KPPPInterface (the main interface class)
14- KPPPLCP (the Link Control Protocol)
15- KPPPStateMachine (the state machine for the Link Control Protocol)
16- KPPPProfile (this manages the current interface profile)
17
18KPPPLCP, KPPPStateMachine, and KPPPProfile are integrated into KPPPInterface as
19member variables. All these classes have private constructors. Only the PPP
20interface manager can create a new instance of KPPPInterface. \n
21Such an interface does nothing useful because it needs at least a device to connect
22to a PPP server. \n
23These are the base classes for extending an interface:
24
25- KPPPDevice (a PPP transport device: PPPoE, modem, cell phone, etc.)
26- KPPPLCPExtension (adds new basic codes to the LCP protocol)
27- KPPPOptionHandler (adds new configure-packet types to the LCP protocol)
28- KPPPProtocol (a base class for protocols; e.g.: LCP and IPCP)
29
30\section kppppackethandling Packet handling
31
32KPPPInterface, KPPPDevice, and KPPPProtocol derive from KPPPLayer. When sending,
33packets are passed down the stack to every layer that can handle the packet.
34This facilitates creating packet encapsulators like compression protocols. You can
35even catch packets before they arrive at the device layer. \n
36A different system is used for receiving packets: KPPPDevice passes the received
37packet to KPPPInterface which in turn tries to find the best fitting KPPPProtocol
38that can handle this kind of packet. If one is found it may pass the packet to the
39netstack or, in case of an encapsulator, it can put the packet back into the decode
40queue by calling KPPPInterface::Receive().
41
42\section kpppmultilink Multilink interfaces
43
44Interfaces can have one parent and multiple children. The first interface of a
45multilink bundle is split into a parent and a child. All other children must be added
46to the parent when they are needed. Normally, a bundle (main) interface has no parent
47and a sub-interface (child) has no children. \n
48A multilink protocol can use any desired technique for creating the additional
49children. For instance, it could save the descriptions of all children as private
50parameters in the interface description file. Alternatively, it could use internal
51bundle names to bundle all interfaces with the equal bundle names. \n
52If a received packet could not be handled by a child it is passed up to the parent.
53On the other hand, an interface without a device (no next layer after the interface)
54will \e not pass the packet to its children.
55
56\section kpppwritingmodules Writing modules
57
58PPP makes use of the kernel module API. Every module must export a \c ppp_module_info
59structure. \n
60KPPPInterface loads all specified modules and calls their \c ppp_module_info::add_to()
61function. Depending on the type of module you should add the corresponding object
62to the interface.
63
64\sa ppp_module_info
65
66*/
67