MACRelayUnitNP.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2003 Andras Varga; CTIE, Monash University, Australia
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_MACRELAYUNITNP_H
00019 #define __INET_MACRELAYUNITNP_H
00020 
00021 
00022 #include "MACRelayUnitBase.h"
00023 
00024 class EtherFrame;
00025 
00030 class INET_API MACRelayUnitNP : public MACRelayUnitBase
00031 {
00032   public:
00033     MACRelayUnitNP();
00034     virtual ~MACRelayUnitNP();
00035 
00036   protected:
00037     // the shared queue
00038     cQueue queue;
00039 
00040     // Parameters controlling how the switch operates
00041     int numCPUs;                // number of processors
00042     simtime_t processingTime;   // Time taken to switch and process a frame
00043     int bufferSize;             // Max size of the buffer
00044     long highWatermark;         // if buffer goes above this level, send PAUSE frames
00045     int pauseUnits;             // "units" field in PAUSE frames
00046     simtime_t pauseInterval;    // min time between sending PAUSE frames
00047 
00048     // Other variables
00049     int bufferUsed;             // Amount of buffer used to store frames
00050     cMessage **endProcEvents;   // self-messages, one for each processor
00051     simtime_t pauseLastSent;
00052 
00053     // Parameters for statistics collection
00054     long numProcessedFrames;
00055     long numDroppedFrames;
00056     cOutVector bufferLevel;
00057 
00058   protected:
00061     virtual void initialize();
00062 
00067     virtual void handleMessage(cMessage *msg);
00068 
00072     virtual void finish();
00074 
00079     virtual void handleIncomingFrame(EtherFrame *msg);
00080 
00085     virtual void processFrame(cMessage *msg);
00086 };
00087 
00088 #endif
00089 
00090 
00091