12 #define ROC_JSON_PARSE_ERROR (-32700)
13 #define ROC_JSON_INVALID_REQUEST (-32600)
14 #define ROC_JSON_METHOD_NOT_FOUND (-32601)
15 #define ROC_JSON_INVALID_PARAMS (-32602)
16 #define ROC_JSON_INTERNAL_ERROR (-32603)
27 const std::string & _brokerEndpoint,
28 const std::string & _serviceName);
42 virtual void onRequest(std::list<zmq::message_t*>* envelope, std::list<zmq::message_t*>* data);
53 virtual Json::Value
call(
const std::string & name,
const Json::Value & arguments);
63 virtual Json::Value
getattr(
const std::string & name);
72 virtual void setattr(
const std::string & name,
const Json::Value & value);
73 void reply(std::list<zmq::message_t*>* envelope, std::list<zmq::message_t*>* data =
nullptr);
74 void replyValue(std::list<zmq::message_t*>* envelope,
const Json::Value & value,
const std::string &
id =
"");
75 void replyError(std::list<zmq::message_t*>* envelope,
int errorNo,
const std::string &
id =
"");
81 void send(
char _command,
const std::string & _option =
"");
99 Json::Value rocCall(
const std::string & name,
const Json::Value & arguments);
101 zmq::socket_t * sock;
102 std::string brokerEndpoint;
103 std::string serviceName;
104 std::thread serverThread;
107 volatile bool keepGoing;
virtual void onRequest(std::list< zmq::message_t * > *envelope, std::list< zmq::message_t * > *data)
The (not anymore) "to-be-overloaded" request handler.
RocServer(zmq::context_t &_ctx, const std::string &_brokerEndpoint, const std::string &_serviceName)
virtual Json::Value call(const std::string &name, const Json::Value &arguments)
The "to-be-overloaded" call handler.
void replyValue(std::list< zmq::message_t * > *envelope, const Json::Value &value, const std::string &id="")
void reply(std::list< zmq::message_t * > *envelope, std::list< zmq::message_t * > *data=nullptr)
virtual void setattr(const std::string &name, const Json::Value &value)
The "to-be-overloaded" setattr handler.
virtual void teardown()
called in handler thread on shutdown
void replyError(std::list< zmq::message_t * > *envelope, int errorNo, const std::string &id="")
virtual Json::Value getattr(const std::string &name)
The "to-be-overloaded" getattr handler.
virtual void startup()
called in handler thread on startup