P2pns.h

Go to the documentation of this file.
00001 //
00002 // Copyright (C) 2007 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 __P2PNS_H_
00025 #define __P2PNS_H_
00026 
00027 #include <omnetpp.h>
00028 
00029 #include <OverlayKey.h>
00030 #include <SHA1.h>
00031 #include <CommonMessages_m.h>
00032 
00033 #include <BaseApp.h>
00034 #include <RpcMacros.h>
00035 
00036 #include "P2pnsCache.h"
00037 
00043 class P2pns : public BaseApp
00044 {
00045 public:
00046     P2pns();
00047     virtual ~P2pns();
00048 
00049 private:
00050     void initializeApp(int stage);
00051     void finishApp();
00052     void handleTimerEvent(cMessage* msg);
00053 
00054     bool handleRpc(BaseCallMessage* msg);
00055     void handleRpcResponse(BaseResponseMessage* msg,
00056                            cPolymorphic* context, int rpcId, simtime_t rtt);
00057     void handleRpcTimeout(BaseCallMessage* msg, const TransportAddress& dest,
00058                           cPolymorphic* context, int rpcId,
00059                           const OverlayKey& destKey);
00060 
00061     void p2pnsRegisterRpc(P2pnsRegisterCall* registerCall);
00062     void p2pnsResolveRpc(P2pnsResolveCall* registerCall);
00063 
00064     void handleDHTputCAPIResponse(DHTputCAPIResponse* putResponse,
00065                                   P2pnsRegisterCall* registerCall);
00066     void handleDHTgetCAPIResponse(DHTgetCAPIResponse* gettResponse,
00067                                   P2pnsResolveCall* resolveCall);
00068     void handleLookupResponse(LookupResponse* lookupResponse,
00069                               P2pnsResolveCall* resolveCall);
00070 
00071     //std::map<unsigned int, BaseCallMessage*> rpcIdMap; /**< List of the Rpc Ids of the messages sent following the reception of an rpc request (the second member) */
00072     P2pnsCache *p2pnsCache; 
00073     bool twoStageResolution; 
00075 };
00076 
00077 #endif

Generated on Wed Mar 25 16:32:49 2009 for OverSim by  doxygen 1.5.5