vfs: check userland buffers before reading them.
[haiku.git] / src / add-ons / kernel / network / ppp / pppoe / PPPoE.h
blob4b14d15c215d595e77f0f780400e60f8204825a2
1 /*
2 * Copyright 2003-2004, Waldemar Kornewald <wkornew@gmx.net>
3 * Distributed under the terms of the MIT License.
4 */
6 #ifndef PPPoE__H
7 #define PPPoE__H
9 #include <SupportDefs.h>
10 #include <net/if.h>
12 #include <ethernet.h>
13 #include <ether_driver.h>
14 #include <net_stack.h>
16 class PPPoEDevice;
18 #define B_NET_FRAME_TYPE_PPPOE B_NET_FRAME_TYPE(IFT_ETHER, ETHER_TYPE_PPPOE)
19 #define B_NET_FRAME_TYPE_PPPOE_DISCOVERY B_NET_FRAME_TYPE(IFT_ETHER, ETHER_TYPE_PPPOE_DISCOVERY)
21 #define PPPoE_QUERY_REPORT_SIZE 2048
22 #define PPPoE_QUERY_REPORT 'PoEQ'
23 // the code value used for query reports
25 #define PPPoE_HEADER_SIZE 6
26 // without ethernet header
27 #define PPPoE_TIMEOUT 3000000
28 // 3 seconds
29 #define PPPoE_MAX_ATTEMPTS 2
30 // maximum number of PPPoE's connect-retries
32 #define PPPoE_VERSION 0x1
33 #define PPPoE_TYPE 0x1
35 #define PPPoE_INTERFACE_KEY "Interface"
36 #define PPPoE_AC_NAME_KEY "ACName"
37 #define PPPoE_SERVICE_NAME_KEY "ServiceName"
39 enum pppoe_ops {
40 PPPoE_GET_INTERFACES,
41 PPPoE_QUERY_SERVICES
44 typedef struct pppoe_query_request {
45 const char *interfaceName;
46 thread_id receiver;
47 } pppoe_query_request;
49 extern struct core_module_info *core;
52 typedef struct pppoe_header {
53 uint8 version : 4;
54 uint8 type : 4;
55 uint8 code;
56 uint16 sessionID;
57 uint16 length;
58 uint8 data[0];
59 } _PACKED pppoe_header;
61 typedef struct complete_pppoe_header {
62 struct ether_header ethernetHeader;
63 pppoe_header pppoeHeader;
64 } complete_pppoe_header;
67 // defined in pppoe.cpp
68 extern net_device *FindPPPoEInterface(const char *name);
69 extern uint32 NewHostUniq();
70 extern void add_device(PPPoEDevice *device);
71 extern void remove_device(PPPoEDevice *device);
73 #if DEBUG
74 // defined in PPPoEDevice.cpp
75 extern void dump_packet(net_buffer *packet);
76 #endif // DEBUG
79 #endif