1 /* 2 * Copyright 2003-2004, Waldemar Kornewald <wkornew@gmx.net> 3 * Distributed under the terms of the MIT License. 4 */ 5 6 #ifndef PPPoE__H 7 #define PPPoE__H 8 9 #include <SupportDefs.h> 10 #include <net/if.h> 11 #include <netinet/if_ether.h> 12 13 class PPPoEDevice; 14 15 16 #define PPPoE_QUERY_REPORT_SIZE 2048 17 #define PPPoE_QUERY_REPORT 'PoEQ' 18 // the code value used for query reports 19 20 #define PPPoE_HEADER_SIZE 6 21 // without ethernet header 22 #define PPPoE_TIMEOUT 3000000 23 // 3 seconds 24 #define PPPoE_MAX_ATTEMPTS 2 25 // maximum number of PPPoE's connect-retries 26 27 #define PPPoE_VERSION 0x1 28 #define PPPoE_TYPE 0x1 29 30 #define PPPoE_INTERFACE_KEY "Interface" 31 #define PPPoE_AC_NAME_KEY "ACName" 32 #define PPPoE_SERVICE_NAME_KEY "ServiceName" 33 34 enum pppoe_ops { 35 PPPoE_GET_INTERFACES, 36 PPPoE_QUERY_SERVICES 37 }; 38 39 typedef struct pppoe_query_request { 40 const char *interfaceName; 41 thread_id receiver; 42 } pppoe_query_request; 43 44 extern struct core_module_info *core; 45 46 47 typedef struct pppoe_header { 48 uint8 version : 4; 49 uint8 type : 4; 50 uint8 code; 51 uint16 sessionID; 52 uint16 length; 53 uint8 data[0]; 54 } _PACKED pppoe_header; 55 56 typedef struct complete_pppoe_header { 57 struct ether_header ethernetHeader; 58 pppoe_header pppoeHeader; 59 } complete_pppoe_header; 60 61 62 // defined in pppoe.cpp 63 extern ifnet *FindPPPoEInterface(const char *name); 64 extern uint32 NewHostUniq(); 65 extern void add_device(PPPoEDevice *device); 66 extern void remove_device(PPPoEDevice *device); 67 68 #if DEBUG 69 // defined in PPPoEDevice.cpp 70 extern void dump_packet(struct mbuf *packet); 71 #endif // DEBUG 72 73 74 #endif 75