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