zeromq/cppzmq — pull request #15 by montoyaedu (2013-01-30 16:54:14+00:00)
Title: Added monitor_t class

Hello, I have added a monitor_t class to zmq.hpp for supporting zmq socket monitoring.

It should work this way.

zmq::socket_t* s = new zmq::socket_t (*context, ZMQ_REQ);
s->connect("address");
s->init_monitor("inproc://monitor.initiator", ZMQ_EVENT_ALL);

then s->monitor(zmq::monitor_t*) should be launched within a separated thread.

zmq::monitor_t* must implement the following methods.

class monitor_t
{
public:
virtual void on_event_connected(const char *addr_) = 0;
virtual void on_event_connect_delayed(const char *addr_) = 0;
virtual void on_event_connect_retried(const char *addr_) = 0;
virtual void on_event_listening(const char *addr_) = 0;
virtual void on_event_bind_failed(const char *addr_) = 0;
virtual void on_event_accepted(const char *addr_) = 0;
virtual void on_event_accept_failed(const char *addr_) = 0;
virtual void on_event_closed(const char *addr_) = 0;
virtual void on_event_close_failed(const char *addr_) = 0;
virtual void on_event_disconnected(const char *addr_) = 0;
virtual void on_event_unknown(int event) = 0;
};

Please let me know if you think it could be a good idea or not.

Regards,

Edu