ExtInterface.h

Go to the documentation of this file.
00001 //
00002 // Copyright (C) 2004 Andras Varga
00003 // Copyrigth (C) 2005 Christian Dankbar, Irene Ruengeler, Michael Tuexen
00004 //
00005 // This program is free software; you can redistribute it and/or
00006 // modify it under the terms of the GNU General Public License
00007 // as published by the Free Software Foundation; either version 2
00008 // of the License, or (at your option) any later version.
00009 //
00010 // This program is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 // GNU General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU General Public License
00016 // along with this program; if not, see <http://www.gnu.org/licenses/>.
00017 //
00018 
00019 // This file is based on the PPP.h of INET written by Andras Varga.
00020 
00021 #ifndef __EXTINTERFACE_H
00022 #define __EXTINTERFACE_H
00023 
00024 
00025 #ifndef MAX_MTU_SIZE
00026 #define MAX_MTU_SIZE 4000
00027 #endif
00028 
00029 #include <omnetpp.h>
00030 #include "ExtFrame_m.h"
00031 #include "cSocketRTScheduler.h"
00032 #include "IPDatagram.h"
00033 
00034 #ifndef IPPROTO_SCTP
00035 #define IPPROTO_SCTP 132
00036 #endif
00037 
00038 
00039 class ExtInterface : public cSimpleModule
00040 {
00041   protected:
00042     bool connected;
00043     uint8 buffer[1<<16];
00044     const char *device;
00045 
00046     InterfaceEntry *interfaceEntry;  // points into RoutingTable
00047 
00048     // statistics
00049     int numSent;
00050     int numRcvd;
00051     int numDropped;
00052 
00053     // access to real network interface via Scheduler class:
00054     cSocketRTScheduler *rtScheduler;
00055 
00056     InterfaceEntry *registerInterface();
00057     void displayBusy();
00058     void displayIdle();
00059     void updateDisplayString();
00060 
00061   private:
00062     const char *tag_color;
00063     const char *tag_width;
00064 
00065   public:
00066    // Module_Class_Members(ExtInterface, cSimpleModule, 0);
00067 
00068     virtual int32 numInitStages() const {return 4;}
00069     virtual void initialize(int stage);
00070     virtual void handleMessage(cMessage *msg);
00071 
00072     virtual void finish();
00073 };
00074 
00075 #endif
00076 
00077