libzmq master
The Intelligent Transport Layer

xreq.hpp

Go to the documentation of this file.
00001 /*
00002     Copyright (c) 2009-2011 250bpm s.r.o.
00003     Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
00004 
00005     This file is part of 0MQ.
00006 
00007     0MQ is free software; you can redistribute it and/or modify it under
00008     the terms of the GNU Lesser General Public License as published by
00009     the Free Software Foundation; either version 3 of the License, or
00010     (at your option) any later version.
00011 
00012     0MQ is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015     GNU Lesser General Public License for more details.
00016 
00017     You should have received a copy of the GNU Lesser General Public License
00018     along with this program.  If not, see <http://www.gnu.org/licenses/>.
00019 */
00020 
00021 #ifndef __ZMQ_XREQ_HPP_INCLUDED__
00022 #define __ZMQ_XREQ_HPP_INCLUDED__
00023 
00024 #include "socket_base.hpp"
00025 #include "session_base.hpp"
00026 #include "fq.hpp"
00027 #include "lb.hpp"
00028 
00029 namespace zmq
00030 {
00031 
00032     class xreq_t :
00033         public socket_base_t
00034     {
00035     public:
00036 
00037         xreq_t (class ctx_t *parent_, uint32_t tid_);
00038         ~xreq_t ();
00039 
00040     protected:
00041 
00042         //  Overloads of functions from socket_base_t.
00043         void xattach_pipe (class pipe_t *pipe_);
00044         int xsend (class msg_t *msg_, int flags_);
00045         int xrecv (class msg_t *msg_, int flags_);
00046         bool xhas_in ();
00047         bool xhas_out ();
00048         void xread_activated (class pipe_t *pipe_);
00049         void xwrite_activated (class pipe_t *pipe_);
00050         void xterminated (class pipe_t *pipe_);
00051 
00052     private:
00053 
00054         //  Messages are fair-queued from inbound pipes. And load-balanced to
00055         //  the outbound pipes.
00056         fq_t fq;
00057         lb_t lb;
00058 
00059         xreq_t (const xreq_t&);
00060         const xreq_t &operator = (const xreq_t&);
00061     };
00062 
00063     class xreq_session_t : public session_base_t
00064     {
00065     public:
00066 
00067         xreq_session_t (class io_thread_t *io_thread_, bool connect_,
00068             class socket_base_t *socket_, const options_t &options_,
00069             const char *protocol_, const char *address_);
00070         ~xreq_session_t ();
00071 
00072     private:
00073 
00074         xreq_session_t (const xreq_session_t&);
00075         const xreq_session_t &operator = (const xreq_session_t&);
00076     };
00077 
00078 }
00079 
00080 #endif
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines