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