PPP.h

Go to the documentation of this file.
00001 //
00002 // Copyright (C) 2004 Andras Varga
00003 //
00004 // This program is free software; you can redistribute it and/or
00005 // modify it under the terms of the GNU Lesser General Public License
00006 // as published by the Free Software Foundation; either version 2
00007 // of the License, or (at your option) any later version.
00008 //
00009 // This program is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 // GNU Lesser General Public License for more details.
00013 //
00014 // You should have received a copy of the GNU Lesser General Public License
00015 // along with this program; if not, see <http://www.gnu.org/licenses/>.
00016 //
00017 
00018 #ifndef __INET_PPP_H
00019 #define __INET_PPP_H
00020 
00021 
00022 #include <omnetpp.h>
00023 #include "INETDefs.h"
00024 #include "PPPFrame_m.h"
00025 #include "TxNotifDetails.h"
00026 #include "INotifiable.h"
00027 
00028 class InterfaceEntry;
00029 class IPassiveQueue;
00030 class NotificationBoard;
00031 
00035 class INET_API PPP : public cSimpleModule, public INotifiable
00036 {
00037   protected:
00038     long txQueueLimit;
00039     cGate *physOutGate;
00040     cChannel *datarateChannel; // NULL if we're not connected
00041 
00042     cQueue txQueue;
00043     cMessage *endTransmissionEvent;
00044     IPassiveQueue *queueModule;
00045 
00046     InterfaceEntry *interfaceEntry;  // points into IInterfaceTable
00047 
00048     NotificationBoard *nb;
00049     TxNotifDetails notifDetails;
00050     bool hasSubscribers; // only notify if somebody is listening
00051 
00052     std::string oldConnColor;
00053 
00054     // statistics
00055     long numSent;
00056     long numRcvdOK;
00057     long numBitErr;
00058     long numDroppedIfaceDown;
00059 
00060   protected:
00061     virtual InterfaceEntry *registerInterface(double datarate);
00062     virtual void startTransmitting(cPacket *msg);
00063     virtual PPPFrame *encapsulate(cPacket *msg);
00064     virtual cPacket *decapsulate(PPPFrame *pppFrame);
00065     virtual void displayBusy();
00066     virtual void displayIdle();
00067     virtual void updateDisplayString();
00068     virtual void updateHasSubcribers();
00069     virtual void receiveChangeNotification(int category, const cPolymorphic *details);
00070 
00071   public:
00072     PPP();
00073     virtual ~PPP();
00074 
00075   protected:
00076     virtual int numInitStages() const {return 4;}
00077     virtual void initialize(int stage);
00078     virtual void handleMessage(cMessage *msg);
00079 };
00080 
00081 #endif
00082 
00083