184b580c4SWaldemar Kornewald/*
2abdb7d1aSWaldemar Kornewald * Copyright 2003-2005, Haiku Inc.
384b580c4SWaldemar Kornewald * Distributed under the terms of the MIT License.
484b580c4SWaldemar Kornewald */
5de2f76e1SWaldemar Kornewald
6de2f76e1SWaldemar Kornewald#ifndef _K_PPP_REPORT_MANAGER__H
7de2f76e1SWaldemar Kornewald#define _K_PPP_REPORT_MANAGER__H
8de2f76e1SWaldemar Kornewald
9de2f76e1SWaldemar Kornewald#include <OS.h>
10de2f76e1SWaldemar Kornewald
11de2f76e1SWaldemar Kornewald#include <KPPPDefs.h>
12de2f76e1SWaldemar Kornewald#include <PPPReportDefs.h>
13de2f76e1SWaldemar Kornewald
1449c2f687SWaldemar Kornewald#include <TemplateList.h>
15de2f76e1SWaldemar Kornewald
16e3724c38Smshlyn#include <lock.h>
17e3724c38Smshlyn#include <util/AutoLock.h>
18e3724c38Smshlyn
19de2f76e1SWaldemar Kornewald
20f9ad2df8SWaldemar Kornewaldclass KPPPReportManager {
21de2f76e1SWaldemar Kornewald	public:
22e3724c38Smshlyn		KPPPReportManager(mutex& lock);
23f9ad2df8SWaldemar Kornewald		~KPPPReportManager();
24de2f76e1SWaldemar Kornewald
25abdb7d1aSWaldemar Kornewald		static bool SendReport(thread_id thread, const ppp_report_packet *report);
26abdb7d1aSWaldemar Kornewald			// returns false if reply was bad (or an error occured)
27abdb7d1aSWaldemar Kornewald
28de2f76e1SWaldemar Kornewald		void EnableReports(ppp_report_type type, thread_id thread,
29de2f76e1SWaldemar Kornewald				int32 flags = PPP_NO_FLAGS);
30de2f76e1SWaldemar Kornewald		void DisableReports(ppp_report_type type, thread_id thread);
31de2f76e1SWaldemar Kornewald		bool DoesReport(ppp_report_type type, thread_id thread);
32de2f76e1SWaldemar Kornewald		bool Report(ppp_report_type type, int32 code, void *data, int32 length);
33de2f76e1SWaldemar Kornewald			// returns false if reply was bad (or an error occured)
34de2f76e1SWaldemar Kornewald
35de2f76e1SWaldemar Kornewald	private:
36e3724c38Smshlyn		mutex& fLock;
3749c2f687SWaldemar Kornewald		TemplateList<ppp_report_request*> fReportRequests;
38de2f76e1SWaldemar Kornewald};
39de2f76e1SWaldemar Kornewald
40de2f76e1SWaldemar Kornewald
41de2f76e1SWaldemar Kornewald#endif
42