xref: /haiku/src/add-ons/kernel/network/ppp/pppoe/PPPoE.h (revision d5cd5d63ff0ad395989db6cf4841a64d5b545d1d)
1 //----------------------------------------------------------------------
2 //  This software is part of the OpenBeOS distribution and is covered
3 //  by the OpenBeOS license.
4 //
5 //  Copyright (c) 2003 Waldemar Kornewald, Waldemar.Kornewald@web.de
6 //---------------------------------------------------------------------
7 
8 #ifndef PPPoE__H
9 #define PPPoE__H
10 
11 #include <SupportDefs.h>
12 #include <net/if.h>
13 #include <netinet/if_ether.h>
14 
15 class PPPoEDevice;
16 
17 
18 #define PPPoE_HEADER_SIZE		6
19 	// without ethernet header
20 #define PPPoE_TIMEOUT			3000000
21 	// 3 seconds
22 #define PPPoE_MAX_ATTEMPTS		2
23 
24 #define PPPoE_VERSION			0x1
25 #define PPPoE_TYPE				0x1
26 
27 #define PPPoE_INTERFACE_KEY		"interface"
28 
29 extern struct core_module_info *core;
30 
31 
32 typedef struct pppoe_header {
33 	uint8 version : 4;
34 	uint8 type : 4;
35 	uint8 code;
36 	uint16 sessionID;
37 	uint16 length;
38 	uint8 data[0];
39 } pppoe_header _PACKED;
40 
41 typedef struct complete_pppoe_header {
42 	struct ether_header ethernetHeader;
43 	pppoe_header pppoeHeader;
44 } complete_pppoe_header;
45 
46 
47 // defined in pppoe.cpp
48 uint32 NewHostUniq();
49 void add_device(PPPoEDevice *device);
50 void remove_device(PPPoEDevice *device);
51 
52 // defined in PPPoEDevice.cpp
53 void dump_packet(struct mbuf *packet);
54 
55 
56 #endif
57