* Copyright 2003-2005, Haiku Inc.
* Distributed under the terms of the MIT License.
*/
#ifndef _K_PPP_LAYER__H
#define _K_PPP_LAYER__H
#include <KPPPDefs.h>
#include <net_buffer.h>
class KPPPLayer {
protected:
KPPPLayer(const char *name, ppp_level level, uint32 overhead);
public:
virtual ~KPPPLayer();
virtual status_t InitCheck() const;
const char *Name() const
{ return fName; }
This should be \c PPP_PROTOCOL_LEVEL if this layer is not an encapsulator.
*/
ppp_level Level() const
{ return fLevel; }
uint32 Overhead() const
{ return fOverhead; }
void SetNext(KPPPLayer *next)
{ fNext = next; }
KPPPLayer *Next() const
{ return fNext; }
virtual bool Up() = 0;
virtual bool Down() = 0;
virtual bool IsAllowedToSend() const = 0;
virtual status_t Send(net_buffer *packet, uint16 protocolNumber) = 0;
virtual status_t Receive(net_buffer *packet, uint16 protocolNumber) = 0;
status_t SendToNext(net_buffer *packet, uint16 protocolNumber) const;
virtual void Pulse();
protected:
void SetName(const char *name);
protected:
status_t fInitStatus;
uint32 fOverhead;
private:
char *fName;
ppp_level fLevel;
KPPPLayer *fNext;
};
#endif