00001 // 00002 // Copyright (C) 2006 Institut fuer Telematik, Universitaet Karlsruhe (TH) 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 00024 #ifndef __GIASEARCHAPP_H_ 00025 #define __GIASEARCHAPP_H_ 00026 00027 #include <set> 00028 00029 #include <omnetpp.h> 00030 00031 #include <BaseApp.h> 00032 #include <GlobalNodeList.h> 00033 #include <UnderlayConfigurator.h> 00034 #include <OverlayKey.h> 00035 #include "SearchMsgBookkeeping.h" 00036 00037 00045 class GIASearchApp : public BaseApp 00046 { 00047 public: 00048 GIASearchApp(); 00049 virtual ~GIASearchApp(); 00050 00051 private: 00052 00053 std::vector<OverlayKey>* keyList; 00055 protected: 00056 00062 virtual void initializeApp(int stage); 00063 00064 void handleLowerMessage(cMessage* msg); 00065 00066 virtual void handleTimerEvent(cMessage *msg); 00067 00071 virtual void finishApp(); 00072 00073 SearchMsgBookkeeping* srMsgBook; 00075 // parameters 00076 double mean; 00077 double deviation; 00078 bool randomNodes; 00079 int maxResponses; 00081 // message field lengths (bit) 00082 static const uint32_t ID_L = 16; 00083 static const uint32_t SEQNUM_L = 16; 00084 int msgByteLength; 00085 00086 // statistics 00087 int stat_keyListMessagesSent; 00088 int stat_keyListBytesSent; 00089 int stat_searchMessagesSent; 00090 int stat_searchBytesSent; 00091 int stat_searchResponseMessages; 00092 int stat_searchResponseBytes; 00094 cMessage* search_timer; 00095 cMessage* keyList_timer; 00096 }; 00097 00098 #endif