dealer.cpp 1.99 KB
Newer Older
1
/*
2
    Copyright (c) 2007-2013 Contributors as noted in the AUTHORS file
3 4 5 6

    This file is part of 0MQ.

    0MQ is free software; you can redistribute it and/or modify it under
7
    the terms of the GNU Lesser General Public License as published by
8 9 10 11 12 13
    the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.

    0MQ is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
    GNU Lesser General Public License for more details.
15

16
    You should have received a copy of the GNU Lesser General Public License
17 18 19
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

20
#include "dealer.hpp"
21
#include "err.hpp"
22
#include "msg.hpp"
23

24
zmq::dealer_t::dealer_t (class ctx_t *parent_, uint32_t tid_, int sid_) :
25
    socket_base_t (parent_, tid_, sid_)
26
{
27
    options.type = ZMQ_DEALER;
28 29
}

30
zmq::dealer_t::~dealer_t ()
31 32 33
{
}

34
void zmq::dealer_t::xattach_pipe (pipe_t *pipe_, bool icanhasall_)
35
{
36 37 38
    // icanhasall_ is unused
    (void) icanhasall_;

39 40 41
    zmq_assert (pipe_);
    fq.attach (pipe_);
    lb.attach (pipe_);
42 43
}

44
int zmq::dealer_t::xsend (msg_t *msg_)
45
{
46
    return lb.send (msg_);
47 48
}

49
int zmq::dealer_t::xrecv (msg_t *msg_)
50
{
51
    return fq.recv (msg_);
52 53
}

54
bool zmq::dealer_t::xhas_in ()
55
{
56
    return fq.has_in ();
57 58
}

59
bool zmq::dealer_t::xhas_out ()
60
{
61
    return lb.has_out ();
62 63
}

64
void zmq::dealer_t::xread_activated (pipe_t *pipe_)
65 66 67 68
{
    fq.activated (pipe_);
}

69
void zmq::dealer_t::xwrite_activated (pipe_t *pipe_)
70 71 72 73
{
    lb.activated (pipe_);
}

74
void zmq::dealer_t::xterminated (pipe_t *pipe_)
75 76 77 78 79
{
    fq.terminated (pipe_);
    lb.terminated (pipe_);
}

80
zmq::dealer_session_t::dealer_session_t (io_thread_t *io_thread_, bool connect_,
81
      socket_base_t *socket_, const options_t &options_,
82 83
      const address_t *addr_) :
    session_base_t (io_thread_, connect_, socket_, options_, addr_)
84 85 86
{
}

87
zmq::dealer_session_t::~dealer_session_t ()
88 89 90
{
}