1 //----------------------------------------------------------------------- 2 // This software is part of the OpenBeOS distribution and is covered 3 // by the OpenBeOS license. 4 // 5 // Copyright (c) 2003-2004 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_QUERY_REPORT_SIZE 2048 19 #define PPPoE_QUERY_REPORT 'PoEQ' 20 // the code value used for query reports 21 22 #define PPPoE_HEADER_SIZE 6 23 // without ethernet header 24 #define PPPoE_TIMEOUT 3000000 25 // 3 seconds 26 #define PPPoE_MAX_ATTEMPTS 2 27 // maximum number of PPPoE's dial-retries 28 29 #define PPPoE_VERSION 0x1 30 #define PPPoE_TYPE 0x1 31 32 #define PPPoE_INTERFACE_KEY "Interface" 33 #define PPPoE_AC_NAME_KEY "ACName" 34 #define PPPoE_SERVICE_NAME_KEY "ServiceName" 35 36 enum pppoe_ops { 37 PPPoE_GET_INTERFACES, 38 PPPoE_QUERY_SERVICES 39 }; 40 41 typedef struct pppoe_query_request { 42 const char *interfaceName; 43 thread_id receiver; 44 } pppoe_query_request; 45 46 extern struct core_module_info *core; 47 48 49 typedef struct pppoe_header { 50 uint8 version : 4; 51 uint8 type : 4; 52 uint8 code; 53 uint16 sessionID; 54 uint16 length; 55 uint8 data[0]; 56 } _PACKED pppoe_header; 57 58 typedef struct complete_pppoe_header { 59 struct ether_header ethernetHeader; 60 pppoe_header pppoeHeader; 61 } complete_pppoe_header; 62 63 64 // defined in pppoe.cpp 65 extern ifnet *FindPPPoEInterface(const char *name); 66 extern uint32 NewHostUniq(); 67 extern void add_device(PPPoEDevice *device); 68 extern void remove_device(PPPoEDevice *device); 69 70 #if DEBUG 71 // defined in PPPoEDevice.cpp 72 extern void dump_packet(struct mbuf *packet); 73 #endif // DEBUG 74 75 76 #endif 77