REC RPC library
|
#include "rec/rpc/defines.h"
#include "rec/rpc/rec_rpc_common.h"
#include "rec/rpc/rec_rpc_ClientInfo.h"
Go to the source code of this file.
Classes | |
struct | rec::rpc::RPCFunctionBase |
RPC function wrapper interface. More... | |
struct | rec::rpc::HTTPGetHandlerBase |
HTTP GET handler interface. More... | |
struct | rec::rpc::CustomRequestHandlerBase |
Custom request handler interface. More... | |
class | rec::rpc::Server |
RPC server base class. More... | |
Namespaces | |
rec | |
rec::rpc | |
Macros | |
#define | DECLARE_FUNCTION(FUNCTIONNAME) |
Declare a RPC function in the server class definition. More... | |
#define | BEGIN_FUNCTION_DEFINITION(CLASSNAME, FUNCTIONNAME) |
Begin the implementation of a RPC function. More... | |
#define | END_FUNCTION_DEFINITION } |
End of a RPC function implementation. More... | |
#define | REGISTER_FUNCTION(FUNCTIONNAME) registerFunction( #FUNCTIONNAME, create##FUNCTIONNAME##Wrapper() ); |
Register a RPC function. More... | |
#define | UNREGISTER_FUNCTION(FUNCTIONNAME) unregisterFunction( #FUNCTIONNAME ); |
Unregister a RPC function. More... | |
#define | IS_FUNCTION_REGISTERED(FUNCTIONNAME) isFunctionRegistered( #FUNCTIONNAME ); |
Check if a RPC function with a given name is registered. More... | |
#define | ADD_TOPIC(TOPICNAME, SHAREDMEMSIZE) addTopic( #TOPICNAME, SHAREDMEMSIZE ); |
Add a topic. More... | |
#define | ADD_ENQUEUEDTOPIC(TOPICNAME) addEnqueuedTopic( #TOPICNAME ); |
#define | ADD_SERVERONLY_TOPIC(TOPICNAME, SHAREDMEMSIZE) addTopic( #TOPICNAME, SHAREDMEMSIZE, true ); |
Add a topic. More... | |
#define | ADD_PERMANENT_TOPIC(TOPICNAME, SHAREDMEMSIZE) addPermanentTopic( #TOPICNAME, SHAREDMEMSIZE ); |
Add a topic. More... | |
#define | ADD_PERMANENT_SERVERONLY_TOPIC(TOPICNAME, SHAREDMEMSIZE) addPermanentTopic( #TOPICNAME, SHAREDMEMSIZE, true ); |
Add a topic. More... | |
#define | DECLARE_HTTP_GET_HANDLER(HANDLERNAME) |
Declare a HTTP GET handler in the server class definition. More... | |
#define | BEGIN_HTTP_GET_HANDLER_DEFINITION(CLASSNAME, HANDLERNAME) |
Begin the implementation of a HTTP GET handler. More... | |
#define | END_HTTP_GET_HANDLER_DEFINITION } |
End of a HTTP GET handler implementation. More... | |
#define | REGISTER_HTTP_GET_HANDLER(HANDLERNAME) registerHttpGetHandler( create##HANDLERNAME##HttpGetHandler() ); |
Register a HTTP GET handler. More... | |
#define | REMOVE_HTTP_GET_HANDLER registerHttpGetHandler( rec::rpc::HTTPGetHandlerBasePtr() ); |
Removes the existing HTTP GET handler. More... | |
#define | DECLARE_CUSTOM_REQUEST_HANDLER(HANDLERNAME) |
Declare a custom request handler in the server class definition. More... | |
#define | BEGIN_CUSTOM_REQUEST_HANDLER_DEFINITION(CLASSNAME, HANDLERNAME) |
Begin the implementation of a custom request handler. More... | |
#define | END_CUSTOM_REQUEST_HANDLER_DEFINITION } |
End of a custom request handler implementation. More... | |
#define | REGISTER_CUSTOM_REQUEST_HANDLER(HANDLERNAME) registerCustomRequestHandler( create##HANDLERNAME##CustomRequestHandler() ); |
Register a custom request handler. More... | |
#define | REMOVE_CUSTOM_REQUEST_HANDLER registerCustomRequestHandler( rec::rpc::CustomRequestHandlerBasePtr() ); |
Removes the existing custom request handler. More... | |
#define ADD_ENQUEUEDTOPIC | ( | TOPICNAME | ) | addEnqueuedTopic( #TOPICNAME ); |
Definition at line 721 of file rec_rpc_Server.h.
#define ADD_PERMANENT_SERVERONLY_TOPIC | ( | TOPICNAME, | |
SHAREDMEMSIZE | |||
) | addPermanentTopic( #TOPICNAME, SHAREDMEMSIZE, true ); |
Add a topic.
This macro is used to register a permanent topic in the server. Only the server can publish data via the topic. The data is distributed via shared memory, local IPC or the TCP connection.
TOPICNAME | Name of the topic. |
SHAREDMEMSIZE | Minimum size of the shared memory segment in bytes. If 0 (default), no shared memory will be used. |
rec::rpc::Exception | Error codes: ImproperTopicName, TopicAlreadyExists. |
Definition at line 763 of file rec_rpc_Server.h.
#define ADD_PERMANENT_TOPIC | ( | TOPICNAME, | |
SHAREDMEMSIZE | |||
) | addPermanentTopic( #TOPICNAME, SHAREDMEMSIZE ); |
Add a topic.
This macro is used to register a permanent topic in the server. The server and the clients can publish data via the topic. The data is distributed via shared memory, local IPC or the TCP connection.
TOPICNAME | Name of the topic. |
SHAREDMEMSIZE | Minimum size of the shared memory segment in bytes. If 0 (default), no shared memory will be used. |
rec::rpc::Exception | Error codes: ImproperTopicName, TopicAlreadyExists. |
Definition at line 749 of file rec_rpc_Server.h.
#define ADD_SERVERONLY_TOPIC | ( | TOPICNAME, | |
SHAREDMEMSIZE | |||
) | addTopic( #TOPICNAME, SHAREDMEMSIZE, true ); |
Add a topic.
This macro is used to register a non permanent topic in the server. Only the server can publish data via the topic. The data is distributed via shared memory, local IPC or the TCP connection.
TOPICNAME | Name of the topic. |
SHAREDMEMSIZE | Minimum size of the shared memory segment in bytes. If 0 (default), no shared memory will be used. |
rec::rpc::Exception | Error codes: ImproperTopicName, TopicAlreadyExists. |
Definition at line 735 of file rec_rpc_Server.h.
#define ADD_TOPIC | ( | TOPICNAME, | |
SHAREDMEMSIZE | |||
) | addTopic( #TOPICNAME, SHAREDMEMSIZE ); |
Add a topic.
This macro is used to register a non permanent topic in the server. The server and the clients can publish data via the topic. The data is distributed via shared memory, local IPC or the TCP connection.
TOPICNAME | Name of the topic. |
SHAREDMEMSIZE | Minimum size of the shared memory segment in bytes. If 0 (default), no shared memory will be used. |
rec::rpc::Exception | Error codes: ImproperTopicName, TopicAlreadyExists. |
Definition at line 719 of file rec_rpc_Server.h.
#define BEGIN_CUSTOM_REQUEST_HANDLER_DEFINITION | ( | CLASSNAME, | |
HANDLERNAME | |||
) |
Begin the implementation of a custom request handler.
Place this macro above the implementation of a custom request handler. The "raw" request is accessible via "request", the response must be stored in the QByteArray "response". The IP address and the TCP port of the calling client are accessible via "client" (type rec::rpc::ClientInfo).
CLASSNAME | Name of your server class. |
HANDLERNAME | Name of the custom request handler (without qoutes). |
Definition at line 848 of file rec_rpc_Server.h.
#define BEGIN_FUNCTION_DEFINITION | ( | CLASSNAME, | |
FUNCTIONNAME | |||
) |
Begin the implementation of a RPC function.
Place this macro above the implementation of a RPC function. The RPC function parameters are accessible via "param", the return values can be accessed via "result". The types of "param" and "result" are 'FUNCTIONNAME'Param and 'FUNCTIONNAME'Result. These type names must be defined and derived from Serializable. The IP address and the TCP port of the calling client are accessible via "client" (type rec::rpc::ClientInfo).
CLASSNAME | Name of your server class. |
FUNCTIONNAME | Name of the RPC function (without qoutes). |
Definition at line 660 of file rec_rpc_Server.h.
#define BEGIN_HTTP_GET_HANDLER_DEFINITION | ( | CLASSNAME, | |
HANDLERNAME | |||
) |
Begin the implementation of a HTTP GET handler.
Place this macro above the implementation of a HTTP GET handler. The URL (containing the relative path and the queries) is accessible via the QUrl "url". The host name sent by the client is accessible via the QString "host". The IP address and the TCP port of the calling client are accessible via "client" (type rec::rpc::ClientInfo). The HTML page sent to the client must be stored in the QByteArray "resultPage". Optionally, a content type definition can be specified in the QString "contentType".
CLASSNAME | Name of your server class. |
HANDLERNAME | Name of the HTTP GET handler (without qoutes). |
Definition at line 791 of file rec_rpc_Server.h.
#define DECLARE_CUSTOM_REQUEST_HANDLER | ( | HANDLERNAME | ) |
Declare a custom request handler in the server class definition.
Use this macro to declare a custom request handler in the definition of your own server class derived from rec::rpc::Server. All code which is necessary to register and invoke the handler is inserted automatically.
HANDLERNAME | Name of the handler function (without qoutes). |
Definition at line 833 of file rec_rpc_Server.h.
#define DECLARE_FUNCTION | ( | FUNCTIONNAME | ) |
Declare a RPC function in the server class definition.
Use this macro to declare a RPC function in the definition of your own server class derived from rec::rpc::Server. All code which is necessary to register and invoke the function is inserted automatically.
FUNCTIONNAME | Name of the RPC function (without qoutes). |
Definition at line 644 of file rec_rpc_Server.h.
#define DECLARE_HTTP_GET_HANDLER | ( | HANDLERNAME | ) |
Declare a HTTP GET handler in the server class definition.
Use this macro to declare a HTTP GET handler in the definition of your own server class derived from rec::rpc::Server. All code which is necessary to register and invoke the handler is inserted automatically.
HANDLERNAME | Name of the HTTP GET handler function (without qoutes). |
Definition at line 773 of file rec_rpc_Server.h.
#define END_CUSTOM_REQUEST_HANDLER_DEFINITION } |
End of a custom request handler implementation.
Definition at line 859 of file rec_rpc_Server.h.
#define END_FUNCTION_DEFINITION } |
End of a RPC function implementation.
Definition at line 671 of file rec_rpc_Server.h.
#define END_HTTP_GET_HANDLER_DEFINITION } |
End of a HTTP GET handler implementation.
Definition at line 802 of file rec_rpc_Server.h.
#define IS_FUNCTION_REGISTERED | ( | FUNCTIONNAME | ) | isFunctionRegistered( #FUNCTIONNAME ); |
Check if a RPC function with a given name is registered.
FUNCTIONNAME | Name of the RPC function (without quotes). |
Definition at line 705 of file rec_rpc_Server.h.
#define REGISTER_CUSTOM_REQUEST_HANDLER | ( | HANDLERNAME | ) | registerCustomRequestHandler( create##HANDLERNAME##CustomRequestHandler() ); |
Register a custom request handler.
This method is used to set a handler for custom request requests from a client. It creates the wrapper object and calls registerCustomRequestHandler automatically.
HANDLERNAME | Name of the handler function. |
Definition at line 871 of file rec_rpc_Server.h.
#define REGISTER_FUNCTION | ( | FUNCTIONNAME | ) | registerFunction( #FUNCTIONNAME, create##FUNCTIONNAME##Wrapper() ); |
Register a RPC function.
This macro is used to add a RPC function that can be invoked by a client. It creates the wrapper object and calls registerFunction automatically.
FUNCTIONNAME | Name of the RPC function (without quotes). |
rec::rpc::Exception | Error codes: ImproperFunctionName. |
Definition at line 685 of file rec_rpc_Server.h.
#define REGISTER_HTTP_GET_HANDLER | ( | HANDLERNAME | ) | registerHttpGetHandler( create##HANDLERNAME##HttpGetHandler() ); |
Register a HTTP GET handler.
This method is used to set a handler for HTTP GET requests from a client. It creates the wrapper object and calls registerHttpGetHandler automatically.
HANDLERNAME | Name of the HTTP GET handler function. |
Definition at line 814 of file rec_rpc_Server.h.
#define REMOVE_CUSTOM_REQUEST_HANDLER registerCustomRequestHandler( rec::rpc::CustomRequestHandlerBasePtr() ); |
Removes the existing custom request handler.
This method is used to remove the existing custom request handler.
Definition at line 880 of file rec_rpc_Server.h.
#define REMOVE_HTTP_GET_HANDLER registerHttpGetHandler( rec::rpc::HTTPGetHandlerBasePtr() ); |
Removes the existing HTTP GET handler.
This method is used to remove the existing HTTP GET handler.
Definition at line 823 of file rec_rpc_Server.h.
#define UNREGISTER_FUNCTION | ( | FUNCTIONNAME | ) | unregisterFunction( #FUNCTIONNAME ); |
Unregister a RPC function.
This macro is used to remove a RPC function.
FUNCTIONNAME | Name of the RPC function (without quotes). |
Definition at line 696 of file rec_rpc_Server.h.