![]() |
libzmq master
The Intelligent Transport Layer
|
00001 /* 00002 Copyright (c) 2009-2011 250bpm s.r.o. 00003 Copyright (c) 2007-2009 iMatix Corporation 00004 Copyright (c) 2011 VMware, Inc. 00005 Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file 00006 00007 This file is part of 0MQ. 00008 00009 0MQ is free software; you can redistribute it and/or modify it under 00010 the terms of the GNU Lesser General Public License as published by 00011 the Free Software Foundation; either version 3 of the License, or 00012 (at your option) any later version. 00013 00014 0MQ is distributed in the hope that it will be useful, 00015 but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 GNU Lesser General Public License for more details. 00018 00019 You should have received a copy of the GNU Lesser General Public License 00020 along with this program. If not, see <http://www.gnu.org/licenses/>. 00021 */ 00022 00023 #ifndef __ZMQ_REQ_HPP_INCLUDED__ 00024 #define __ZMQ_REQ_HPP_INCLUDED__ 00025 00026 #include "xreq.hpp" 00027 #include "stdint.hpp" 00028 00029 namespace zmq 00030 { 00031 00032 class req_t : public xreq_t 00033 { 00034 public: 00035 00036 req_t (class ctx_t *parent_, uint32_t tid_); 00037 ~req_t (); 00038 00039 // Overloads of functions from socket_base_t. 00040 int xsend (class msg_t *msg_, int flags_); 00041 int xrecv (class msg_t *msg_, int flags_); 00042 bool xhas_in (); 00043 bool xhas_out (); 00044 00045 private: 00046 00047 // If true, request was already sent and reply wasn't received yet or 00048 // was raceived partially. 00049 bool receiving_reply; 00050 00051 // If true, we are starting to send/recv a message. The first part 00052 // of the message must be empty message part (backtrace stack bottom). 00053 bool message_begins; 00054 00055 req_t (const req_t&); 00056 const req_t &operator = (const req_t&); 00057 }; 00058 00059 class req_session_t : public xreq_session_t 00060 { 00061 public: 00062 00063 req_session_t (class io_thread_t *io_thread_, bool connect_, 00064 class socket_base_t *socket_, const options_t &options_, 00065 const char *protocol_, const char *address_); 00066 ~req_session_t (); 00067 00068 // Overloads of the functions from session_base_t. 00069 int write (msg_t *msg_); 00070 00071 private: 00072 00073 enum { 00074 identity, 00075 bottom, 00076 body 00077 } state; 00078 00079 req_session_t (const req_session_t&); 00080 const req_session_t &operator = (const req_session_t&); 00081 }; 00082 00083 } 00084 00085 #endif