iFun Engine API  1.0.0-b6053
Great Technology for Great Games
Public Types | Static Public Member Functions | Static Public Attributes | List of all members
fun::DedicatedServerRpc Class Reference
Inheritance diagram for fun::DedicatedServerRpc:

Public Types

typedef boost::function< void(const PeerId &, const Xid &, const Ptr< const FunDedicatedServerRpcMessage > &)> Callback
 Functor to be invoked when a client receives back a reply.
 
typedef boost::function< void(const PeerId &)> ConnectHandler
 Functor to be invoked when a peer connected.
 
typedef boost::function< void(const PeerId &)> DisconnectHandler
 Functor to be invoked when a peer disconnected.
 
typedef boost::asio::ip::tcp::endpoint PeerEndpoint
 
typedef Uuid PeerId
 
typedef std::map< PeerId, PeerEndpoint > PeerMap
 
typedef string Tag
 
typedef Uuid Xid
 

Static Public Member Functions

static void Call (const PeerId &peer, const Ptr< FunDedicatedServerRpcMessage > &msg, const Callback &callback) ASSERT_NO_ROLLBACK
 Sends a RPC requst to the given Dedicated Server RPC peer. More...
 
static void CallRandomly (const Ptr< FunDedicatedServerRpcMessage > &msg, const Callback &callback) ASSERT_NO_ROLLBACK
 Sends a RPC requst to the Deidcated Server RPC peer randomly. More...
 
static size_t GetPeers (PeerMap *ret)
 Returns information on Dedicated Server RPC peers. More...
 
static size_t GetPeersWithTag (PeerMap *ret, const Tag &tag)
 Returns a list of RPC peers with the given tag. More...
 
static Tag GetPeerTag (const PeerId &peer)
 Gets a tag of the peer. More...
 
static bool HasTag (const PeerId &peer, const Tag &tag)
 Checks if the RPC peer has the tag. More...
 
static bool IsPeerConnected (const PeerId &peer)
 Checks if the peer is connected. More...
 
static void RegisterConnectHandler (const ConnectHandler &h)
 Registers a handler for notifying a new peer connection.
 
static void RegisterDisconnectHandler (const DisconnectHandler &h)
 Registers a handler for notifying a peer disconnection.
 

Static Public Attributes

static const PeerId kNullPeerId
 
static const Xid kNullXid
 

Member Function Documentation

◆ Call()

static void fun::DedicatedServerRpc::Call ( const PeerId &  peer,
const Ptr< FunDedicatedServerRpcMessage > &  msg,
const Callback callback 
)
static
Parameters
peerPeerId that identifies the target RPC peer.
msgFunDedicatedServerRpcMessage protobuf instance to send.
callbackCallback instance to be invoked once a reply arrives.

◆ CallRandomly()

static void fun::DedicatedServerRpc::CallRandomly ( const Ptr< FunDedicatedServerRpcMessage > &  msg,
const Callback callback 
)
static
Parameters
msgFunDedicatedServerRpcMessage protobuf instance to send.
callbackCallback instance to be invoked once a reply arrives.

◆ GetPeers()

static size_t fun::DedicatedServerRpc::GetPeers ( PeerMap *  ret)
static
Returns
the number of peers.
Parameters
retret a pointer to PeerMap instance.

◆ GetPeersWithTag()

static size_t fun::DedicatedServerRpc::GetPeersWithTag ( PeerMap *  ret,
const Tag &  tag 
)
static
Returns
the number of peers.
Parameters
retret a pointer to PeerMap instance.
tagstring to identify rpc peers.

◆ GetPeerTag()

static Tag fun::DedicatedServerRpc::GetPeerTag ( const PeerId &  peer)
static
Returns
tag.
Parameters
peerpeer id in question.

◆ HasTag()

static bool fun::DedicatedServerRpc::HasTag ( const PeerId &  peer,
const Tag &  tag 
)
static
Returns
true if the RPC peer has the tag.
Parameters
tagstring to check.

◆ IsPeerConnected()

static bool fun::DedicatedServerRpc::IsPeerConnected ( const PeerId &  peer)
static
Returns
true if the peer is connected.
Parameters
peerpeer id in question.