INET Framework for OMNeT++/OMNEST
AnsaPPP.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 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 General Public License for more details.
00013 //
00014 // You should have received a copy of the GNU General Public License
00015 // along with this program; if not, write to the Free Software
00016 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00017 //
00018 
00019 #ifndef __INET_PPP_H
00020 #define __INET_PPP_H
00021 
00022 
00023 #include <omnetpp.h>
00024 #include "INETDefs.h"
00025 #include "PPPFrame_m.h"
00026 #include "TxNotifDetails.h"
00027 #include "INotifiable.h"
00028 
00029 class InterfaceEntry;
00030 class IPassiveQueue;
00031 class NotificationBoard;
00032 
00036 class INET_API AnsaPPP : public cSimpleModule, public INotifiable
00037 {
00038   protected:
00039     long txQueueLimit;
00040     cGate *physOutGate;
00041     cChannel *datarateChannel; // NULL if we're not connected
00042     
00043     bool disabled;             // true if the interface is disabled, defined by the user
00044 
00045     cQueue txQueue;
00046     cMessage *endTransmissionEvent;
00047     IPassiveQueue *queueModule;
00048 
00049     InterfaceEntry *interfaceEntry;  // points into IInterfaceTable
00050 
00051     NotificationBoard *nb;
00052     TxNotifDetails notifDetails;
00053     bool hasSubscribers; // only notify if somebody is listening
00054 
00055     std::string oldConnColor;
00056 
00057     // statistics
00058     long numSent;
00059     long numRcvdOK;
00060     long numBitErr;
00061     long numDroppedIfaceDown;
00062 
00063   protected:
00064     virtual InterfaceEntry *registerInterface(double datarate);
00065     virtual void startTransmitting(cPacket *msg);
00066     virtual PPPFrame *encapsulate(cPacket *msg);
00067     virtual cPacket *decapsulate(PPPFrame *pppFrame);
00068     virtual void displayBusy();
00069     virtual void displayIdle();
00070     virtual void updateDisplayString();
00071     virtual void updateHasSubcribers();
00072     virtual void receiveChangeNotification(int category, const cPolymorphic *details);
00073 
00074   public:
00075     AnsaPPP();
00076     virtual ~AnsaPPP();
00077     
00078     virtual InterfaceEntry * getInterfaceEntry(void) { return interfaceEntry; }
00079     virtual void setDisabled(bool b)  { disabled = b; }
00080     virtual bool isDisabled(void) { return disabled; }
00081 
00082   protected:
00083     virtual int numInitStages() const {return 4;}
00084     virtual void initialize(int stage);
00085     virtual void handleMessage(cMessage *msg);
00086 };
00087 
00088 #endif
00089 
00090