32 #if defined ZMQ_HAVE_TIPC 48 #include <sys/socket.h> 50 #include <linux/tipc.h> 52 zmq::tipc_listener_t::tipc_listener_t (io_thread_t *io_thread_,
53 socket_base_t *socket_,
const options_t &options_) :
54 own_t (io_thread_, options_),
55 io_object_t (io_thread_),
61 zmq::tipc_listener_t::~tipc_listener_t ()
66 void zmq::tipc_listener_t::process_plug ()
73 void zmq::tipc_listener_t::process_term (
int linger_)
80 void zmq::tipc_listener_t::in_event ()
87 socket->event_accept_failed (endpoint,
zmq_errno());
92 stream_engine_t *engine =
new (std::nothrow) stream_engine_t (fd, options, endpoint);
97 io_thread_t *io_thread = choose_io_thread (options.affinity);
104 session->inc_seqnum ();
105 launch_child (session);
106 send_attach (session, engine,
false);
107 socket->event_accepted (endpoint, fd);
110 int zmq::tipc_listener_t::get_address (std::string &addr_)
112 struct sockaddr_storage ss;
113 socklen_t sl =
sizeof (ss);
115 int rc = getsockname (s, (sockaddr *) &ss, &sl);
121 tipc_address_t addr ((
struct sockaddr *) &ss, sl);
122 return addr.to_string (addr_);
125 int zmq::tipc_listener_t::set_address (
const char *addr_)
128 int rc =
address.resolve(addr_);
144 rc = listen (s, options.backlog);
148 socket->event_listening (endpoint, s);
158 void zmq::tipc_listener_t::close ()
161 int rc = ::close (s);
164 socket->event_closed (endpoint, s);
167 zmq::fd_t zmq::tipc_listener_t::accept ()
172 struct sockaddr_storage ss = {};
173 socklen_t ss_len =
sizeof(ss);
176 fd_t sock = ::accept (s, (
struct sockaddr *) &ss, &ss_len);
static session_base_t * create(zmq::io_thread_t *io_thread_, bool active_, zmq::socket_base_t *socket_, const options_t &options_, address_t *addr_)
void process_term(int linger_)
fd_t open_socket(int domain_, int type_, int protocol_)
ZMQ_EXPORT int zmq_errno(void)