xref: /haiku/src/add-ons/kernel/network/ppp/pppoe/PPPoEDevice.h (revision 5a483e4d35557e2c0803bc8a8b091beaffdc8d26)
16cfb4dcaSWaldemar Kornewald //-----------------------------------------------------------------------
25a4503c3SWaldemar Kornewald //  This software is part of the OpenBeOS distribution and is covered
35a4503c3SWaldemar Kornewald //  by the OpenBeOS license.
45a4503c3SWaldemar Kornewald //
56cfb4dcaSWaldemar Kornewald //  Copyright (c) 2003-2004 Waldemar Kornewald, Waldemar.Kornewald@web.de
66cfb4dcaSWaldemar Kornewald //-----------------------------------------------------------------------
75a4503c3SWaldemar Kornewald 
85a4503c3SWaldemar Kornewald #ifndef PPPoE_DEVICE__H
95a4503c3SWaldemar Kornewald #define PPPoE_DEVICE__H
105a4503c3SWaldemar Kornewald 
115a4503c3SWaldemar Kornewald #include "PPPoE.h"
125a4503c3SWaldemar Kornewald 
135a4503c3SWaldemar Kornewald #include <KPPPDevice.h>
145a4503c3SWaldemar Kornewald 
155a4503c3SWaldemar Kornewald 
165a4503c3SWaldemar Kornewald enum pppoe_state {
175a4503c3SWaldemar Kornewald 	INITIAL,
188dad9b1eSWaldemar Kornewald 		// the same as IsDown() == true
195a4503c3SWaldemar Kornewald 	PADI_SENT,
205a4503c3SWaldemar Kornewald 	PADR_SENT,
215a4503c3SWaldemar Kornewald 	OPENED
228dad9b1eSWaldemar Kornewald 		// the same as IsUp() == true
235a4503c3SWaldemar Kornewald };
245a4503c3SWaldemar Kornewald 
255a4503c3SWaldemar Kornewald 
261cea3d85SWaldemar Kornewald class PPPoEDevice : public KPPPDevice {
275a4503c3SWaldemar Kornewald 	public:
281cea3d85SWaldemar Kornewald 		PPPoEDevice(KPPPInterface& interface, driver_parameter *settings);
295a4503c3SWaldemar Kornewald 		virtual ~PPPoEDevice();
305a4503c3SWaldemar Kornewald 
315a4503c3SWaldemar Kornewald 		ifnet *EthernetIfnet() const
325a4503c3SWaldemar Kornewald 			{ return fEthernetIfnet; }
335a4503c3SWaldemar Kornewald 
345a4503c3SWaldemar Kornewald 		const uint8 *Peer() const
355a4503c3SWaldemar Kornewald 			{ return fPeer; }
365a4503c3SWaldemar Kornewald 		uint16 SessionID() const
375a4503c3SWaldemar Kornewald 			{ return fSessionID; }
385a4503c3SWaldemar Kornewald 		uint32 HostUniq() const
395a4503c3SWaldemar Kornewald 			{ return fHostUniq; }
405a4503c3SWaldemar Kornewald 
415a4503c3SWaldemar Kornewald 		const char *ACName() const
425a4503c3SWaldemar Kornewald 			{ return fACName; }
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 
565a4503c3SWaldemar Kornewald 		virtual status_t Send(struct mbuf *packet, uint16 protocolNumber = 0);
575a4503c3SWaldemar Kornewald 		virtual status_t Receive(struct mbuf *packet, uint16 protocolNumber = 0);
585a4503c3SWaldemar Kornewald 
595a4503c3SWaldemar Kornewald 		virtual void Pulse();
605a4503c3SWaldemar Kornewald 
615a4503c3SWaldemar Kornewald 	private:
625a4503c3SWaldemar Kornewald 		ifnet *fEthernetIfnet;
635a4503c3SWaldemar Kornewald 		uint8 fPeer[6];
645a4503c3SWaldemar Kornewald 		uint16 fSessionID;
655a4503c3SWaldemar Kornewald 		uint32 fHostUniq;
66*5a483e4dSWaldemar Kornewald 		const char *fACName, *fServiceName;
675a4503c3SWaldemar Kornewald 
684e0ad752SWaldemar Kornewald 		uint32 fAttempts;
695a4503c3SWaldemar Kornewald 		bigtime_t fNextTimeout;
705a4503c3SWaldemar Kornewald 		pppoe_state fState;
715a4503c3SWaldemar Kornewald 
725a4503c3SWaldemar Kornewald 		BLocker fLock;
735a4503c3SWaldemar Kornewald };
745a4503c3SWaldemar Kornewald 
755a4503c3SWaldemar Kornewald 
765a4503c3SWaldemar Kornewald #endif
77