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