xref: /haiku/src/add-ons/kernel/network/ppp/pppoe/PPPoEDevice.h (revision 2f13f213de8e2b44640b88a2b3d42ed921f637cb)
184b580c4SWaldemar Kornewald /*
2*2f13f213SWaldemar 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 
135a4503c3SWaldemar Kornewald 
145a4503c3SWaldemar Kornewald enum pppoe_state {
155a4503c3SWaldemar Kornewald 	INITIAL,
168dad9b1eSWaldemar Kornewald 		// the same as IsDown() == true
175a4503c3SWaldemar Kornewald 	PADI_SENT,
185a4503c3SWaldemar Kornewald 	PADR_SENT,
195a4503c3SWaldemar Kornewald 	OPENED
208dad9b1eSWaldemar Kornewald 		// the same as IsUp() == true
215a4503c3SWaldemar Kornewald };
225a4503c3SWaldemar Kornewald 
235a4503c3SWaldemar Kornewald 
241cea3d85SWaldemar Kornewald class PPPoEDevice : public KPPPDevice {
255a4503c3SWaldemar Kornewald 	public:
261cea3d85SWaldemar Kornewald 		PPPoEDevice(KPPPInterface& interface, driver_parameter *settings);
275a4503c3SWaldemar Kornewald 
285a4503c3SWaldemar Kornewald 		ifnet *EthernetIfnet() const
295a4503c3SWaldemar Kornewald 			{ return fEthernetIfnet; }
305a4503c3SWaldemar Kornewald 
315a4503c3SWaldemar Kornewald 		const uint8 *Peer() const
325a4503c3SWaldemar Kornewald 			{ return fPeer; }
335a4503c3SWaldemar Kornewald 		uint16 SessionID() const
345a4503c3SWaldemar Kornewald 			{ return fSessionID; }
355a4503c3SWaldemar Kornewald 		uint32 HostUniq() const
365a4503c3SWaldemar Kornewald 			{ return fHostUniq; }
375a4503c3SWaldemar Kornewald 
385a4503c3SWaldemar Kornewald 		const char *ACName() const
395a4503c3SWaldemar Kornewald 			{ return fACName; }
405a4503c3SWaldemar Kornewald 		const char *ServiceName() const
415a4503c3SWaldemar Kornewald 			{ return fServiceName; }
425a4503c3SWaldemar Kornewald 
435a4503c3SWaldemar Kornewald 		virtual status_t InitCheck() const;
445a4503c3SWaldemar Kornewald 
455a4503c3SWaldemar Kornewald 		virtual bool Up();
465a4503c3SWaldemar Kornewald 		virtual bool Down();
475a4503c3SWaldemar Kornewald 
485a4503c3SWaldemar Kornewald 		virtual uint32 InputTransferRate() const;
495a4503c3SWaldemar Kornewald 		virtual uint32 OutputTransferRate() const;
505a4503c3SWaldemar Kornewald 
515a4503c3SWaldemar Kornewald 		virtual uint32 CountOutputBytes() const;
525a4503c3SWaldemar Kornewald 
535a4503c3SWaldemar Kornewald 		virtual status_t Send(struct mbuf *packet, uint16 protocolNumber = 0);
545a4503c3SWaldemar Kornewald 		virtual status_t Receive(struct mbuf *packet, uint16 protocolNumber = 0);
555a4503c3SWaldemar Kornewald 
565a4503c3SWaldemar Kornewald 		virtual void Pulse();
575a4503c3SWaldemar Kornewald 
585a4503c3SWaldemar Kornewald 	private:
595a4503c3SWaldemar Kornewald 		ifnet *fEthernetIfnet;
605a4503c3SWaldemar Kornewald 		uint8 fPeer[6];
615a4503c3SWaldemar Kornewald 		uint16 fSessionID;
625a4503c3SWaldemar Kornewald 		uint32 fHostUniq;
635a483e4dSWaldemar Kornewald 		const char *fACName, *fServiceName;
645a4503c3SWaldemar Kornewald 
654e0ad752SWaldemar Kornewald 		uint32 fAttempts;
665a4503c3SWaldemar Kornewald 		bigtime_t fNextTimeout;
675a4503c3SWaldemar Kornewald 		pppoe_state fState;
685a4503c3SWaldemar Kornewald };
695a4503c3SWaldemar Kornewald 
705a4503c3SWaldemar Kornewald 
715a4503c3SWaldemar Kornewald #endif
72