2009-07-29 12:07:54 +02:00
|
|
|
/*
|
2011-03-02 16:30:40 +01:00
|
|
|
Copyright (c) 2007-2011 iMatix Corporation
|
|
|
|
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
|
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/>.
|
|
|
|
*/
|
|
|
|
|
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>
|
|
|
|
|
2010-03-11 20:33:27 +01:00
|
|
|
#include "../include/zmq.h"
|
2009-07-29 12:07:54 +02:00
|
|
|
|
|
|
|
#include "atomic_counter.hpp"
|
|
|
|
|
2009-08-21 14:29:22 +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-21 14:29:22 +02:00
|
|
|
|
|
|
|
struct msg_content_t
|
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;
|
2009-12-16 15:08:37 +01:00
|
|
|
void *hint;
|
2009-08-03 11:30:13 +02:00
|
|
|
zmq::atomic_counter_t refcnt;
|
2009-07-29 12:07:54 +02:00
|
|
|
};
|
|
|
|
|
2009-08-21 14:29:22 +02:00
|
|
|
}
|
2009-07-29 12:07:54 +02:00
|
|
|
|
|
|
|
#endif
|