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 _K_PPP_LAYER__H 9 #define _K_PPP_LAYER__H 10 11 #include <KPPPDefs.h> 12 13 14 class KPPPLayer { 15 protected: 16 // KPPPLayer must be subclassed 17 KPPPLayer(const char *name, ppp_level level, uint32 overhead); 18 19 public: 20 virtual ~KPPPLayer(); 21 22 virtual status_t InitCheck() const; 23 24 const char *Name() const 25 { return fName; } 26 ppp_level Level() const 27 { return fLevel; } 28 // should be PPP_PROTOCOL_LEVEL if not encapsulator 29 uint32 Overhead() const 30 { return fOverhead; } 31 32 void SetNext(KPPPLayer *next) 33 { fNext = next; } 34 KPPPLayer *Next() const 35 { return fNext; } 36 37 virtual void ProfileChanged(); 38 39 virtual bool Up() = 0; 40 virtual bool Down() = 0; 41 42 virtual bool IsAllowedToSend() const = 0; 43 44 virtual status_t Send(struct mbuf *packet, uint16 protocolNumber) = 0; 45 virtual status_t Receive(struct mbuf *packet, uint16 protocolNumber) = 0; 46 47 status_t SendToNext(struct mbuf *packet, uint16 protocolNumber) const; 48 // send the packet to the next layer 49 50 virtual void Pulse(); 51 52 protected: 53 void SetName(const char *name); 54 55 status_t fInitStatus; 56 uint32 fOverhead; 57 58 private: 59 char *fName; 60 ppp_level fLevel; 61 62 KPPPLayer *fNext; 63 }; 64 65 66 #endif 67