184b580c4SWaldemar Kornewald /* 22f13f213SWaldemar Kornewald * Copyright 2003-2006, Waldemar Kornewald <wkornew@gmx.net> 384b580c4SWaldemar Kornewald * Distributed under the terms of the MIT License. 484b580c4SWaldemar Kornewald */ 55a4503c3SWaldemar Kornewald 65a4503c3SWaldemar Kornewald #ifndef PPPoE_DEVICE__H 75a4503c3SWaldemar Kornewald #define PPPoE_DEVICE__H 85a4503c3SWaldemar Kornewald 95a4503c3SWaldemar Kornewald #include "PPPoE.h" 105a4503c3SWaldemar Kornewald 115a4503c3SWaldemar Kornewald #include <KPPPDevice.h> 125a4503c3SWaldemar Kornewald 13*e3724c38Smshlyn #include <net/if_types.h> 14*e3724c38Smshlyn #include <net_stack.h> 15*e3724c38Smshlyn 165a4503c3SWaldemar Kornewald 175a4503c3SWaldemar Kornewald enum pppoe_state { 185a4503c3SWaldemar Kornewald INITIAL, 198dad9b1eSWaldemar Kornewald // the same as IsDown() == true 205a4503c3SWaldemar Kornewald PADI_SENT, 215a4503c3SWaldemar Kornewald PADR_SENT, 225a4503c3SWaldemar Kornewald OPENED 238dad9b1eSWaldemar Kornewald // the same as IsUp() == true 245a4503c3SWaldemar Kornewald }; 255a4503c3SWaldemar Kornewald 265a4503c3SWaldemar Kornewald 271cea3d85SWaldemar Kornewald class PPPoEDevice : public KPPPDevice { 285a4503c3SWaldemar Kornewald public: 291cea3d85SWaldemar Kornewald PPPoEDevice(KPPPInterface& interface, driver_parameter *settings); 305a4503c3SWaldemar Kornewald EthernetIfnet()31*e3724c38Smshlyn net_device *EthernetIfnet() const 325a4503c3SWaldemar Kornewald { return fEthernetIfnet; } 335a4503c3SWaldemar Kornewald Peer()345a4503c3SWaldemar Kornewald const uint8 *Peer() const 355a4503c3SWaldemar Kornewald { return fPeer; } SessionID()365a4503c3SWaldemar Kornewald uint16 SessionID() const 375a4503c3SWaldemar Kornewald { return fSessionID; } HostUniq()385a4503c3SWaldemar Kornewald uint32 HostUniq() const 395a4503c3SWaldemar Kornewald { return fHostUniq; } 405a4503c3SWaldemar Kornewald ACName()415a4503c3SWaldemar Kornewald const char *ACName() const 425a4503c3SWaldemar Kornewald { return fACName; } ServiceName()435a4503c3SWaldemar Kornewald const char *ServiceName() const 445a4503c3SWaldemar Kornewald { return fServiceName; } 455a4503c3SWaldemar Kornewald 465a4503c3SWaldemar Kornewald virtual status_t InitCheck() const; 475a4503c3SWaldemar Kornewald 485a4503c3SWaldemar Kornewald virtual bool Up(); 495a4503c3SWaldemar Kornewald virtual bool Down(); 505a4503c3SWaldemar Kornewald 515a4503c3SWaldemar Kornewald virtual uint32 InputTransferRate() const; 525a4503c3SWaldemar Kornewald virtual uint32 OutputTransferRate() const; 535a4503c3SWaldemar Kornewald 545a4503c3SWaldemar Kornewald virtual uint32 CountOutputBytes() const; 555a4503c3SWaldemar Kornewald 56*e3724c38Smshlyn virtual status_t Send(net_buffer *packet, uint16 protocolNumber = 0); 57*e3724c38Smshlyn virtual status_t Receive(net_buffer *packet, uint16 protocolNumber = 0); 585a4503c3SWaldemar Kornewald 595a4503c3SWaldemar Kornewald virtual void Pulse(); 605a4503c3SWaldemar Kornewald 615a4503c3SWaldemar Kornewald private: 62*e3724c38Smshlyn net_device *fEthernetIfnet; 635a4503c3SWaldemar Kornewald uint8 fPeer[6]; 64*e3724c38Smshlyn uint8 fEtherAddr[6]; 655a4503c3SWaldemar Kornewald uint16 fSessionID; 665a4503c3SWaldemar Kornewald uint32 fHostUniq; 675a483e4dSWaldemar Kornewald const char *fACName, *fServiceName; 68*e3724c38Smshlyn const char *finterfaceName; 695a4503c3SWaldemar Kornewald 704e0ad752SWaldemar Kornewald uint32 fAttempts; 715a4503c3SWaldemar Kornewald bigtime_t fNextTimeout; 725a4503c3SWaldemar Kornewald pppoe_state fState; 735a4503c3SWaldemar Kornewald }; 745a4503c3SWaldemar Kornewald 755a4503c3SWaldemar Kornewald 765a4503c3SWaldemar Kornewald #endif 77