pull.cpp 2.1 KB
Newer Older
1
/*
2
    Copyright (c) 2007-2010 iMatix Corporation
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19

    This file is part of 0MQ.

    0MQ is free software; you can redistribute it and/or modify it under
    the terms of the Lesser GNU General Public License as published by
    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
    Lesser GNU General Public License for more details.

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

20
#include "../include/zmq.h"
21

22
#include "pull.hpp"
23 24
#include "err.hpp"

25
zmq::pull_t::pull_t (class app_thread_t *parent_) :
26
    socket_base_t (parent_)
27 28 29 30 31
{
    options.requires_in = true;
    options.requires_out = false;
}

32
zmq::pull_t::~pull_t ()
33 34 35
{
}

36
void zmq::pull_t::xattach_pipes (class reader_t *inpipe_,
37
    class writer_t *outpipe_, const blob_t &peer_identity_)
38 39
{
    zmq_assert (inpipe_ && !outpipe_);
40
    fq.attach (inpipe_);
41 42
}

43
void zmq::pull_t::xdetach_inpipe (class reader_t *pipe_)
44 45
{
    zmq_assert (pipe_);
46
    fq.detach (pipe_);
47 48
}

49
void zmq::pull_t::xdetach_outpipe (class writer_t *pipe_)
50 51 52 53 54
{
    //  There are no outpipes, so this function shouldn't be called at all.
    zmq_assert (false);
}

55
void zmq::pull_t::xkill (class reader_t *pipe_)
56
{
57
    fq.kill (pipe_);
58 59
}

60
void zmq::pull_t::xrevive (class reader_t *pipe_)
61
{
62
    fq.revive (pipe_);
63 64
}

65
void zmq::pull_t::xrevive (class writer_t *pipe_)
Martin Hurton's avatar
Martin Hurton committed
66 67 68 69
{
    zmq_assert (false);
}

70
int zmq::pull_t::xsetsockopt (int option_, const void *optval_,
71 72 73 74 75 76 77
    size_t optvallen_)
{
    //  No special options for this socket type.
    errno = EINVAL;
    return -1;
}

78
int zmq::pull_t::xsend (zmq_msg_t *msg_, int flags_)
79 80 81 82 83
{
    errno = ENOTSUP;
    return -1;
}

84
int zmq::pull_t::xrecv (zmq_msg_t *msg_, int flags_)
85
{
86
    return fq.recv (msg_, flags_);
87 88
}

89
bool zmq::pull_t::xhas_in ()
90
{
91
    return fq.has_in ();
92 93
}

94
bool zmq::pull_t::xhas_out ()
95 96 97 98
{
    return false;
}