2009-07-29 12:07:54 +02:00
|
|
|
/*
|
|
|
|
Copyright (c) 2007-2009 FastMQ Inc.
|
|
|
|
|
|
|
|
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/>.
|
|
|
|
*/
|
|
|
|
|
2009-08-03 11:30:13 +02:00
|
|
|
#ifndef __ZMQ_MSG_HPP_INCLUDE__
|
|
|
|
#define __ZMQ_MSG_HPP_INCLUDE__
|
2009-07-29 12:07:54 +02:00
|
|
|
|
|
|
|
#include <stddef.h>
|
|
|
|
|
2009-08-03 11:30:13 +02:00
|
|
|
#include "../include/zmq.h"
|
2009-07-29 12:07:54 +02:00
|
|
|
|
|
|
|
#include "atomic_counter.hpp"
|
|
|
|
|
2009-08-03 11:30:13 +02:00
|
|
|
//namespace zmq
|
2009-07-29 12:07:54 +02:00
|
|
|
//{
|
|
|
|
|
|
|
|
// Shared message buffer. Message data are either allocated in one
|
2009-08-03 11:30:13 +02:00
|
|
|
// continuous block along with this structure - thus avoiding one
|
2009-07-29 12:07:54 +02:00
|
|
|
// malloc/free pair or they are stored in used-supplied memory.
|
|
|
|
// In the latter case, ffn member stores pointer to the function to be
|
|
|
|
// used to deallocate the data. If the buffer is actually shared (there
|
|
|
|
// are at least 2 references to it) refcount member contains number of
|
|
|
|
// references.
|
2009-08-03 11:30:13 +02:00
|
|
|
struct zmq_msg_content
|
2009-07-29 12:07:54 +02:00
|
|
|
{
|
|
|
|
void *data;
|
|
|
|
size_t size;
|
2009-08-03 11:30:13 +02:00
|
|
|
zmq_free_fn *ffn;
|
|
|
|
zmq::atomic_counter_t refcnt;
|
2009-07-29 12:07:54 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
#endif
|