iFun Engine API  1.0.0-b6053
Great Technology for Great Games
Classes | Typedefs | Enumerations | Functions
session.h File Reference
#include <boost/noncopyable.hpp>
#include <boost/unordered_set.hpp>
#include <funapi/common/json.h>
#include <funapi/common/json_schema.h>
#include <funapi/distribution/rpc.h>
#include <funapi/network/fun_message.pb.h>
#include <funapi/time/monotonic_clock.h>
#include <funapi/time/wall_clock.h>
#include <funapi/types.h>
#include <vector>
#include <cxxabi.h>

Go to the source code of this file.

Classes

class  fun::HandlerRegistry
 
class  fun::ProtobufExtensionIdentifier
 
class  fun::Session
 

Typedefs

typedef function< void(const Ptr< Session > &, const Json &, const string &, size_t message_size)> fun::JsonMessageSendHook
 
typedef function< void(const Ptr< Session > &, const Json &, const string &)> fun::JsonPostMessageHandlerHook
 
typedef function< bool(const Ptr< Session > &, const Json &, const string &)> fun::JsonPreMessageHandlerHook
 
typedef function< void(const Ptr< Session > &, const Json &)> fun::MessageHandler
 JSON message handler type.
 
typedef function< void(const Ptr< Session > &, const Ptr< FunMessage > &)> fun::MessageHandler2
 Protobuf message handler type.
 
typedef function< void(const Ptr< Session > &, const Ptr< const FunMessage > &, const string &, size_t message_size)> fun::ProtobufMessageSendHook
 
typedef function< void(const Ptr< Session > &, const Ptr< const FunMessage > &, const string &)> fun::ProtobufPostMessageHandlerHook
 
typedef function< void(const Ptr< Session > &, const Ptr< const FunMessage > &, const int32_t)> fun::ProtobufPostMessageHandlerHook2
 
typedef function< bool(const Ptr< Session > &, const Ptr< const FunMessage > &, const string &)> fun::ProtobufPreMessageHandlerHook
 
typedef function< bool(const Ptr< Session > &, const Ptr< const FunMessage > &, const int32_t)> fun::ProtobufPreMessageHandlerHook2
 
typedef function< void(const Ptr< Session > &)> fun::SessionClosedHandler
 Handler to be notified on session close. This one ignores the close reason.
 
typedef function< void(const Ptr< Session > &, SessionCloseReason)> fun::SessionClosedHandler2
 Handler to be notified on session close. This one ignores the close reason.
 
typedef Uuid fun::SessionId
 
typedef function< void(const Ptr< Session > &)> fun::SessionOpenedHandler
 Handler to be notified on session creation.
 
typedef function< void(const Ptr< Session > &)> fun::SessionRestoredHandler
 Handler to be notified on session restoration.
 
typedef function< void(const Ptr< Session > &)> fun::TcpTransportAttachedHandler
 Handler to to noticed on TCP connect if the session uses TCP.
 
typedef function< void(const Ptr< Session > &)> fun::TcpTransportDetachedHandler
 Handler to be notified on TCP close if the session uses TCP.
 
typedef function< void(const Ptr< Session > &)> fun::WebSocketTransportAttachedHandler
 Handler to to noticed on Websocket connect if the session uses Websocket.
 
typedef function< void(const Ptr< Session > &)> fun::WebSocketTransportDetachedHandler
 Handler to be notified on Websocket close if the session uses Websocket.
 

Enumerations

enum  EncodingScheme { kUnknownEncoding = 0, kJsonEncoding, kProtobufEncoding }
 
enum  Encryption {
  kDefaultEncryption = 100, kDummyEncryption, kIFunEngine1Encryption, kIFunEngine2Encryption,
  kChacha20Encryption, kAes128Encryption
}
 
enum  fun::SessionCloseReason {
  fun::kClosedForServerDid = 0, fun::kClosedForIdle = 1, fun::kClosedForUnknownSessionId = 2, fun::kClosedForEventTimeout = 3,
  fun::kClosedForClientRequested = 4, fun::kClosedForRedirection =5
}
 Enumeration to identify why a session has closed. More...
 
enum  TransportProtocol {
  kDefaultProtocol = 0, kTcp, kUdp, kHttp,
  kWebSocket
}
 

Functions

FUNAPI_DLL_VISIBILITY void fun::InstallJsonMessageHandlerHook (const JsonPreMessageHandlerHook &json_pre_message_handler_hook, const JsonPostMessageHandlerHook &json_post_message_handler_hook)
 
FUNAPI_DLL_VISIBILITY void fun::InstallJsonMessageSendHook (const JsonMessageSendHook &hook)
 
FUNAPI_DLL_VISIBILITY void fun::InstallProtobufMessageHandlerHook (const ProtobufPreMessageHandlerHook &protobuf_pre_message_handler_hook, const ProtobufPostMessageHandlerHook &protobuf_post_message_handler_hook)
 
FUNAPI_DLL_VISIBILITY void fun::InstallProtobufMessageHandlerHook2 (const ProtobufPreMessageHandlerHook2 &protobuf_pre_message_handler_hook, const ProtobufPostMessageHandlerHook2 &protobuf_post_message_handler_hook)
 
FUNAPI_DLL_VISIBILITY void fun::InstallProtobufMessageSendHook (const ProtobufMessageSendHook &hook)
 
FUNAPI_DLL_VISIBILITY bool fun::operator== (const int32_t lhs, const ProtobufExtensionIdentifier &rhs)
 
FUNAPI_DLL_VISIBILITY bool fun::operator== (const ProtobufExtensionIdentifier lhs, const int32_t &rhs)
 
FUNAPI_DLL_VISIBILITY void fun::OverrideSessionTimeout (const Ptr< Session > &session, const int64_t timeout_in_ms)
 
FUNAPI_DLL_VISIBILITY void fun::SetTransport (TransportProtocol protocol)
 
FUNAPI_DLL_VISIBILITY void fun::SetTransport (TransportProtocol protocol, const string &msgtype)
 

Enumeration Type Documentation

◆ SessionCloseReason

Enumerator
kClosedForServerDid 

Server called Session::Close().

kClosedForIdle 

The session was idle for a long time.

kClosedForUnknownSessionId 

The session id is unknown.

kClosedForEventTimeout 

Event timeout occured.

kClosedForClientRequested 

Client requested to close the session.

kClosedForRedirection 

Client redirected to another server.