6 #ifndef ZEROEQ_HTTP_SERVER_H 7 #define ZEROEQ_HTTP_SERVER_H 10 #include <zeroeq/receiver.h> 11 #include <zeroeq/log.h> 50 ZEROEQHTTP_API
explicit Server(
const URI& uri );
51 ZEROEQHTTP_API
explicit Server(
Receiver& shared );
52 ZEROEQHTTP_API Server();
53 ZEROEQHTTP_API
explicit Server( Server& shared )
54 : Server( static_cast< Receiver& >( shared )) {}
55 ZEROEQHTTP_API ~Server();
67 static std::unique_ptr< Server >
parse(
int argc,
const char*
const* argv);
69 static std::unique_ptr< Server >
parse(
int argc,
const char*
const* argv,
97 bool handle( servus::Serializable&
object )
101 ZEROEQHTTP_API
bool remove(
const servus::Serializable& object );
104 ZEROEQHTTP_API
bool remove(
const std::string& event );
119 ZEROEQHTTP_API
bool handlePUT( servus::Serializable&
object );
140 ZEROEQHTTP_API
bool handlePUT(
const std::string& event,
141 const std::string& schema,
const PUTFunc& func );
152 ZEROEQHTTP_API
bool handlePUT(
const std::string& event,
161 ZEROEQHTTP_API
bool handlePUT(
const std::string& event,
162 const std::string& schema,
176 ZEROEQHTTP_API
bool handleGET( servus::Serializable&
object );
198 bool handleGET(
const std::string& event,
const std::string& schema,
206 std::string
getSchema(
const servus::Serializable&
object)
const;
209 ZEROEQHTTP_API std::string
getSchema(
const std::string& event )
const;
214 std::unique_ptr< Impl > _impl;
217 void addSockets( std::vector< detail::Socket >& entries )
final;
218 void process( detail::Socket& socket, uint32_t timeout )
final;
219 void addConnection(
const std::string& )
final { ZEROEQDONTCALL; }
Enhances servus::URI to guarantee the existance of a schema and to allow construction of [host][:port...
ZEROEQHTTP_API bool handlePUT(servus::Serializable &object)
Subscribe a serializable object to receive updates from HTTP PUT requests.
ZEROEQHTTP_API const URI & getURI() const
Get the publisher URI.
ZEROEQHTTP_API bool handleGET(servus::Serializable &object)
Subscribe a serializable object to serve HTTP GET requests.
std::function< bool() > PUTFunc
HTTP PUT callback w/o payload, return reply success.
ZEROEQHTTP_API std::string getSchema(const servus::Serializable &object) const
bool handle(servus::Serializable &object)
Handle PUT and GET for the given object.
std::function< std::string() > GETFunc
HTTP GET callback to return JSON reply.
Serves HTTP GET and PUT requests for servus::Serializable objects.
std::function< bool(const std::string &) > PUTPayloadFunc
HTTP PUT callback w/ JSON payload, return reply success.
Base class for entities receiving data.
Publish-subscribe classes for typed events.
Defines export visibility macros for library ZeroEQHTTP.
ZEROEQHTTP_API SocketDescriptor getSocketDescriptor() const
Get the underlying socket descriptor.
static ZEROEQHTTP_API std::unique_ptr< Server > parse(int argc, const char *const *argv)
Create a new Server when requested.