14 #ifndef REMOTE_SERVER_H
15 #define REMOTE_SERVER_H
22 #include <Poco/Semaphore.h>
23 #include <Poco/Net/SocketAddress.h>
24 #include <Poco/Net/StreamSocket.h>
26 #include "nymph_method.h"
27 #include "nymph_listener.h"
28 #include "nymph_logger.h"
32 static std::map<uint32_t, Poco::Net::StreamSocket*> sockets;
33 static std::map<uint32_t, Poco::Semaphore*> socketSemaphores;
34 static Poco::Mutex socketsMutex;
35 static uint32_t lastHandle;
37 static std::string loggerName;
38 static uint32_t nextMethodId;
40 static std::map<std::string, NymphMethod>& methods();
41 static std::map<uint32_t, NymphMethod*>& methodsIds();
42 static Poco::Mutex& methodsMutex();
44 static bool registerMethod(std::string name,
NymphMethod method);
47 static bool init(logFnc logger,
int level = NYMPH_LOG_LEVEL_TRACE,
long timeout = 3000);
48 static bool sync(uint32_t handle, std::string &result);
49 static void setLogger(logFnc logger,
int level);
50 static bool shutdown();
51 static bool connect(std::string host,
int port, uint32_t &handle,
void* data, std::string &result);
52 static bool connect(std::string url, uint32_t &handle,
void* data, std::string &result);
53 static bool connect(Poco::Net::SocketAddress sa, uint32_t &handle,
void* data, std::string &result);
54 static bool disconnect(uint32_t handle, std::string &result);
55 static bool callMethod(uint32_t handle, std::string name, std::vector<NymphType*> &values,
56 NymphType* &returnvalue, std::string &result);
57 static bool callMethodId(uint32_t handle, uint32_t
id, std::vector<NymphType*> &values,
NymphType* &returnvalue, std::string &result);
58 static bool removeMethod(std::string name);
60 static bool registerCallback(std::string name, NymphCallbackMethod method,
void* data);
61 static bool removeCallback(std::string name);
Definition: nymph_method.h:40
Definition: remote_server.h:31
Definition: nymph_types.h:133