00001 /* -*- mode:c++ -*- ******************************************************** 00002 * file: BurstApplLayer.cc 00003 * 00004 * author: Daniel Willkomm 00005 * 00006 * copyright: (C) 2004 Telecommunication Networks Group (TKN) at 00007 * Technische Universitaet Berlin, Germany. 00008 * 00009 * This program is free software; you can redistribute it 00010 * and/or modify it under the terms of the GNU General Public 00011 * License as published by the Free Software Foundation; either 00012 * version 2 of the License, or (at your option) any later 00013 * version. 00014 * For further information see file COPYING 00015 * in the top level directory 00016 *************************************************************************** 00017 * part of: framework implementation developed by tkn 00018 * description: application layer like the TestApplLayer but sends burst of 00019 * messages 00020 **************************************************************************/ 00021 00022 00023 #include "BurstApplLayer.h" 00024 00025 Define_Module(BurstApplLayer); 00026 00027 // do some initialization 00028 void BurstApplLayer::initialize(int stage) 00029 { 00030 TestApplLayer::initialize(stage); 00031 00032 if(stage==0){ 00033 if(hasPar("burstSize")) 00034 burstSize = par("burstSize"); 00035 else 00036 burstSize = 3; 00037 } 00038 } 00039 00040 00041 void BurstApplLayer::handleSelfMsg(cMessage *msg) 00042 { 00043 switch(msg->getKind()) 00044 { 00045 case SEND_BROADCAST_TIMER: 00046 for(int i=0; i<burstSize; i++) { 00047 sendBroadcast(); 00048 } 00049 break; 00050 default: 00051 EV <<" Unkown selfmessage! -> delete, kind: "<<msg->getKind()<<endl; 00052 } 00053 }