1 /*
2     Copyright (c) 2007-2011 iMatix Corporation
3     Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
4 
5     This file is part of 0MQ.
6 
7     0MQ is free software; you can redistribute it and/or modify it under
8     the terms of the GNU Lesser General Public License as published by
9     the Free Software Foundation; either version 3 of the License, or
10     (at your option) any later version.
11 
12     0MQ is distributed in the hope that it will be useful,
13     but WITHOUT ANY WARRANTY; without even the implied warranty of
14     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15     GNU Lesser General Public License for more details.
16 
17     You should have received a copy of the GNU Lesser General Public License
18     along with this program.  If not, see <http://www.gnu.org/licenses/>.
19 */
20 
21 #ifndef __ZMQ_XPUB_HPP_INCLUDED__
22 #define __ZMQ_XPUB_HPP_INCLUDED__
23 
24 #include "socket_base.hpp"
25 #include "array.hpp"
26 #include "pipe.hpp"
27 #include "dist.hpp"
28 
29 namespace zmq
30 {
31 
32     class xpub_t : public socket_base_t
33     {
34     public:
35 
36         xpub_t (class ctx_t *parent_, uint32_t tid_);
37         ~xpub_t ();
38 
39         //  Implementations of virtual functions from socket_base_t.
40         void xattach_pipes (class reader_t *inpipe_, class writer_t *outpipe_,
41             const blob_t &peer_identity_);
42         int xsend (zmq_msg_t *msg_, int flags_);
43         bool xhas_out ();
44         int xrecv (zmq_msg_t *msg_, int flags_);
45         bool xhas_in ();
46 
47     private:
48 
49         //  Hook into the termination process.
50         void process_term (int linger_);
51 
52         //  Distributor of messages holding the list of outbound pipes.
53         dist_t dist;
54 
55         xpub_t (const xpub_t&);
56         const xpub_t &operator = (const xpub_t&);
57     };
58 
59 }
60 
61 #endif
62