PPPInterfaceListener.h revision 20d09e03
120d09e03SWaldemar Kornewald//----------------------------------------------------------------------
220d09e03SWaldemar Kornewald//  This software is part of the OpenBeOS distribution and is covered
320d09e03SWaldemar Kornewald//  by the OpenBeOS license.
420d09e03SWaldemar Kornewald//
520d09e03SWaldemar Kornewald//  Copyright (c) 2003 Waldemar Kornewald, Waldemar.Kornewald@web.de
620d09e03SWaldemar Kornewald//---------------------------------------------------------------------
720d09e03SWaldemar Kornewald
820d09e03SWaldemar Kornewald#ifndef _PPP_INTERFACE_LISTENER__H
920d09e03SWaldemar Kornewald#define _PPP_INTERFACE_LISTENER__H
1020d09e03SWaldemar Kornewald
1120d09e03SWaldemar Kornewald#include <PPPManager.h>
1220d09e03SWaldemar Kornewald#include <Locker.h>
1320d09e03SWaldemar Kornewald
1420d09e03SWaldemar Kornewaldclass BHandler;
1520d09e03SWaldemar Kornewald
1620d09e03SWaldemar Kornewald
1720d09e03SWaldemar Kornewald#define PPP_REPORT_MESSAGE	'P3RM'
1820d09e03SWaldemar Kornewald	// the what field of report messages
1920d09e03SWaldemar Kornewald
2020d09e03SWaldemar Kornewald
2120d09e03SWaldemar Kornewaldclass PPPInterfaceListener {
2220d09e03SWaldemar Kornewald	public:
2320d09e03SWaldemar Kornewald		PPPInterfaceListener(BHandler *target);
2420d09e03SWaldemar Kornewald		PPPInterfaceListener(const PPPInterfaceListener& copy);
2520d09e03SWaldemar Kornewald		~PPPInterfaceListener();
2620d09e03SWaldemar Kornewald
2720d09e03SWaldemar Kornewald		status_t InitCheck() const;
2820d09e03SWaldemar Kornewald
2920d09e03SWaldemar Kornewald		BHandler *Target() const
3020d09e03SWaldemar Kornewald			{ return fTarget; }
3120d09e03SWaldemar Kornewald		void SetTarget(BHandler *target);
3220d09e03SWaldemar Kornewald
3320d09e03SWaldemar Kornewald		const PPPManager *Manager() const
3420d09e03SWaldemar Kornewald			{ return &fManager; }
3520d09e03SWaldemar Kornewald
3620d09e03SWaldemar Kornewald		PPPInterfaceListener& operator= (const PPPInterfaceListener& copy)
3720d09e03SWaldemar Kornewald			{ SetTarget(copy.Target()); return *this; }
3820d09e03SWaldemar Kornewald				// all interface listeners have the same number of interfaces
3920d09e03SWaldemar Kornewald
4020d09e03SWaldemar Kornewald	private:
4120d09e03SWaldemar Kornewald		void Construct();
4220d09e03SWaldemar Kornewald
4320d09e03SWaldemar Kornewald	private:
4420d09e03SWaldemar Kornewald		BHandler *fTarget;
4520d09e03SWaldemar Kornewald		thread_id fReportThread;
4620d09e03SWaldemar Kornewald
4720d09e03SWaldemar Kornewald		PPPManager fManager;
4820d09e03SWaldemar Kornewald		BLocker fLock;
4920d09e03SWaldemar Kornewald};
5020d09e03SWaldemar Kornewald
5120d09e03SWaldemar Kornewald
5220d09e03SWaldemar Kornewald#endif
53