View on GitHub

Vistle

Distributed Data-parallel Scientific Visualization in VR

tcpmessage.h
Go to the documentation of this file.
1#ifndef TCPMESSAGE_H
2#define TCPMESSAGE_H
3
4#include <boost/asio/ip/tcp.hpp>
5
7
8#include "messagepayload.h"
9
10#include "export.h"
11
12namespace vistle {
13
14namespace message {
15
16class Message;
17class Buffer;
18
19typedef boost::asio::ip::tcp::socket socket_t;
20using boost::system::error_code;
21
22bool V_COREEXPORT send(socket_t &sock, const message::Message &msg, const buffer *payload = nullptr);
23bool V_COREEXPORT send(socket_t &sock, const message::Message &msg, error_code &ec, const buffer *payload = nullptr);
24bool V_COREEXPORT send(socket_t &sock, const message::Message &msg, error_code &ec, const char *payload, size_t size);
25void V_COREEXPORT async_send(socket_t &sock, const Message &msg, std::shared_ptr<buffer> payload,
26 const std::function<void(error_code ec)> handler);
27void V_COREEXPORT async_send(socket_t &sock, const Message &msg, const MessagePayload &payload,
28 const std::function<void(error_code ec)> handler);
29void V_COREEXPORT async_forward(socket_t &sock, const Message &msg, std::shared_ptr<socket_t> payloadSock,
30 const std::function<void(error_code ec)> handler);
31
32bool V_COREEXPORT recv(socket_t &sock, message::Buffer &msg, error_code &ec, bool block = false,
33 buffer *payload = nullptr);
34bool V_COREEXPORT recv_message(socket_t &sock, message::Buffer &msg, error_code &ec, bool block = false);
36 std::function<void(error_code, std::shared_ptr<buffer>)> handler);
38 std::function<void(error_code)> handler);
39
40void V_COREEXPORT return_buffer(std::shared_ptr<buffer> &buf);
41std::shared_ptr<buffer> V_COREEXPORT get_buffer(size_t size = 0);
42
43} // namespace message
44} // namespace vistle
45#endif
Definition: message.h:286
Definition: message.h:157
Definition: shm_reference.h:15
#define V_COREEXPORT
Definition: export.h:9
bool recv_message(socket_t &sock, message::Buffer &msg, error_code &ec, bool block)
Definition: tcpmessage.cpp:304
void async_recv(socket_t &sock, message::Buffer &msg, std::function< void(boost::system::error_code ec, std::shared_ptr< buffer >)> handler)
Definition: tcpmessage.cpp:414
boost::asio::ip::tcp::socket socket_t
Definition: tcpmessage.h:17
void async_recv_header(socket_t &sock, message::Buffer &msg, std::function< void(boost::system::error_code ec)> handler)
Definition: tcpmessage.cpp:429
void async_forward(socket_t &sock, const message::Message &msg, std::shared_ptr< socket_t > payloadSock, const std::function< void(error_code ec)> handler)
Definition: tcpmessage.cpp:523
bool recv(socket_t &sock, message::Buffer &msg, error_code &ec, bool block, buffer *payload)
Definition: tcpmessage.cpp:401
bool send(socket_t &sock, const message::Message &msg, error_code &ec, const char *payload, size_t size)
Definition: tcpmessage.cpp:447
std::shared_ptr< buffer > get_buffer(size_t size)
Definition: tcpmessage.cpp:87
void return_buffer(std::shared_ptr< buffer > &buf)
Definition: tcpmessage.cpp:71
void async_send(socket_t &sock, const message::Message &msg, std::shared_ptr< buffer > payload, const std::function< void(error_code ec)> handler)
Definition: tcpmessage.cpp:490
Definition: allobjects.cpp:30
std::vector< char, allocator< char > > buffer
Definition: buffer.h:9