//---------------------------------------------------------------------- // This software is part of the OpenBeOS distribution and is covered // by the OpenBeOS license. // // Copyright (c) 2003 Waldemar Kornewald, Waldemar.Kornewald@web.de //--------------------------------------------------------------------- #include #include #include #include #ifdef _KERNEL_MODE #include #endif PPPLayer::PPPLayer(const char *name, ppp_level level, uint32 overhead) : fInitStatus(B_OK), fOverhead(overhead), fLevel(level), fNext(NULL) { if(name) fName = strdup(name); else fName = strdup("Unknown"); } PPPLayer::~PPPLayer() { free(fName); } status_t PPPLayer::InitCheck() const { return fInitStatus; } status_t PPPLayer::SendToNext(struct mbuf *packet, uint16 protocolNumber) const { if(!packet) return B_ERROR; // Find the next possible handler for this packet. // Normal protocols (Level() >= PPP_PROTOCOL_LEVEL) do not encapsulate anything. if(Next()) { if(Next()->IsAllowedToSend() && Next()->Level() < PPP_PROTOCOL_LEVEL) return Next()->Send(packet, protocolNumber); else return Next()->SendToNext(packet, protocolNumber); } else { m_freem(packet); return B_ERROR; } } void PPPLayer::Pulse() { // do nothing by default }