![]() |
iFun Engine API
1.0.0-b2821
Great Technology for Great Games
|
Funapi RPC interface.
#include <rpc.h>
Public Types | |
typedef boost::function< void(const Ptr< FunRpcMessage > &)> ReadyBack | ASSERT_NO_ROLLBACK |
Functor to signal that a RPC server finished processing. | |
typedef boost::function< void(const PeerId &, const Xid &, const Ptr< const FunRpcMessage > &)> | Callback |
Functor to be invoked when a RPC client receives back a reply. | |
typedef boost::function< void(const PeerId &)> | ConnectHandler |
Functor to be invoked when a new server connected. | |
typedef boost::function< void(const PeerId &)> | DisconnectHandler |
Functor to be invoked when a server disconnected. | |
typedef boost::function< void(const PeerId &, const Xid &, const Ptr< const FunRpcMessage > &, const ReadyBack &)> | Handler |
Functor to be invoked when a RPC server receives RPC messages. | |
typedef boost::asio::ip::tcp::endpoint | PeerEndpoint |
typedef Uuid | PeerId |
typedef std::map< PeerId, PeerEndpoint > | PeerMap |
typedef string | Tag |
typedef std::set< Tag > | Tags |
typedef boost::function< void(const PeerId &, const Xid &, const Ptr< const FunRpcMessage > &)> | VoidReplyHandler |
typedef Uuid | Xid |
Static Public Member Functions | |
static void | AddTag (const Tag &tag) |
Tags a local RPC server. More... | |
static void | AddTags (const Tags &tags) |
Tags a local RPC server. More... | |
static void | Call (const PeerId &peer, const Ptr< FunRpcMessage > &msg, const Callback &callback) ASSERT_NO_ROLLBACK |
Sends a RPC requst to the given RPC server. More... | |
static void | Call (const PeerId &peer, const Ptr< FunRpcMessage > &msg) ASSERT_NO_ROLLBACK |
Sends a RPC requst to the given RPC server. More... | |
static std::string | GetPeerExternalHostname (const PeerId &peer) |
Returns a hostname of the peer. More... | |
static boost::asio::ip::address | GetPeerExternalIp (const PeerId &peer) |
Returns a public IP of the peer. More... | |
static HardwareInfo::ProtocolPortMap | GetPeerExternalPorts (const PeerId &peer) |
Returns a public ports of the peer. More... | |
static size_t | GetPeers (PeerMap *ret, bool include_self=false) |
Returns information on other RPC peers. More... | |
static Json | GetPeerStatus (const PeerId &peer) |
Returns a status of the peer. More... | |
static size_t | GetPeersWithTag (PeerMap *ret, const Tag &tag, bool include_self=false) |
Returns a list of RPC peers with the given tag. More... | |
static size_t | GetPeerTags (Tags *ret, const PeerId &peer) |
Returns a set of tags associated with the given peer. More... | |
static PeerEndpoint | GetSelfEndpoint () |
Returns an endpoint information to which RPC listens. More... | |
static PeerId | GetSelfId () |
Returns an identifier to distinguish from RPC servers. More... | |
static Json | GetStatus () |
Gets the server status. | |
static bool | HasTag (const Tag &tag) |
Checks if a local RPC server 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 server connection. | |
static void | RegisterDisconnectHandler (const DisconnectHandler &h) |
Registers a handler for notifying a server disconnection. | |
static void | RegisterHandler (const string &type, const Handler &h) |
Registers a handler for a particular RPC message type. More... | |
static void | RegisterVoidReplyHandler (const string &type, const VoidReplyHandler &h) |
Registers a handler for a particular RPC message type. More... | |
static void | RemoveTag (const Tag &tag) |
Untags a local RPC server. More... | |
static void | RemoveTags (const Tags &tags) |
Untags a local RPC server. More... | |
static void | SetStatus (const Json &status) |
Sets the server status and broadcasts using RPC. More... | |
Static Public Attributes | |
static const PeerId | kNullPeerId |
static const Xid | kNullXid |
|
static |
(e.g., lobby, room, ...)
tag | string to tag the server. |
|
static |
(e.g., lobby, room, ...)
tags | a set of strings to tag the server. |
|
static |
peer | PeerId that identifies the target RPC server. |
msg | FunRpcMessage protobuf instance to send. |
callback | Callback instance to be invoked once a reply arrives. |
|
static |
peer | PeerId that identifies the target RPC server. |
msg | FunRpcMessage protobuf instance to send. |
|
static |
Exteranl hostname is resolved by HardwareInfo's external_ip_resolver in MANIFEST.json. If not specified, it would be the same as GetPeerExternalIp().
peer | peer id in question. |
|
static |
Exteranl IP is resolved by HardwareInfo's external_ip_resolver field in MANIFEST.json.
peer | peer id in question. |
|
static |
External ports is resolved by HardwareInfo's external_ip_resolver field in MANIFEST.json, and specifically by 'nat:ip:porto=port:proto=prot'.
peer | peer id in question. |
|
static |
ret | ret a pointer to PeerMap instance. |
include_self | include a local rpc server. |
|
static |
peer | peer id in question. |
|
static |
ret | ret a pointer to PeerMap instance. |
tag | string to identify rpc peers. |
include_self | include a local rpc server. |
|
static |
ret | a pointer to an STL set of string. |
peer | peer id in question. |
|
static |
|
static |
|
static |
tag | string to check. |
|
static |
peer | peer id in question. |
|
static |
The type must match the sender field in FunRpcMessage protobuf.
type | string to identify a message type. |
h | Handler to be invoked when msg of the given type arrives. |
|
static |
The type must match the sender field in FunRpcMessage protobuf.
type | string to identify a message type. |
h | Handler to be invoked when msg of the given type arrives. |
|
static |
(e.g., lobby, room, ...)
tag | string to remove. |
|
static |
(e.g., lobby, room, ...)
tags | a set of tag strings to remove. |
|
static |
status | the server status. |