const_buffer connection_engine::write_buffer() const {
    ssize_t pending = pn_transport_pending(unwrap(transport_));
    if (pending > 0)
        return const_buffer(pn_transport_head(unwrap(transport_)), pending);
    else
        return const_buffer(0, 0);
}
Beispiel #2
0
/**
 * @relates const_buffer
 */
inline const_buffer operator+(std::size_t start, const const_buffer& b)
{
  if (start > buffer_size(b))
    return const_buffer();
  const char* new_data = buffer_cast<const char*>(b) + start;
  std::size_t new_size = buffer_size(b) - start;
  return const_buffer(new_data, new_size);
}
Beispiel #3
0
inline const_buffer_container_1 buffer(const Pod_Type (&data)[N],
    std::size_t max_size_in_bytes)
{
  return const_buffer_container_1(
      const_buffer(data,
        N * sizeof(Pod_Type) < max_size_in_bytes
        ? N * sizeof(Pod_Type) : max_size_in_bytes));
}
Beispiel #4
0
/**
 * @note The buffer is invalidated by any non-const operation called on the
 * given string object.
 */
inline const_buffer_container_1 buffer(const std::string& data,
    std::size_t max_size_in_bytes)
{
  return const_buffer_container_1(
      const_buffer(data.data(),
        data.size() < max_size_in_bytes
        ? data.size() : max_size_in_bytes));
}
Beispiel #5
0
/// Create a new non-modifiable buffer from an existing buffer.
inline const_buffer_container_1 buffer(const const_buffer& b,
    std::size_t max_size_in_bytes)
{
  return const_buffer_container_1(
      const_buffer(buffer_cast<const void*>(b),
        buffer_size(b) < max_size_in_bytes
        ? buffer_size(b) : max_size_in_bytes));
}
Beispiel #6
0
inline const_buffer_container_1 buffer(const boost::array<Pod_Type, N>& data,
    std::size_t max_size_in_bytes)
{
  return const_buffer_container_1(
      const_buffer(data.data(),
        data.size() * sizeof(Pod_Type) < max_size_in_bytes
        ? data.size() * sizeof(Pod_Type) : max_size_in_bytes));
}
Beispiel #7
0
inline const_buffer_container_1 buffer(
    const std::vector<Pod_Type, Allocator>& data, std::size_t max_size_in_bytes)
{
  return const_buffer_container_1(
      const_buffer(&data[0],
        data.size() * sizeof(Pod_Type) < max_size_in_bytes
        ? data.size() * sizeof(Pod_Type) : max_size_in_bytes));
}
Beispiel #8
0
	void encryption::set_ca_filename(const std::string& filename)
	{
		_last_error.clear();

		if (!filename.empty())
		{
			auto file = helper::read_binary_file(filename);

			if (file.second > 0)
			{
				_context.add_certificate_authority(const_buffer(file.first.get(), file.second));
			}
			else
			{
				_last_error = "Can't read CA file";
			}
		}
	}
Beispiel #9
0
	inline const_buffer cbuf(const std::string &message)
	{
		return const_buffer((const byte_t*)message.c_str(),message.length());
	}
Beispiel #10
0
	inline const_buffer cbuf(const char * message)
	{
		return const_buffer((const byte_t*)message,strlen(message));
	}
Beispiel #11
0
	inline const_buffer cbuf(const char * message,size_t length)
	{
		return const_buffer((const byte_t*)message,length);
	}
Beispiel #12
0
	inline const_buffer cbuf(const byte_t (&source) [N])
	{
		return const_buffer(source,N);
	}
Beispiel #13
0
	inline const_buffer cbuf(const T (&source) [N])
	{
		return const_buffer((const lemon::byte_t *)source,N * sizeof(T));
	}
Beispiel #14
0
	inline const_buffer cbuf(const byte_t * source,size_t length)
	{
		return const_buffer(source,length);
	}
Beispiel #15
0
	inline const_buffer cbuf(void * source,size_t length)
	{
		return const_buffer((byte_t*)source,length);
	}
Beispiel #16
0
/// Create a new non-modifiable buffer that represents the given memory range.
inline const_buffer_container_1 buffer(const void* data,
    std::size_t size_in_bytes)
{
  return const_buffer_container_1(const_buffer(data, size_in_bytes));
}
Beispiel #17
0
inline const_buffer cbuf(const T & t)
{
    return const_buffer((const lemon_byte_t*)&t,sizeof(T));
}
Beispiel #18
0
inline const_buffer_container_1 buffer(const Pod_Type (&data)[N])
{
  return const_buffer_container_1(const_buffer(data, N * sizeof(Pod_Type)));
}
Beispiel #19
0
inline const_buffer_container_1 buffer(
    const std::vector<Pod_Type, Allocator>& data)
{
  return const_buffer_container_1(
      const_buffer(&data[0], data.size() * sizeof(Pod_Type)));
}
Beispiel #20
0
inline const_buffer_container_1 buffer(const boost::array<Pod_Type, N>& data)
{
  return const_buffer_container_1(
      const_buffer(data.data(), data.size() * sizeof(Pod_Type)));
}
Beispiel #21
0
/**
 * @note The buffer is invalidated by any non-const operation called on the
 * given string object.
 */
inline const_buffer_container_1 buffer(const std::string& data)
{
  return const_buffer_container_1(const_buffer(data.data(), data.size()));
}
Beispiel #22
0
inline const_buffer cbuf(const lemon::char_t * message)
{
    return const_buffer((const byte_t*)message,lemon_strlen(message) * sizeof(lemon::char_t));
}