|
INET Framework for OMNeT++/OMNEST
|
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_MACRELAYUNITPP_H 00019 #define __INET_MACRELAYUNITPP_H 00020 00021 00022 #include "MACRelayUnitBase.h" 00023 00024 class EtherFrame; 00025 00031 class INET_API MACRelayUnitPP : public MACRelayUnitBase 00032 { 00033 public: 00034 MACRelayUnitPP(); 00035 virtual ~MACRelayUnitPP(); 00036 00037 protected: 00038 // Stores frame buffer, one for each port 00039 struct PortBuffer 00040 { 00041 int port; 00042 bool cpuBusy; 00043 cQueue queue; 00044 }; 00045 00046 // Parameters controlling how the switch operates 00047 simtime_t processingTime; // Time taken to switch and process a frame 00048 int bufferSize; // Max size of the buffer 00049 long highWatermark; // if buffer goes above this level, send PAUSE frames 00050 int pauseUnits; // "units" field in PAUSE frames 00051 simtime_t pauseInterval; // min time between sending PAUSE frames 00052 00053 // Other variables 00054 int bufferUsed; // Amount of buffer used to store payload 00055 PortBuffer *buffer; // Buffers containing Ethernet payloads 00056 simtime_t pauseLastSent; 00057 00058 // Parameters for statistics collection 00059 long numProcessedFrames; 00060 long numDroppedFrames; 00061 cOutVector bufferLevel; 00062 00063 protected: 00066 virtual void initialize(); 00067 00072 virtual void handleMessage(cMessage *msg); 00073 00077 virtual void finish(); 00079 00084 virtual void handleIncomingFrame(EtherFrame *msg); 00085 00090 virtual void processFrame(cMessage *msg); 00091 }; 00092 00093 #endif 00094 00095