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_DEVICE__H 9 #define PPPoE_DEVICE__H 10 11 #include "PPPoE.h" 12 13 #include <KPPPDevice.h> 14 15 16 enum pppoe_state { 17 INITIAL, 18 // the same as IsDown() == true 19 PADI_SENT, 20 PADR_SENT, 21 OPENED 22 // the same as IsUp() == true 23 }; 24 25 26 class PPPoEDevice : public KPPPDevice { 27 public: 28 PPPoEDevice(KPPPInterface& interface, driver_parameter *settings); 29 virtual ~PPPoEDevice(); 30 31 ifnet *EthernetIfnet() const 32 { return fEthernetIfnet; } 33 34 const uint8 *Peer() const 35 { return fPeer; } 36 uint16 SessionID() const 37 { return fSessionID; } 38 uint32 HostUniq() const 39 { return fHostUniq; } 40 41 const char *ACName() const 42 { return fACName; } 43 const char *ServiceName() const 44 { return fServiceName; } 45 46 virtual status_t InitCheck() const; 47 48 virtual bool Up(); 49 virtual bool Down(); 50 51 virtual uint32 InputTransferRate() const; 52 virtual uint32 OutputTransferRate() const; 53 54 virtual uint32 CountOutputBytes() const; 55 56 virtual status_t Send(struct mbuf *packet, uint16 protocolNumber = 0); 57 virtual status_t Receive(struct mbuf *packet, uint16 protocolNumber = 0); 58 59 virtual void Pulse(); 60 61 private: 62 ifnet *fEthernetIfnet; 63 uint8 fPeer[6]; 64 uint16 fSessionID; 65 uint32 fHostUniq; 66 const char *fACName, *fServiceName; 67 68 uint32 fAttempts; 69 bigtime_t fNextTimeout; 70 pppoe_state fState; 71 72 BLocker fLock; 73 }; 74 75 76 #endif 77