BPicture: Fix archive constructor.
[haiku.git] / src / add-ons / kernel / network / ppp / modem / ModemDevice.h
blob8c20968cab6df05696602df57d9cca7029bf3cf2
1 /*
2 * Copyright 2003-2006, Waldemar Kornewald <wkornew@gmx.net>
3 * Distributed under the terms of the MIT License.
4 */
6 #ifndef MODEM_DEVICE__H
7 #define MODEM_DEVICE__H
9 #include "Modem.h"
11 #include <KPPPDevice.h>
14 enum modem_state {
15 INITIAL,
16 // the same as IsDown() == true
17 TERMINATING,
18 DIALING,
19 OPENED
20 // the same as IsUp() == true
24 class ACFCHandler;
26 class ModemDevice : public KPPPDevice {
27 public:
28 ModemDevice(KPPPInterface& interface, driver_parameter *settings);
29 virtual ~ModemDevice();
31 const char *PortName() const
32 { return fPortName; }
33 int32 Handle() const
34 { return fHandle; }
35 // returns file handle for modem driver
37 const char *InitString() const
38 { return fInitString; }
39 const char *DialString() const
40 { return fDialString; }
42 virtual status_t InitCheck() const;
44 virtual bool Up();
45 virtual bool Down();
47 void SetSpeed(uint32 bps);
48 virtual uint32 InputTransferRate() const;
49 virtual uint32 OutputTransferRate() const;
50 // this is around 60% of the input transfer rate
52 virtual uint32 CountOutputBytes() const;
54 void OpenModem();
55 void CloseModem();
57 // notifications:
58 void FinishedDialing();
59 void FailedDialing();
60 void ConnectionLost();
62 virtual status_t Send(struct mbuf *packet, uint16 protocolNumber = 0);
63 status_t DataReceived(uint8 *buffer, uint32 length);
64 // this will put the data into an mbuf and call Receive()
65 virtual status_t Receive(struct mbuf *packet, uint16 protocolNumber = 0);
67 private:
68 const char *fPortName, *fInitString, *fDialString;
69 int32 fHandle;
70 // file handle for modem driver
72 thread_id fWorkerThread;
74 uint32 fInputTransferRate, fOutputTransferRate;
75 uint32 fOutputBytes;
77 modem_state fState;
79 ACFCHandler *fACFC;
83 #endif