1/*
2 * Copyright 2003-2004, Waldemar Kornewald <wkornew@gmx.net>
3 * Distributed under the terms of the MIT License.
4 */
5
6#ifndef ACFC_HANDLER__H
7#define ACFC_HANDLER__H
8
9#include <KPPPOptionHandler.h>
10
11
12// ACFC options
13enum {
14	REQUEST_ACFC = 0x01,
15		// try to request ACFC (does not fail if not successful)
16	ALLOW_ACFC = 0x02,
17		// allow ACFC if other side requests it
18	FORCE_ACFC_REQUEST = 0x04,
19		// if ACFC request fails the connection attempt will terminate
20};
21
22enum acfc_state {
23	ACFC_DISABLED,
24	ACFC_ACCEPTED,
25	ACFC_REJECTED
26		// not used for peer state
27};
28
29
30class ACFCHandler : public KPPPOptionHandler {
31	public:
32		ACFCHandler(uint32 options, KPPPInterface& interface);
33
34		uint32 Options() const
35			{ return fOptions; }
36		acfc_state LocalState() const
37			{ return fLocalState; }
38		acfc_state PeerState() const
39			{ return fPeerState; }
40
41		virtual status_t AddToRequest(KPPPConfigurePacket& request);
42		virtual status_t ParseNak(const KPPPConfigurePacket& nak);
43		virtual status_t ParseReject(const KPPPConfigurePacket& reject);
44		virtual status_t ParseAck(const KPPPConfigurePacket& ack);
45
46		virtual status_t ParseRequest(const KPPPConfigurePacket& request,
47			int32 index, KPPPConfigurePacket& nak, KPPPConfigurePacket& reject);
48		virtual status_t SendingAck(const KPPPConfigurePacket& ack);
49
50		virtual void Reset();
51
52	private:
53		uint32 fOptions;
54		acfc_state fLocalState, fPeerState;
55};
56
57
58#endif
59