Public Member Functions | Protected Member Functions | Protected Attributes | Private Types | Private Member Functions | Private Attributes

BaseRpc Class Reference

Base class for RPCs. More...

#include <BaseRpc.h>

Inheritance diagram for BaseRpc:
RpcListener BaseApp BaseOverlay ALMTest BootstrapList CBRDHT DHT DHTTestApp GIASearchApp I3 KBRTestApp Landmark MyApplication NeighborCache P2pns RealWorldTestApp Scribe SimMud SimpleGameClient TCPExampleApp TierDummy XmlRpcInterface BasePastry Broose Gia Kademlia MyOverlay NTree OverlayDummy oversim::Chord oversim::Nice PubSubLobby PubSubMMOG Quon Vast

List of all members.

Public Member Functions

 BaseRpc ()
const NodeHandlegetThisNode ()
 Returns the NodeHandle of this node.
simtime_t getUdpTimeout ()

Protected Member Functions

virtual bool internalHandleRpcCall (BaseCallMessage *msg)
 Handles internal rpc requests.
virtual void internalHandleRpcResponse (BaseResponseMessage *msg, cPolymorphic *context, int rpcId, simtime_t rtt)
 Handles rpc responses internal in base classes

virtual void internalHandleRpcTimeout (BaseCallMessage *msg, const TransportAddress &dest, cPolymorphic *context, int rpcId, const OverlayKey &destKey)
 Handles rpc timeouts internal in base classes

void initRpcs ()
 Initializes Remote-Procedure state.
void finishRpcs ()
 Deinitializes Remote-Procedure state.
virtual void internalHandleRpcMessage (BaseRpcMessage *msg)
 Handles incoming rpc messages and delegates them to the corresponding listeners or handlers.
uint32_t sendRouteRpcCall (CompType destComp, const TransportAddress &dest, const OverlayKey &destKey, BaseCallMessage *msg, cPolymorphic *context=NULL, RoutingType routingType=DEFAULT_ROUTING, simtime_t timeout=-1, int retries=0, int rpcId=-1, RpcListener *rpcListener=NULL)
 Routes a Remote-Procedure-Call message to an OverlayKey.
uint32_t sendRouteRpcCall (CompType destComp, const OverlayKey &destKey, BaseCallMessage *msg, cPolymorphic *context=NULL, RoutingType routingType=DEFAULT_ROUTING, simtime_t timeout=-1, int retries=0, int rpcId=-1, RpcListener *rpcListener=NULL)
 Routes a Remote-Procedure-Call message to an OverlayKey.
uint32_t sendRouteRpcCall (CompType destComp, const TransportAddress &dest, BaseCallMessage *msg, cPolymorphic *context=NULL, RoutingType routingType=DEFAULT_ROUTING, simtime_t timeout=-1, int retries=0, int rpcId=-1, RpcListener *rpcListener=NULL)
 Sends a Remote-Procedure-Call message using the overlay's UDP port
This replaces ROUTE_DIRECT calls!
uint32_t sendUdpRpcCall (const TransportAddress &dest, BaseCallMessage *msg, cPolymorphic *context=NULL, simtime_t timeout=-1, int retries=0, int rpcId=-1, RpcListener *rpcListener=NULL)
 Sends a Remote-Procedure-Call message to the underlay

uint32_t sendInternalRpcCall (CompType destComp, BaseCallMessage *msg, cPolymorphic *context=NULL, simtime_t timeout=-1, int retries=0, int rpcId=-1, RpcListener *rpcListener=NULL)
 Sends an internal Remote-Procedure-Call between two tiers

void cancelRpcMessage (uint32_t nonce)
 Cancels a Remote-Procedure-Call.
void cancelAllRpcs ()
 Cancels all RPCs.
void sendRpcResponse (TransportType transportType, CompType destComp, const TransportAddress &dest, const OverlayKey &destKey, BaseCallMessage *call, BaseResponseMessage *response)
 Send Remote-Procedure response message and deletes call message.
void sendRpcResponse (BaseCallMessage *call, BaseResponseMessage *response)
 Send Remote-Procedure response message to UDP and deletes call message.
int pingNode (const TransportAddress &dest, simtime_t timeout=-1, int retries=0, cPolymorphic *context=NULL, const char *caption="PING", RpcListener *rpcListener=NULL, int rpcId=-1, TransportType transportType=INVALID_TRANSPORT)
 ping a node by its TransportAddress
virtual bool handleRpcCall (BaseCallMessage *msg)
 Processes Remote-Procedure-Call invocation messages.
virtual CompType getThisCompType ()=0
 Return the component type of this module.
virtual void sendMessageToUDP (const TransportAddress &addr, cPacket *message)
virtual void pingResponse (PingResponse *pingResponse, cPolymorphic *context, int rpcId, simtime_t rtt)
virtual void pingTimeout (PingCall *pingCall, const TransportAddress &dest, cPolymorphic *context, int rpcId)
bool internalHandleMessage (cMessage *msg)

Protected Attributes

NodeHandle thisNode
 NodeHandle to this node.
BaseOverlayoverlay
bool debugOutput
 debug output ?
GlobalStatisticsglobalStatistics
 pointer to GlobalStatistics module in this node
CompType thisCompType
NeighborCacheneighborCache
 pointer to the neighbor cache
CryptoModulecryptoModule
 pointer to CryptoModule
int numPingSent
int bytesPingSent
int numPingResponseSent
int bytesPingResponseSent

Private Types

typedef UNORDERED_MAP< int,
RpcState
RpcStates

Private Member Functions

virtual void handleTimerEvent (cMessage *msg)
uint32_t sendRpcCall (TransportType transportType, CompType destComp, const TransportAddress &dest, const OverlayKey &destKey, BaseCallMessage *msg, cPolymorphic *context, RoutingType routingType, simtime_t timeout, int retries, int rpcId, RpcListener *rpcListener)
 Sends a Remote-Procedure-Call message to the underlay.
void sendRpcMessageWithTransport (TransportType transportType, CompType destComp, RoutingType routingType, const std::vector< TransportAddress > &sourceRoute, const OverlayKey &destKey, BaseRpcMessage *message)
virtual void internalSendRouteRpc (BaseRpcMessage *message, const OverlayKey &destKey, const std::vector< TransportAddress > &sourceRoute, RoutingType routingType)=0
virtual void internalSendRpcResponse (BaseCallMessage *call, BaseResponseMessage *response)=0
void pingRpcCall (PingCall *call)
void pingRpcResponse (PingResponse *response, cPolymorphic *context, int rpcId, simtime_t rtt)
void pingRpcTimeout (PingCall *pingCall, const TransportAddress &dest, cPolymorphic *context, int rpcId)

Private Attributes

int rpcsPending
RpcListenerdefaultRpcListener
RpcStates rpcStates
simtime_t rpcUdpTimeout
simtime_t rpcKeyTimeout
bool optimizeTimeouts
bool rpcExponentialBackoff

Detailed Description

Base class for RPCs.

Base class for RPCs.

Author:
Sebastian Mies
Ingmar Baumgart
Bernhard Heep
Gregoire Menuel

Definition at line 59 of file BaseRpc.h.


Member Typedef Documentation

typedef UNORDERED_MAP<int,RpcState> BaseRpc::RpcStates [private]

Definition at line 519 of file BaseRpc.h.


Constructor & Destructor Documentation

BaseRpc::BaseRpc (  ) 

Definition at line 52 of file BaseRpc.cc.

{
    defaultRpcListener = NULL;
    neighborCache = NULL;
    cryptoModule = NULL;
}


Member Function Documentation

void BaseRpc::cancelAllRpcs (  )  [protected]

Cancels all RPCs.

Definition at line 158 of file BaseRpc.cc.

Referenced by Pastry::changeState(), and finishRpcs().

{
    // stop all rpcs
    for (RpcStates::iterator i = rpcStates.begin();
        i != rpcStates.end(); i++) {
        cancelAndDelete(i->second.callMsg);
        cancelAndDelete(i->second.timeoutMsg);
        delete i->second.dest;
        i->second.dest = NULL;
        delete i->second.context;
        i->second.context = NULL;
    }
    rpcStates.clear();
}

void BaseRpc::cancelRpcMessage ( uint32_t  nonce  )  [protected]

Cancels a Remote-Procedure-Call.

Parameters:
nonce The nonce of the RPC

Definition at line 278 of file BaseRpc.cc.

Referenced by RecursiveLookup::abortLookup(), XmlRpcInterface::resetConnectionState(), and IterativeLookup::stop().

{
    if (rpcStates.count(nonce)==0)
        return;
    RpcState state = rpcStates[nonce];
    rpcStates.erase(nonce);
    cancelAndDelete(state.callMsg);
    cancelAndDelete(state.timeoutMsg);
    delete state.dest;
    state.dest = NULL;
    delete state.context;
    state.context = NULL;
}

void BaseRpc::finishRpcs (  )  [protected]

Deinitializes Remote-Procedure state.

Definition at line 147 of file BaseRpc.cc.

Referenced by BaseApp::~BaseApp(), and BaseOverlay::~BaseOverlay().

{
    cancelAllRpcs();

    // delete default rpc listener
    if (defaultRpcListener != NULL) {
        delete defaultRpcListener;
        defaultRpcListener = NULL;
    }
}

virtual CompType BaseRpc::getThisCompType (  )  [protected, pure virtual]

Return the component type of this module.

This method is overloaded by BaseOverlay/BaseApp and returns the appropriate component type of this module.

Returns:
the component type of this module

Referenced by initRpcs(), pingNode(), sendRpcCall(), and sendRpcMessageWithTransport().

const NodeHandle& BaseRpc::getThisNode (  )  [inline]

Returns the NodeHandle of this node.

Returns:
the NodeHandle of this node.

Definition at line 71 of file BaseRpc.h.

Referenced by Scribe::addChildToGroup(), IterativeLookup::addSibling(), BaseApp::callRoute(), Scribe::checkGroupEmpty(), RealWorldTestApp::deliver(), KBRTestApp::deliver(), Scribe::deliverALMDataToGroup(), PastryLeafSet::failedNode(), Scribe::forward(), KBRTestApp::forward(), PastryLeafSet::getBiggestNode(), BootstrapList::getBootstrapNode(), NeighborCache::getOverlayThisNode(), NeighborCache::getProx(), PastryLeafSet::getSmallestNode(), oversim::Nice::handleAppMessage(), Kademlia::handleBucketRefreshTimerExpired(), BaseApp::handleCommonAPIMessage(), CBRDHT::handleGetCAPIRequest(), DHT::handleGetRequest(), CBRDHT::handleGetResponse(), Scribe::handleJoinMessage(), Scribe::handleJoinResponse(), KBRTestApp::handleLookupResponse(), DHT::handleLookupResponse(), CBRDHT::handleLookupResponse(), BootstrapList::handleLookupResponse(), GIASearchApp::handleLowerMessage(), XmlRpcInterface::handleMessage(), BaseOverlay::handleMessage(), BaseApp::handleMessage(), SimMud::handleMove(), Kademlia::handleNodeGracefulLeaveNotification(), SimMud::handleOtherPlayerMove(), Scribe::handlePublishCall(), Scribe::handlePublishResponse(), DHT::handlePutRequest(), CBRDHT::handlePutRequest(), XmlRpcInterface::handleReadyMessage(), P2pns::handleReadyMessage(), IterativePathLookup::handleResponse(), Scribe::handleRpcResponse(), KBRTestApp::handleRpcResponse(), Kademlia::handleRpcResponse(), BootstrapList::handleRpcResponse(), SimpleGameClient::handleTimerEvent(), Scribe::handleTimerEvent(), P2pns::handleTimerEvent(), GIASearchApp::handleTimerEvent(), DHT::handleTimerEvent(), CBRDHT::handleTimerEvent(), Scribe::handleUpperMessage(), BaseOverlay::initialize(), SimpleGameClient::initializeApp(), Landmark::initializeApp(), BootstrapList::initializeApp(), BrooseBucket::initializeBucket(), PastryLeafSet::insertLeaf(), BaseOverlay::isMalicious(), BaseOverlay::join(), BrooseBucket::keyInRange(), XmlRpcInterface::localLookup(), IterativeLookup::lookup(), BaseOverlay::lookupRpc(), PastryLeafSet::mergeNode(), BrooseBucket::output(), P2pns::p2pnsRegisterRpc(), BootstrapList::pingResponse(), BootstrapList::pingTimeout(), BaseOverlay::route(), Kademlia::routingAdd(), Kademlia::routingBucketIndex(), BaseApp::sendMessageToUDP(), IterativePathLookup::sendRpc(), sendRpcCall(), sendRpcResponse(), BaseOverlay::setOverlayReady(), Nps::setOwnLayer(), IterativeLookup::start(), IterativeLookup::stop(), Scribe::subscribeToGroup(), Scribe::update(), DHT::update(), and CBRDHT::update().

{ return thisNode; };

simtime_t BaseRpc::getUdpTimeout (  )  [inline]

Definition at line 73 of file BaseRpc.h.

{ return rpcUdpTimeout; };

bool BaseRpc::handleRpcCall ( BaseCallMessage msg  )  [protected, virtual]

Processes Remote-Procedure-Call invocation messages.


This method should be overloaded when the overlay provides RPC functionality.

Returns:
true, if rpc has been handled

Definition at line 526 of file BaseRpc.cc.

Referenced by internalHandleRpcMessage().

{
    return false;
}

void BaseRpc::handleTimerEvent ( cMessage *  msg  )  [private, virtual]

Definition at line 86 of file BaseRpc.cc.

Referenced by internalHandleMessage().

{
    // ...
}

void BaseRpc::initRpcs (  )  [protected]

Initializes Remote-Procedure state.

Definition at line 92 of file BaseRpc.cc.

Referenced by BaseOverlay::initialize(), and BaseApp::initialize().

{
    // set friend modules
    globalStatistics = GlobalStatisticsAccess().get();

    rpcUdpTimeout = par("rpcUdpTimeout");
    rpcKeyTimeout = par("rpcKeyTimeout");
    optimizeTimeouts = par("optimizeTimeouts");
    rpcExponentialBackoff = par("rpcExponentialBackoff");

    rpcsPending = 0;
    rpcStates.clear();

    defaultRpcListener = new RpcListener();

    //set ping cache
    numPingSent = 0;
    bytesPingSent = 0;
    numPingResponseSent = 0;
    bytesPingResponseSent = 0;

    WATCH(numPingSent);
    WATCH(bytesPingSent);
    WATCH(numPingResponseSent);
    WATCH(bytesPingResponseSent);

    // set overlay pointer
    overlay = OverlayAccess().get(this);

    // register component
    thisCompType = getThisCompType();
    overlay->registerComp(thisCompType, this);

    // get pointer to the neighborCache
    cModule *mod = getParentModule();
    while (neighborCache == NULL) {
        neighborCache = (NeighborCache*)mod->getSubmodule("neighborCache");
        mod = mod->getParentModule();
        if (!mod)
            throw cRuntimeError("BaseRpc::initRpc: "
                                "Module type contains no NeighborCache!");
    }

    // get pointer to the cryptoModule
    mod = getParentModule();
    cryptoModule = NULL;
    while (cryptoModule == NULL) {
        cryptoModule = (CryptoModule*)mod->getSubmodule("cryptoModule");
        mod = mod->getParentModule();
        if (!mod)
            throw cRuntimeError("BaseRpc::initRpc: CryptoModule not found!");
    }
}

bool BaseRpc::internalHandleMessage ( cMessage *  msg  )  [protected]

Definition at line 59 of file BaseRpc.cc.

Referenced by BaseOverlay::handleMessage(), and BaseApp::handleMessage().

{
    // process self-messages and RPC-timeouts
    if (msg->isSelfMessage()) {
        // process rpc self-messages
        BaseRpcMessage* rpcMessage = dynamic_cast<BaseRpcMessage*>(msg);
        if (rpcMessage != NULL) {
            internalHandleRpcMessage(rpcMessage);
            return true;
        }
        // process all other self-messages
        handleTimerEvent(msg);
        return true;
    }

    // process RPC messages
    BaseRpcMessage* rpcMessage = dynamic_cast<BaseRpcMessage*>(msg);
    if (rpcMessage != NULL) {
        internalHandleRpcMessage(rpcMessage);
        return true;
    }

    // other messages are processed by derived classes
    // (e.g. BaseOverlay / BaseApp)
    return false;
}

bool BaseRpc::internalHandleRpcCall ( BaseCallMessage msg  )  [protected, virtual]

Handles internal rpc requests.


This method is used to implement basic functionality in the BaseRpc.

Parameters:
msg The call message
Returns:
bool true, if call has been handled.

Definition at line 491 of file BaseRpc.cc.

Referenced by internalHandleRpcMessage().

{
    RPC_SWITCH_START( msg );
    RPC_DELEGATE( Ping, pingRpcCall );
    RPC_SWITCH_END( );

    return RPC_HANDLED;
}

void BaseRpc::internalHandleRpcMessage ( BaseRpcMessage msg  )  [protected, virtual]

Handles incoming rpc messages and delegates them to the corresponding listeners or handlers.

Parameters:
msg The message to handle.

Definition at line 293 of file BaseRpc.cc.

Referenced by BaseOverlay::handleBaseOverlayMessage(), BaseApp::handleCommonAPIMessage(), XmlRpcInterface::handleMessage(), and internalHandleMessage().

{
    // check if this is a rpc call message
    BaseCallMessage* rpCall = dynamic_cast<BaseCallMessage*>(msg);
    if (rpCall != NULL) {
        // verify the message signature
        //cryptoModule->verifyMessage(msg);

        OverlayCtrlInfo* overlayCtrlInfo =
            dynamic_cast<OverlayCtrlInfo*>(msg->getControlInfo());

        if (overlayCtrlInfo && overlayCtrlInfo->getSrcRoute().isUnspecified() &&
            (!overlayCtrlInfo->getLastHop().isUnspecified())) {
            overlayCtrlInfo->setSrcRoute(NodeHandle(msg->getSrcNode().getKey(),
                                               overlayCtrlInfo->getLastHop()));
        }

        bool rpcHandled = true;
        if (!handleRpcCall(rpCall)) rpcHandled = internalHandleRpcCall(rpCall);
        if (!rpcHandled) {
            EV << "[BaseRpc::internalHandleRpcMessage() @ " << thisNode.getIp()
               << " (" << thisNode.getKey().toString(16) << ")]\n"
               << "    Error: RPC '" << msg->getFullName()<< "' was not handled"
               << endl;
            delete msg;
        }
        return;
    }

    // get nonce
    int nonce = msg->getNonce();

    // nonce known? no -> delete message and return
    if (rpcStates.count(nonce)==0) {
        EV << "[BaseRpc::internalHandleRpcMessage() @ " << thisNode.getIp()
           << " " << thisNode.getKey().toString(16) << ")]\n"
           << "    RPC: Nonce Unknown"
           << endl;
        delete msg;
        return;
    }

    // get state and remove from map
    RpcState state = rpcStates[nonce];
    rpcStates.erase(nonce);

    // is timeout message?
    if (msg->isSelfMessage() &&
        (dynamic_cast<RpcTimeoutMessage*>(msg) != NULL)) {
        // yes-> inform listener

        // retry?
        state.retries--;
        if (state.retries>=0) {
            // TODO: cleanup code to have only one type for source routes
            std::vector<TransportAddress> sourceRoute;
            sourceRoute.push_back(*state.dest);
            if (state.dest->getSourceRouteSize() > 0) {
                sourceRoute.insert(sourceRoute.begin(),
                                   state.dest->getSourceRoute().rend(),
                                   state.dest->getSourceRoute().rbegin());
                // remove the original source route from the destination
                sourceRoute.back().clearSourceRoute();
            }

            sendRpcMessageWithTransport(state.transportType, state.destComp,
                                        state.routingType,
                                        sourceRoute,
                                        state.destKey,
                                        dynamic_cast<BaseCallMessage*>
                                        (state.callMsg->dup()));

            if (rpcExponentialBackoff) {
                state.rto *= 2;
            }

            if (state.rto!=0)
                scheduleAt(simTime() + state.rto, msg);

            state.timeSent = simTime();
            rpcStates[nonce] = state;
            return;
        }
        EV << "[BaseRpc::internalHandleRpcMessage() @ " << thisNode.getIp()
           << " " << thisNode.getKey().toString(16) << ")]\n"
           << "    RPC timeout (" << state.callMsg->getName() << ")"
           << endl;

        // inform neighborcache
        if (state.transportType == UDP_TRANSPORT ||
            (!state.dest->isUnspecified() && state.destKey.isUnspecified())) {
            neighborCache->setNodeTimeout(*state.dest);
        }

        // inform listener
        if (state.listener != NULL)
            state.listener->handleRpcTimeout(state);

        // inform overlay
        internalHandleRpcTimeout(state.callMsg, *state.dest, state.context,
                                 state.id, state.destKey);
        handleRpcTimeout(state);

    } else { // no-> handle rpc response

        // verify the message signature
        //cryptoModule->verifyMessage(msg);

        OverlayCtrlInfo* overlayCtrlInfo =
            dynamic_cast<OverlayCtrlInfo*>(msg->getControlInfo());

        if (overlayCtrlInfo && overlayCtrlInfo->getSrcRoute().isUnspecified() &&
                 (!overlayCtrlInfo->getLastHop().isUnspecified())) {
             overlayCtrlInfo->setSrcRoute(NodeHandle(msg->getSrcNode().getKey(),
                                                overlayCtrlInfo->getLastHop()));
        }

        // drop responses with wrong source key
        if (state.destKey.isUnspecified()) {
            const NodeHandle* stateHandle =
                dynamic_cast<const NodeHandle*>(state.dest);
                if (stateHandle != NULL &&
                    stateHandle->getKey() != msg->getSrcNode().getKey()) {

                    EV << "[BaseRpc::internalHandleRpcMessage() @ "
                       << thisNode.getIp()
                       << " " << thisNode.getKey().toString(16) << ")]\n"
                       << "    Dropping RPC: Invalid source key"
                       << endl;

                    // restore state to trigger timeout message
                    rpcStates[nonce] = state;
                    delete msg;
                    return;
                }
        }

        // get parameters
        simtime_t rtt = simTime() - state.timeSent;
        BaseResponseMessage* response
            = dynamic_cast<BaseResponseMessage*>(msg);

        //if (state.transportType == UDP_TRANSPORT)
        //    globalStatistics->recordOutVector("BaseRpc: UDP Round Trip Time",
        //                                      rtt);

        // neighborCache/ncs stuff
        if (state.transportType == UDP_TRANSPORT ||
            (state.transportType != INTERNAL_TRANSPORT &&
             response->getCallHopCount() == 1)) {
            unsigned int ncsArraySize = response->getNcsInfoArraySize();
            if (ncsArraySize > 0) {
                std::vector<double> tempCoords(ncsArraySize);
                for (uint8_t i = 0; i < ncsArraySize; i++) {
                    tempCoords[i] = response->getNcsInfo(i);
                }
                AbstractNcsNodeInfo* coords =
                    neighborCache->getNcsAccess().createNcsInfo(tempCoords);

                OverlayCtrlInfo* ctrlInfo =
                    dynamic_cast<OverlayCtrlInfo*>(response->getControlInfo());

                neighborCache->updateNode(response->getSrcNode(), rtt,
                                          (ctrlInfo ?
                                           ctrlInfo->getSrcRoute() :
                                           NodeHandle::UNSPECIFIED_NODE),
                                           coords);
            } else {
                neighborCache->updateNode(response->getSrcNode(), rtt);
            }
        }

        // inform listener
        if (state.listener != NULL)
            state.listener->handleRpcResponse(response, state, rtt);

        // inform overlay
        internalHandleRpcResponse(response, state.context, state.id, rtt);
        handleRpcResponse(response, state, rtt);

        // delete response
        delete response->removeControlInfo();
        delete response;
    }

    // delete messages
    delete state.callMsg;
    cancelAndDelete(state.timeoutMsg);
    delete state.dest;

    // clean up pointers
    state.dest = NULL;
    state.context = NULL;
    state.callMsg = NULL;
    state.timeoutMsg = NULL;
}

void BaseRpc::internalHandleRpcResponse ( BaseResponseMessage msg,
cPolymorphic *  context,
int  rpcId,
simtime_t  rtt 
) [protected, virtual]

Handles rpc responses internal in base classes

This method is used to implement basic functionality in the BaseRpc.

Parameters:
msg The call message
context Pointer to an optional state object. The object has to be handled/deleted by the internalHandleRpcResponse() code
rpcId The ID of the call
rtt the time between sending the call and receiving the response

Definition at line 500 of file BaseRpc.cc.

Referenced by internalHandleRpcMessage().

{
    // call rpc stubs
    RPC_SWITCH_START( msg );
    RPC_ON_RESPONSE( Ping ) {
        pingRpcResponse(_PingResponse, context, rpcId, rtt);
    }
    RPC_SWITCH_END( );
}

void BaseRpc::internalHandleRpcTimeout ( BaseCallMessage msg,
const TransportAddress dest,
cPolymorphic *  context,
int  rpcId,
const OverlayKey destKey 
) [protected, virtual]

Handles rpc timeouts internal in base classes

This method is used to implement basic functionality in the BaseRpc.

Parameters:
msg The call message
dest The node that did not response
context Pointer to an optional state object. The object has to be handled/deleted by the internalHandleRpcResponse() code
rpcId The ID of the call
destKey The key of the call if used
Returns:
bool true, if call has been handled.
Todo:
return bool?

Definition at line 512 of file BaseRpc.cc.

Referenced by internalHandleRpcMessage().

{
    RPC_SWITCH_START( msg ) {
        RPC_ON_CALL( Ping ) {
            pingRpcTimeout(_PingCall, dest, context, rpcId);
        }
    }
    RPC_SWITCH_END( )
}

virtual void BaseRpc::internalSendRouteRpc ( BaseRpcMessage message,
const OverlayKey destKey,
const std::vector< TransportAddress > &  sourceRoute,
RoutingType  routingType 
) [private, pure virtual]
virtual void BaseRpc::internalSendRpcResponse ( BaseCallMessage call,
BaseResponseMessage response 
) [private, pure virtual]

Referenced by sendRpcResponse().

int BaseRpc::pingNode ( const TransportAddress dest,
simtime_t  timeout = -1,
int  retries = 0,
cPolymorphic *  context = NULL,
const char *  caption = "PING",
RpcListener rpcListener = NULL,
int  rpcId = -1,
TransportType  transportType = INVALID_TRANSPORT 
) [protected]

ping a node by its TransportAddress

Statistics are collected by this method.

Parameters:
dest the node to ping
timeout RPC timeout
retries how often to retry after timeout
context a pointer to an arbitrary cPolymorphic object, which can be used to store additional state
caption special name for the ping call (instead of "PING")
rpcListener RPC Listener
rpcId RPC id
transportType The transport used for this RPC
Returns:
the nonce of the sent ping call

Definition at line 701 of file BaseRpc.cc.

Referenced by IterativeLookup::addSibling(), Pastry::changeState(), BootstrapList::handleBootstrapListTimerExpired(), Broose::handleBucketTimerExpired(), oversim::Chord::handleStabilizeTimerExpired(), P2pns::handleTimerEvent(), KBRTestApp::handleTimerEvent(), Kademlia::handleTimerEvent(), oversim::Chord::handleTimerEvent(), Pastry::handleUDPMessage(), Kademlia::joinOverlay(), NeighborCache::queryProx(), and Kademlia::routingAdd().

{
    PingCall* call = new PingCall(caption);
    call->setBitLength(PINGCALL_L(call));
    RECORD_STATS(numPingSent++; bytesPingSent += call->getByteLength());

    if (transportType == UDP_TRANSPORT ||
        (transportType != ROUTE_TRANSPORT &&
         getThisCompType() == OVERLAY_COMP)) {
        return sendUdpRpcCall(dest, call, context, timeout, retries, rpcId,
                       rpcListener);
    } else {
        return sendRouteRpcCall(getThisCompType(), dest, call, context,
                         DEFAULT_ROUTING, timeout, retries, rpcId,
                         rpcListener);
    }
}

void BaseRpc::pingResponse ( PingResponse pingResponse,
cPolymorphic *  context,
int  rpcId,
simtime_t  rtt 
) [protected, virtual]

Definition at line 658 of file BaseRpc.cc.

Referenced by pingRpcResponse().

{
}

void BaseRpc::pingRpcCall ( PingCall call  )  [private]

Definition at line 668 of file BaseRpc.cc.

Referenced by internalHandleRpcCall().

{
    std::string pongName(call->getName());
    if (pongName == "PING")
        pongName = "PONG";
    else {
        pongName = "PONG: [ ";
        pongName += call->getName();
        pongName += " ]";
    }

    PingResponse* response = new PingResponse(pongName.c_str());
    response->setBitLength(PINGRESPONSE_L(response));
    RECORD_STATS(numPingResponseSent++; bytesPingResponseSent +=
        response->getByteLength());

    sendRpcResponse(call, response );
}

void BaseRpc::pingRpcResponse ( PingResponse response,
cPolymorphic *  context,
int  rpcId,
simtime_t  rtt 
) [private]

Definition at line 687 of file BaseRpc.cc.

Referenced by internalHandleRpcResponse().

{
    pingResponse(response, context, rpcId, rtt);
}

void BaseRpc::pingRpcTimeout ( PingCall pingCall,
const TransportAddress dest,
cPolymorphic *  context,
int  rpcId 
) [private]

Definition at line 693 of file BaseRpc.cc.

Referenced by internalHandleRpcTimeout().

{
    pingTimeout(pingCall, dest, context, rpcId);
}

void BaseRpc::pingTimeout ( PingCall pingCall,
const TransportAddress dest,
cPolymorphic *  context,
int  rpcId 
) [protected, virtual]

Definition at line 663 of file BaseRpc.cc.

Referenced by pingRpcTimeout().

{
}

uint32_t BaseRpc::sendInternalRpcCall ( CompType  destComp,
BaseCallMessage msg,
cPolymorphic *  context = NULL,
simtime_t  timeout = -1,
int  retries = 0,
int  rpcId = -1,
RpcListener rpcListener = NULL 
) [inline, protected]

Sends an internal Remote-Procedure-Call between two tiers

If no timeout is provided, a default value of globalParameters.rpcUdpTimeout for underlay and globalParameters.rpcKeyTimeout for a overlay rpc is used. After a timeout the message gets retransmitted for at maximum retries times. The destKey attribute is kept untouched.

Parameters:
destComp Destination component
msg RPC Call Message
context a pointer to an arbitrary cPolymorphic object, which can be used to store additional state
timeout RPC timeout in seconds (-1=use default value, 0=no timeout)
retries How often we try to resent rpc call, if it gets lost
rpcId RPC id
rpcListener RPC Listener
Returns:
The nonce of the RPC

Definition at line 326 of file BaseRpc.h.

Referenced by P2pns::handleDHTgetCAPIResponse(), DHT::handleGetCAPIRequest(), CBRDHT::handleGetCAPIRequest(), DHT::handlePutCAPIRequest(), CBRDHT::handlePutCAPIRequest(), P2pns::handleTimerEvent(), KBRTestApp::handleTimerEvent(), DHTTestApp::handleTimerEvent(), DHTTestApp::handleTraceMessage(), BootstrapList::locateBootstrapNode(), P2pns::p2pnsRegisterRpc(), P2pns::p2pnsResolveRpc(), P2pns::registerId(), XmlRpcInterface::sendInternalRpcWithTimeout(), P2pns::tunnel(), and CBRDHT::update().

    {
        return sendRpcCall(INTERNAL_TRANSPORT, destComp,
                           TransportAddress::UNSPECIFIED_NODE,
                           OverlayKey::UNSPECIFIED_KEY, msg, context,
                           NO_OVERLAY_ROUTING, timeout, retries, rpcId,
                           rpcListener);
    }

virtual void BaseRpc::sendMessageToUDP ( const TransportAddress addr,
cPacket *  message 
) [inline, protected, virtual]

Definition at line 429 of file BaseRpc.h.

Referenced by sendRpcMessageWithTransport().

    {
        throw cRuntimeError("sendMessageToUDP() not implemented");
    }

uint32_t BaseRpc::sendRouteRpcCall ( CompType  destComp,
const OverlayKey destKey,
BaseCallMessage msg,
cPolymorphic *  context = NULL,
RoutingType  routingType = DEFAULT_ROUTING,
simtime_t  timeout = -1,
int  retries = 0,
int  rpcId = -1,
RpcListener rpcListener = NULL 
) [inline, protected]

Routes a Remote-Procedure-Call message to an OverlayKey.


If no timeout is provided, a default value of globalParameters.rpcUdpTimeout for underlay and globalParameters.rpcKeyTimeout for a overlay rpc is used. After a timeout the message gets retransmitted for at maximum retries times. The destKey attribute is kept untouched.

Parameters:
destComp The destination component
destKey Destination OverlayKey
msg RPC Call Message
context a pointer to an arbitrary cPolymorphic object, which can be used to store additional state
routingType KBR routing type
timeout RPC timeout in seconds (-1=use default value, 0=no timeout)
retries How often we try to resent rpc call, if it gets lost
rpcId RPC id
rpcListener RPC Listener
Returns:
The nonce of the RPC

Definition at line 219 of file BaseRpc.h.

    {
        return sendRpcCall(ROUTE_TRANSPORT, destComp,
                           TransportAddress::UNSPECIFIED_NODE,
                           destKey, msg, context, routingType, timeout,
                           retries, rpcId, rpcListener);
    }

uint32_t BaseRpc::sendRouteRpcCall ( CompType  destComp,
const TransportAddress dest,
BaseCallMessage msg,
cPolymorphic *  context = NULL,
RoutingType  routingType = DEFAULT_ROUTING,
simtime_t  timeout = -1,
int  retries = 0,
int  rpcId = -1,
RpcListener rpcListener = NULL 
) [inline, protected]

Sends a Remote-Procedure-Call message using the overlay's UDP port
This replaces ROUTE_DIRECT calls!

If no timeout is provided, a default value of globalParameters.rpcUdpTimeout for underlay and globalParameters.rpcKeyTimeout for a overlay rpc is used. After a timeout the message gets retransmitted for at maximum retries times. The destKey attribute is kept untouched.

Parameters:
destComp The destination component
dest Destination node handle (may contain a source route)
msg RPC Call Message
context a pointer to an arbitrary cPolymorphic object, which can be used to store additional state
routingType KBR routing type
timeout RPC timeout
retries How often we try to resent rpc call, if it gets lost
rpcId RPC id
rpcListener RPC Listener
Returns:
The nonce of the RPC

Definition at line 258 of file BaseRpc.h.

    {
        return sendRpcCall(ROUTE_TRANSPORT, destComp, dest,
                           OverlayKey::UNSPECIFIED_KEY, msg, context,
                           routingType, timeout, retries, rpcId, rpcListener);
    }

uint32_t BaseRpc::sendRouteRpcCall ( CompType  destComp,
const TransportAddress dest,
const OverlayKey destKey,
BaseCallMessage msg,
cPolymorphic *  context = NULL,
RoutingType  routingType = DEFAULT_ROUTING,
simtime_t  timeout = -1,
int  retries = 0,
int  rpcId = -1,
RpcListener rpcListener = NULL 
) [inline, protected]

Routes a Remote-Procedure-Call message to an OverlayKey.


If no timeout is provided, a default value of globalParameters.rpcUdpTimeout for underlay and globalParameters.rpcKeyTimeout for a overlay rpc is used. After a timeout the message gets retransmitted for at maximum retries times. The destKey attribute is kept untouched.

Parameters:
destComp The destination component
dest Destination node handle (if specified, used as first hop)
destKey Destination OverlayKey (if unspecified, the message will be sent to dest using the overlay's UDP port)
msg RPC Call Message
context a pointer to an arbitrary cPolymorphic object, which can be used to store additional state
routingType KBR routing type
timeout RPC timeout in seconds (-1=use default value, 0=no timeout)
retries How often we try to resent rpc call, if it gets lost
rpcId RPC id
rpcListener RPC Listener
Returns:
The nonce of the RPC

Definition at line 178 of file BaseRpc.h.

Referenced by Scribe::deliverALMDataToRoot(), MyOverlay::getNeighbors(), oversim::Koorde::handleDeBruijnTimerExpired(), oversim::Chord::handleFixFingersTimerExpired(), CBRDHT::handleGetCAPIRequest(), DHT::handleGetResponse(), CBRDHT::handleGetResponse(), Scribe::handleJoinMessage(), oversim::Chord::handleJoinTimerExpired(), Broose::handleJoinTimerExpired(), DHT::handleLookupResponse(), CBRDHT::handleLookupResponse(), DHT::handleRpcTimeout(), CBRDHT::handleRpcTimeout(), Scribe::handleTimerEvent(), KBRTestApp::handleTimerEvent(), oversim::Chord::joinForeignPartition(), RecursiveLookup::lookup(), pingNode(), Nps::sendCoordsReqCall(), DHT::sendMaintenancePutCall(), Scribe::subscribeToGroup(), Scribe::update(), and CBRDHT::update().

    {
        if (dest.isUnspecified() && destKey.isUnspecified())
            opp_error("BaseRpc::sendRouteRpcCall() with both key and "
                      "transportAddress unspecified!");
        return sendRpcCall(ROUTE_TRANSPORT, destComp, dest, destKey, msg,
                           context, routingType, timeout, retries,
                           rpcId, rpcListener);
    }

uint32_t BaseRpc::sendRpcCall ( TransportType  transportType,
CompType  destComp,
const TransportAddress dest,
const OverlayKey destKey,
BaseCallMessage msg,
cPolymorphic *  context,
RoutingType  routingType,
simtime_t  timeout,
int  retries,
int  rpcId,
RpcListener rpcListener 
) [private]

Sends a Remote-Procedure-Call message to the underlay.


USE ONE OF THE WRAPPER FUNCTIONS INSTEAD:
sendRouteRpcCall(), sendInternalRpcCall(), or sendUdpRpcCall()

If no timeout is provided, a default value of globalParameters.rpcUdpTimeout for underlay and globalParameters.rpcKeyTimeout for a overlay rpc is used. Internal RPCs don't have a default timeout. After a timeout the message gets retransmitted for at maximum retries times. The destKey attribute is kept untouched.

Parameters:
transportType The type of transport
destComp The destination component
dest Destination node handle (may contain a source route)
destKey route the RPC to the node that is responsible for destkey
msg RPC Call Message
context a pointer to an arbitrary cPolymorphic object, which can be used to store additional state
routingType KBR routing type
timeout RPC timeout in seconds (-1=use default value, 0=no timeout)
retries How often we try to resent rpc call, if it gets lost
rpcId RPC id
rpcListener RPC Listener (callback handler)
Returns:
The nonce of the RPC

Definition at line 173 of file BaseRpc.cc.

Referenced by sendInternalRpcCall(), sendRouteRpcCall(), and sendUdpRpcCall().

{
    // create nonce, timeout and set default parameters
    uint32_t nonce;
    do {
        nonce = intuniform(1, 2147483647);
    } while (rpcStates.count(nonce) > 0);

    if (timeout == -1) {
        switch (transportType) {
        case INTERNAL_TRANSPORT:
            timeout = 0;
            break;
        case UDP_TRANSPORT:
            if (optimizeTimeouts) {
                timeout = neighborCache->getNodeTimeout(dest);
                if (timeout == -1) timeout = rpcUdpTimeout;
            } else timeout = rpcUdpTimeout;
            break;
        case ROUTE_TRANSPORT:
            timeout = (destKey.isUnspecified() ?
                       rpcUdpTimeout :
                       rpcKeyTimeout);
            break;
        default:
            throw cRuntimeError("BaseRpc::sendRpcMessage(): "
                                "Unknown RpcTransportType!");
        }
    }

    if (rpcListener == NULL)
        rpcListener = defaultRpcListener;

    // create state
    RpcState state;
    state.id = rpcId;
    state.timeSent = simTime();
    state.dest = dest.dup();
    state.destKey = destKey;
    state.srcComp = getThisCompType();
    state.destComp = destComp;
    state.listener = rpcListener;
    state.timeoutMsg = new RpcTimeoutMessage();
    state.timeoutMsg->setNonce(nonce);
    state.retries = retries;
    state.rto = timeout;
    state.transportType = transportType;
    //state.transportType = (destKey.isUnspecified() && (dest.getSourceRouteSize() == 0)
    //        ? UDP_TRANSPORT : transportType); //test
    state.routingType = routingType;
    state.context = context;

    if (rpcStates.count(nonce) > 0)
        throw cRuntimeError("RPC nonce collision");

    // set message parameters
    msg->setNonce(nonce);
    if (transportType == ROUTE_TRANSPORT)
        msg->setSrcNode(overlay->getThisNode());
    else
        msg->setSrcNode(thisNode);
    msg->setType(RPC);

    // sign the message
    // if (transportType != INTERNAL_TRANSPORT) cryptoModule->signMessage(msg);

    // save copy of call message in RpcState
    state.callMsg = dynamic_cast<BaseCallMessage*>(msg->dup());
    assert(!msg->getEncapsulatedPacket() || !msg->getEncapsulatedPacket()->getControlInfo());

    // register state
    rpcStates[nonce] = state;

    // schedule timeout message
    if (state.rto != 0)
        scheduleAt(simTime() + state.rto, state.timeoutMsg);

    // TODO: cleanup code to have only one type for source routes
    std::vector<TransportAddress> sourceRoute;
    sourceRoute.push_back(dest);
    if (dest.getSourceRouteSize() > 0) {
        state.transportType = transportType = ROUTE_TRANSPORT;
        sourceRoute.insert(sourceRoute.begin(), dest.getSourceRoute().rend(),
                          dest.getSourceRoute().rbegin());
        // remove the original source route from the destination
        sourceRoute.back().clearSourceRoute();
    }
    sendRpcMessageWithTransport(transportType, destComp, routingType,
                                sourceRoute, destKey, msg);

    return nonce;
}

void BaseRpc::sendRpcMessageWithTransport ( TransportType  transportType,
CompType  destComp,
RoutingType  routingType,
const std::vector< TransportAddress > &  sourceRoute,
const OverlayKey destKey,
BaseRpcMessage message 
) [private]

Definition at line 619 of file BaseRpc.cc.

Referenced by internalHandleRpcMessage(), sendRpcCall(), and sendRpcResponse().

{
    switch (transportType) {
    case UDP_TRANSPORT: {
        sendMessageToUDP(sourceRoute[0], message);
        break;
    }
    case ROUTE_TRANSPORT: {
        internalSendRouteRpc(message, destKey,
                             sourceRoute, routingType);
        break;
    }
    case INTERNAL_TRANSPORT: {
        cGate *destCompGate = overlay->getCompRpcGate(destComp);
        if (destCompGate == NULL) {
            throw cRuntimeError("BaseRpc::sendRpcMessageWithTransport():"
                                    " INTERNAL_RPC to unknown RpcCompType!");
        }
        OverlayCtrlInfo *overlayCtrlInfo = new OverlayCtrlInfo();
        overlayCtrlInfo->setSrcComp(getThisCompType());
        overlayCtrlInfo->setDestComp(destComp);
        overlayCtrlInfo->setTransportType(INTERNAL_TRANSPORT);
        message->setControlInfo(overlayCtrlInfo);
        sendDirect(message, destCompGate);
        break;
    }
    default:
        throw cRuntimeError("BaseRpc::sendRpcMessageWithTransport: "
                                "invalid transportType!");
        break;
    }
}

void BaseRpc::sendRpcResponse ( BaseCallMessage call,
BaseResponseMessage response 
) [protected]

Send Remote-Procedure response message to UDP and deletes call message.

Parameters:
call The corresponding call message to the response
response The response message

Definition at line 599 of file BaseRpc.cc.

{
    const TransportAddress* destNode = &(call->getSrcNode());
    const OverlayKey* destKey = &(call->getSrcNode().getKey());

    OverlayCtrlInfo* overlayCtrlInfo =
        dynamic_cast<OverlayCtrlInfo*>(call->getControlInfo());

    // "magic" transportType selection: internal
    if (overlayCtrlInfo &&
        overlayCtrlInfo->getTransportType() == INTERNAL_TRANSPORT) {
        sendRpcResponse(INTERNAL_TRANSPORT,
                        static_cast<CompType>(overlayCtrlInfo->getSrcComp()),
                        *destNode, *destKey, call, response);
    } else {
        internalSendRpcResponse(call, response);
    }
}

void BaseRpc::sendRpcResponse ( TransportType  transportType,
CompType  destComp,
const TransportAddress dest,
const OverlayKey destKey,
BaseCallMessage call,
BaseResponseMessage response 
) [protected]

Send Remote-Procedure response message and deletes call message.

Parameters:
transportType The transport used for this RPC
destComp Destination component
dest The TransportAddress of the destination (hint for ROUTE_TRANSPORT)
destKey The destination key for a ROUTE_TRANSPORT
call The corresponding call message to the response
response The response message

Definition at line 531 of file BaseRpc.cc.

Referenced by Nps::coordsReqRpc(), BaseOverlay::failedNodeRpc(), BaseOverlay::findNodeRpc(), PubSubMMOG::handleAdoptChildCall(), PubSubMMOG::handleBackupCall(), Broose::handleBucketRequestRpc(), P2pns::handleDHTgetCAPIResponse(), P2pns::handleDHTputCAPIResponse(), NTree::handleDivideCall(), DHT::handleDumpDhtRequest(), CBRDHT::handleDumpDhtRequest(), DHT::handleGetRequest(), CBRDHT::handleGetRequest(), DHT::handleGetResponse(), CBRDHT::handleGetResponse(), PubSubLobby::handleHelpCall(), PubSubMMOG::handleIntermediateCall(), PubSubLobby::handleJoin(), NTree::handleJoinCall(), Scribe::handleJoinMessage(), P2pns::handleLookupResponse(), DHT::handleLookupResponse(), CBRDHT::handleLookupResponse(), PubSubMMOG::handlePingCall(), NTree::handlePingCall(), Scribe::handlePublishCall(), DHT::handlePutRequest(), CBRDHT::handlePutRequest(), DHT::handlePutResponse(), CBRDHT::handlePutResponse(), PubSubLobby::handleRespCall(), MyOverlay::handleRpcCall(), oversim::Koorde::handleRpcDeBruijnRequest(), DHT::handleRpcTimeout(), CBRDHT::handleRpcTimeout(), PubSubMMOG::handleSubscriptionCall(), PubSubMMOG::handleTakeOver(), BaseOverlay::internalSendRpcResponse(), BaseApp::internalSendRpcResponse(), KBRTestApp::kbrTestCall(), SendToKeyListener::lookupFinished(), BaseOverlay::lookupRpc(), BaseOverlay::nextHopRpc(), pingRpcCall(), PubSubLobby::replaceResponsibleNode(), oversim::Chord::rpcFixfingers(), oversim::Chord::rpcJoin(), oversim::Chord::rpcNotify(), oversim::Chord::rpcStabilize(), and sendRpcResponse().

{
    if (call == NULL || response == NULL) {
        throw cRuntimeError("call or response = NULL!");
    }

    // vivaldi: set coordinates and error estimation in response
    if (neighborCache->sendBackOwnCoords()) { //TODO only for directly sent msgs
        std::vector<double> nodeCoord =
            neighborCache->getNcsAccess().getOwnNcsInfo();

        response->setNcsInfoArraySize(nodeCoord.size());
        for (uint32_t i = 0; i < nodeCoord.size(); i++) {
            response->setNcsInfo(i, nodeCoord[i]);
        }
    }

    assert(transportType == INTERNAL_TRANSPORT ||
           !dest.isUnspecified() ||
           !destKey.isUnspecified());

    if (transportType == ROUTE_TRANSPORT)
        response->setSrcNode(overlay->getThisNode());
    else
        response->setSrcNode(thisNode);
    response->setType(RPC);
    response->setNonce(call->getNonce());
    response->setStatType(call->getStatType());

    RoutingType routingType = NO_OVERLAY_ROUTING;
    OverlayCtrlInfo* overlayCtrlInfo = NULL;
    if (dynamic_cast<OverlayCtrlInfo*>(call->getControlInfo())) {
        overlayCtrlInfo =
            static_cast<OverlayCtrlInfo*>(call->removeControlInfo());
        response->setCallHopCount(overlayCtrlInfo->getHopCount());
    } else {
        delete call->removeControlInfo();
        response->setCallHopCount(1); // one udp hop (?)
    }

    // source routing
    std::vector<TransportAddress> sourceRoute;
    if (overlayCtrlInfo && transportType == ROUTE_TRANSPORT) {
        routingType =
            static_cast<RoutingType>(overlayCtrlInfo->getRoutingType());
        for (uint32_t i = overlayCtrlInfo->getVisitedHopsArraySize(); i > 0; --i) {
            sourceRoute.push_back(overlayCtrlInfo->getVisitedHops(i - 1));
        }
    }

    if (sourceRoute.size() == 0) {
        // empty visited hops list => direct response
        sourceRoute.push_back(dest);
    }

    sendRpcMessageWithTransport(transportType, compType,
                                routingType, sourceRoute,
                                destKey, response);
    delete overlayCtrlInfo;
    delete call;
}

uint32_t BaseRpc::sendUdpRpcCall ( const TransportAddress dest,
BaseCallMessage msg,
cPolymorphic *  context = NULL,
simtime_t  timeout = -1,
int  retries = 0,
int  rpcId = -1,
RpcListener rpcListener = NULL 
) [inline, protected]

Sends a Remote-Procedure-Call message to the underlay

If no timeout is provided, a default value of globalParameters.rpcUdpTimeout for underlay and globalParameters.rpcKeyTimeout for a overlay rpc is used. After a timeout the message gets retransmitted for at maximum retries times. The destKey attribute is kept untouched.

Parameters:
dest Destination node handle (may contain a source route)
msg RPC Call Message
context a pointer to an arbitrary cPolymorphic object, which can be used to store additional state
timeout RPC timeout in seconds (-1=use default value, 0=no timeout)
retries How often we try to resent rpc call, if it gets lost
rpcId RPC id
rpcListener RPC Listener
Returns:
The nonce of the RPC

Definition at line 293 of file BaseRpc.h.

Referenced by Broose::changeState(), PubSubMMOG::handleAppMessage(), NTree::handleAppMessage(), PubSubMMOG::handleBackupCallTimeout(), NTree::handleDivideCallTimeout(), PubSubMMOG::handleHelpResponse(), PubSubMMOG::handleIntermediateResponse(), PubSubLobby::handleJoin(), NTree::handleJoinCall(), PubSubMMOG::handleJoinResponse(), PubSubMMOG::handleMove(), oversim::Chord::handleNewSuccessorHint(), Kademlia::handleNodeGracefulLeaveNotification(), PubSubMMOG::handlePingCallTimeout(), PubSubLobby::handleRespCall(), PubSubMMOG::handleResponsibleNodeResponse(), oversim::Chord::handleRpcNotifyResponse(), oversim::Chord::handleRpcStabilizeResponse(), oversim::Chord::handleStabilizeTimerExpired(), PubSubMMOG::handleSubscriptionCall(), PubSubMMOG::handleSubscriptionCallTimeout(), IterativePathLookup::handleTimeout(), pingNode(), NTree::pingNodes(), NTree::sendMessage(), PubSubMMOG::sendMessageToChildren(), BaseOverlay::sendRouteMessage(), IterativeLookup::sendRpc(), Kademlia::sendSiblingFindNodeCall(), PubSubMMOG::takeOverSubspace(), and PubSubMMOG::unsubscribeChild().

    {
        return sendRpcCall(UDP_TRANSPORT, INVALID_COMP, dest,
                           OverlayKey::UNSPECIFIED_KEY, msg, context,
                           NO_OVERLAY_ROUTING, timeout, retries, rpcId,
                           rpcListener);
    }


Member Data Documentation

Definition at line 450 of file BaseRpc.h.

Referenced by BaseOverlay::finish(), initRpcs(), and pingRpcCall().

int BaseRpc::bytesPingSent [protected]

Definition at line 448 of file BaseRpc.h.

Referenced by BaseOverlay::finish(), initRpcs(), and pingNode().

pointer to CryptoModule

Definition at line 445 of file BaseRpc.h.

Referenced by BaseRpc(), and initRpcs().

bool BaseRpc::debugOutput [protected]

debug output ?

Definition at line 83 of file BaseRpc.h.

Definition at line 522 of file BaseRpc.h.

Referenced by BaseRpc(), finishRpcs(), initRpcs(), and sendRpcCall().

Definition at line 449 of file BaseRpc.h.

Referenced by BaseOverlay::finish(), initRpcs(), and pingRpcCall().

int BaseRpc::numPingSent [protected]

Definition at line 447 of file BaseRpc.h.

Referenced by BaseOverlay::finish(), initRpcs(), and pingNode().

bool BaseRpc::optimizeTimeouts [private]

Definition at line 525 of file BaseRpc.h.

Referenced by initRpcs(), and sendRpcCall().

Definition at line 80 of file BaseRpc.h.

Referenced by Scribe::addChildToGroup(), BaseApp::BaseApp(), BaseApp::callLocalLookup(), BaseApp::callNeighborSet(), BaseApp::callRoute(), Scribe::checkGroupEmpty(), Nps::coordsReqRpcResponse(), RealWorldTestApp::deliver(), KBRTestApp::deliver(), Scribe::deliverALMDataToGroup(), XmlRpcInterface::dumpDht(), Scribe::forward(), KBRTestApp::forward(), BaseApp::forwardResponse(), XmlRpcInterface::get(), BootstrapList::getBootstrapNode(), NeighborCache::getOverlayThisNode(), NeighborCache::getProx(), oversim::Nice::handleAppMessage(), BaseApp::handleCommonAPIMessage(), CBRDHT::handleGetCAPIRequest(), DHT::handleGetRequest(), CBRDHT::handleGetResponse(), Scribe::handleJoinMessage(), Scribe::handleJoinResponse(), KBRTestApp::handleLookupResponse(), DHT::handleLookupResponse(), CBRDHT::handleLookupResponse(), BootstrapList::handleLookupResponse(), GIASearchApp::handleLowerMessage(), XmlRpcInterface::handleMessage(), BaseApp::handleMessage(), SimMud::handleMove(), SimMud::handleOtherPlayerMove(), Scribe::handlePublishCall(), Scribe::handlePublishResponse(), DHT::handlePutRequest(), CBRDHT::handlePutRequest(), XmlRpcInterface::handleReadyMessage(), P2pns::handleReadyMessage(), Scribe::handleRpcResponse(), KBRTestApp::handleRpcResponse(), BootstrapList::handleRpcResponse(), SimpleGameClient::handleTimerEvent(), Scribe::handleTimerEvent(), P2pns::handleTimerEvent(), KBRTestApp::handleTimerEvent(), GIASearchApp::handleTimerEvent(), DHT::handleTimerEvent(), CBRDHT::handleTimerEvent(), Scribe::handleUpperMessage(), Nps::init(), XmlRpcInterface::initializeApp(), SimpleGameClient::initializeApp(), P2pns::initializeApp(), Landmark::initializeApp(), DHT::initializeApp(), CBRDHT::initializeApp(), BootstrapList::initializeApp(), initRpcs(), BaseApp::isSiblingFor(), XmlRpcInterface::joinOverlay(), XmlRpcInterface::localLookup(), BootstrapList::locateBootstrapNode(), XmlRpcInterface::lookup(), IterativeLookup::lookup(), XmlRpcInterface::p2pnsRegister(), P2pns::p2pnsRegisterRpc(), XmlRpcInterface::p2pnsResolve(), BootstrapList::pingResponse(), BootstrapList::pingTimeout(), XmlRpcInterface::put(), BootstrapList::removeBootstrapNode(), DHT::sendMaintenancePutCall(), BaseApp::sendMessageToUDP(), BaseApp::sendReadyMessage(), sendRpcCall(), sendRpcMessageWithTransport(), sendRpcResponse(), Nps::setOwnLayer(), Scribe::subscribeToGroup(), Scribe::update(), DHT::update(), and CBRDHT::update().

Definition at line 526 of file BaseRpc.h.

Referenced by initRpcs(), and internalHandleRpcMessage().

simtime_t BaseRpc::rpcKeyTimeout [private]

Definition at line 524 of file BaseRpc.h.

Referenced by initRpcs(), and sendRpcCall().

int BaseRpc::rpcsPending [private]

Definition at line 521 of file BaseRpc.h.

Referenced by initRpcs().

simtime_t BaseRpc::rpcUdpTimeout [private]

Definition at line 524 of file BaseRpc.h.

Referenced by initRpcs(), and sendRpcCall().

Definition at line 427 of file BaseRpc.h.

Referenced by BaseApp::callRoute(), and initRpcs().

NodeHandle to this node.

Definition at line 73 of file BaseRpc.h.

Referenced by Quon::addSite(), BasePastry::baseChangeState(), BasePastry::baseInit(), oversim::Nice::BasicJoinLayer(), BaseOverlay::bindToPort(), BaseApp::bindToPort(), MyOverlay::callbackNeighbors(), MyOverlay::callbackTimeout(), BaseApp::callRoute(), BaseOverlay::callUpdate(), Quon::changeState(), Pastry::changeState(), oversim::Nice::changeState(), Gia::changeState(), oversim::Chord::changeState(), Broose::changeState(), Bamboo::changeState(), NTree::checkParentTimeout(), Pastry::checkProxCache(), oversim::Chord::closestPreceedingNode(), oversim::Nice::ClusterMerge(), oversim::Nice::ClusterMergeRequest(), oversim::Nice::ClusterSplit(), NTree::collapseTree(), Nps::coordsReqRpcResponse(), Quon::deleteSite(), MyApplication::deliver(), Broose::displayBucketState(), NTree::divideNode(), Bamboo::doGlobalTuning(), Pastry::doJoinUpdate(), Bamboo::doLocalTuning(), Pastry::doRoutingTableMaintenance(), Pastry::doSecondStage(), Pastry::endProcessingState(), oversim::Koorde::findDeBruijnHop(), MyOverlay::findNode(), oversim::Koorde::findNode(), Kademlia::findNode(), oversim::Chord::findNode(), Broose::findNode(), BasePastry::findNode(), BaseOverlay::findNodeRpc(), oversim::Chord::finishOverlay(), BasePastry::finishOverlay(), oversim::Nice::getHighestLeaderLayer(), oversim::Nice::getMaxDistance(), oversim::Nice::getMeanDistance(), MyOverlay::getNeighbors(), getThisNode(), oversim::Nice::gracefulLeave(), NTree::handleAddMessage(), PubSubMMOG::handleAdoptChildCall(), PubSubMMOG::handleAdoptChildResponse(), Quon::handleAppMessage(), NTree::handleAppMessage(), oversim::Nice::handleAppMessage(), BaseOverlay::handleBaseOverlayMessage(), NTree::handleCollapseMessage(), BaseApp::handleCommonAPIMessage(), TCPExampleApp::handleDataReceived(), oversim::Koorde::handleDeBruijnTimerExpired(), NTree::handleDivideCall(), NTree::handleDivideCallTimeout(), Pastry::handleFailedNode(), oversim::Chord::handleFixFingersTimerExpired(), PubSubMMOG::handleHelpResponse(), PubSubMMOG::handleIntermediateResponse(), NTree::handleJoinCall(), NTree::handleJoinResponse(), oversim::Chord::handleJoinTimerExpired(), Broose::handleJoinTimerExpired(), BaseOverlay::handleMessage(), BaseApp::handleMessage(), PubSubMMOG::handleMove(), NTree::handleMove(), PubSubMMOG::handleMoveMessage(), oversim::Chord::handleNewSuccessorHint(), oversim::Nice::handleNiceQuery(), NTree::handleNodeGracefulLeaveNotification(), PubSubMMOG::handlePingCall(), NTree::handlePingCallTimeout(), SimpleGameClient::handleRealworldPacket(), NTree::handleReplaceMessage(), BasePastry::handleRequestMessage(), MyOverlay::handleRpcCall(), oversim::Koorde::handleRpcCall(), oversim::Chord::handleRpcCall(), oversim::Koorde::handleRpcDeBruijnRequest(), oversim::Chord::handleRpcFixfingersResponse(), oversim::Chord::handleRpcJoinResponse(), oversim::Chord::handleRpcNotifyResponse(), PubSubMMOG::handleRpcResponse(), NTree::handleRpcResponse(), oversim::Koorde::handleRpcResponse(), oversim::Chord::handleRpcResponse(), Broose::handleRpcResponse(), oversim::Chord::handleRpcStabilizeResponse(), PubSubMMOG::handleRpcTimeout(), PubSubLobby::handleRpcTimeout(), NTree::handleRpcTimeout(), oversim::Koorde::handleRpcTimeout(), Kademlia::handleRpcTimeout(), oversim::Chord::handleRpcTimeout(), Broose::handleRpcTimeout(), oversim::Chord::handleStabilizeTimerExpired(), Pastry::handleStateMessage(), Bamboo::handleStateMessage(), PubSubMMOG::handleSubscriptionCall(), NTree::handleTakeOverMessage(), TCPExampleApp::handleTimerEvent(), Pastry::handleTimerEvent(), MyApplication::handleTimerEvent(), KBRTestApp::handleTimerEvent(), DHTTestApp::handleTimerEvent(), Bamboo::handleTimerEvent(), BaseOverlay::handleTransportAddressChangedNotification(), Quon::handleUDPMessage(), Pastry::handleUDPMessage(), MyApplication::handleUDPMessage(), Bamboo::handleUDPMessage(), BaseOverlay::initialize(), BaseApp::initialize(), Landmark::initializeApp(), KBRTestApp::initializeApp(), I3::initializeApp(), oversim::Koorde::initializeFriendModules(), oversim::Chord::initializeFriendModules(), Vast::initializeOverlay(), Quon::initializeOverlay(), PubSubMMOG::initializeOverlay(), PubSubLobby::initializeOverlay(), NTree::initializeOverlay(), oversim::Nice::initializeOverlay(), MyOverlay::initializeOverlay(), oversim::Chord::initializeOverlay(), I3::insertTrigger(), internalHandleRpcMessage(), BaseOverlay::internalHandleRpcTimeout(), MyOverlay::isSiblingFor(), Kademlia::isSiblingFor(), oversim::Chord::isSiblingFor(), Broose::isSiblingFor(), BasePastry::isSiblingFor(), BaseOverlay::join(), oversim::Chord::joinForeignPartition(), MyOverlay::joinOverlay(), Kademlia::joinOverlay(), oversim::Nice::LeaderTransfer(), NTree::leaveGroup(), SendToKeyListener::lookupFinished(), Bamboo::lookupFinished(), oversim::Nice::maintenance(), Pastry::mergeState(), BaseOverlay::neighborSet(), BasePastry::newLeafs(), BasePastry::pingNodes(), Pastry::pingResponse(), oversim::Chord::pingResponse(), BasePastry::pingResponse(), oversim::Chord::pingTimeout(), BasePastry::pingTimeout(), BasePastry::prePing(), BasePastry::proxCallback(), Quon::purgeSites(), oversim::Nice::Query(), Pastry::recursiveRoutingHook(), Kademlia::recursiveRoutingHook(), oversim::Nice::Remove(), BaseOverlay::route(), NTree::routeViaNTree(), Kademlia::routingInit(), oversim::Chord::rpcFixfingers(), oversim::Chord::rpcJoin(), oversim::Chord::rpcNotify(), oversim::Nice::sendDataToOverlay(), oversim::Nice::sendHeartbeats(), oversim::Nice::sendHeartbeatTo(), BasePastry::sendLeafset(), Quon::sendMessage(), NTree::sendMessage(), BaseOverlay::sendMessageToUDP(), BaseApp::sendMessageToUDP(), I3::sendPacket(), I3::sendQueryReply(), BasePastry::sendRequest(), BaseOverlay::sendRouteMessage(), BasePastry::sendRoutingRow(), sendRpcCall(), sendRpcResponse(), Kademlia::sendSiblingFindNodeCall(), BasePastry::sendStateTables(), Quon::sendToApp(), NTree::sendToGroup(), BaseOverlay::sendToKey(), Kademlia::setBucketUsage(), BaseOverlay::setOverlayReady(), MyOverlay::setOwnNodeID(), BaseOverlay::setOwnNodeID(), PubSubMMOG::startTimer(), PubSubMMOG::takeOverSubspace(), NeighborCache::updateNcsInfo(), SimpleGameClient::updateNeighbors(), NeighborCache::updateNode(), Quon::updateThisSite(), oversim::Koorde::updateTooltip(), Kademlia::updateTooltip(), Gia::updateTooltip(), oversim::Chord::updateTooltip(), Broose::updateTooltip(), BasePastry::updateTooltip(), and oversim::Nice::updateVisualization().


The documentation for this class was generated from the following files: