2009-07-29 12:07:54 +02:00
|
|
|
/*
|
2010-01-05 08:29:35 +01:00
|
|
|
Copyright (c) 2007-2010 iMatix Corporation
|
2009-07-29 12:07:54 +02:00
|
|
|
|
|
|
|
This file is part of 0MQ.
|
|
|
|
|
|
|
|
0MQ is free software; you can redistribute it and/or modify it under
|
2010-10-30 15:08:28 +02:00
|
|
|
the terms of the GNU Lesser General Public License as published by
|
2009-07-29 12:07:54 +02:00
|
|
|
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
|
2010-10-30 15:08:28 +02:00
|
|
|
GNU Lesser General Public License for more details.
|
2009-07-29 12:07:54 +02:00
|
|
|
|
2010-10-30 15:08:28 +02:00
|
|
|
You should have received a copy of the GNU Lesser General Public License
|
2009-07-29 12:07:54 +02:00
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2010-11-05 17:39:51 +01:00
|
|
|
#ifndef __ZMQ_MAILBOX_HPP_INCLUDED__
|
|
|
|
#define __ZMQ_MAILBOX_HPP_INCLUDED__
|
2009-07-29 12:07:54 +02:00
|
|
|
|
2010-04-29 20:34:48 +02:00
|
|
|
#include <stddef.h>
|
|
|
|
|
2009-07-29 12:07:54 +02:00
|
|
|
#include "platform.hpp"
|
|
|
|
#include "fd.hpp"
|
|
|
|
#include "stdint.hpp"
|
2010-04-29 20:34:48 +02:00
|
|
|
#include "config.hpp"
|
2010-05-04 10:22:16 +02:00
|
|
|
#include "command.hpp"
|
2009-07-29 12:07:54 +02:00
|
|
|
|
2009-08-03 11:30:13 +02:00
|
|
|
namespace zmq
|
2009-07-29 12:07:54 +02:00
|
|
|
{
|
|
|
|
|
2010-11-05 17:39:51 +01:00
|
|
|
class mailbox_t
|
2009-07-29 12:07:54 +02:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2010-11-05 17:39:51 +01:00
|
|
|
mailbox_t ();
|
|
|
|
~mailbox_t ();
|
2009-07-29 12:07:54 +02:00
|
|
|
|
|
|
|
fd_t get_fd ();
|
2010-05-04 10:22:16 +02:00
|
|
|
void send (const command_t &cmd_);
|
2010-09-08 08:39:27 +02:00
|
|
|
int recv (command_t *cmd_, bool block_);
|
2010-05-04 10:22:16 +02:00
|
|
|
|
2009-07-29 12:07:54 +02:00
|
|
|
private:
|
|
|
|
|
|
|
|
// Write & read end of the socketpair.
|
|
|
|
fd_t w;
|
|
|
|
fd_t r;
|
|
|
|
|
2010-11-04 17:54:47 +01:00
|
|
|
// Platform-dependent function to create a socketpair.
|
|
|
|
static int make_socketpair (fd_t *r_, fd_t *w_);
|
|
|
|
|
2010-11-05 17:39:51 +01:00
|
|
|
// Disable copying of mailbox_t object.
|
|
|
|
mailbox_t (const mailbox_t&);
|
|
|
|
void operator = (const mailbox_t&);
|
2009-07-29 12:07:54 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|