14 #include <boost/asio/ip/address.hpp> 15 #include <boost/asio/ip/tcp.hpp> 16 #include <boost/asio/ip/udp.hpp> 42 boost::asio::ip::address_v4::bytes_type
v4;
43 boost::asio::ip::address_v6::bytes_type
v6;
51 "Size shouldn't be more than" 67 std::is_same<P, boost::asio::ip::tcp>::value ||
68 std::is_same<P, boost::asio::ip::udp>::value,
"Invalid protocol.");
69 return std::is_same<P, boost::asio::ip::tcp>::value ?
78 return {get_address(), _token.port};
83 template <
typename Protocol>
88 _token.port = ep.
port();
89 _token.protocol = get_protocol<Protocol>();
93 template <
typename Protocol>
98 _token.port = ep.
port();
99 _token.protocol = get_protocol<Protocol>();
112 operator Token()
const;
117 return _token.stream_id;
121 _token.stream_id = id;
128 void set_address(
const boost::asio::ip::address &addr);
130 boost::asio::ip::address get_address()
const;
137 return has_address() &&
158 template <
typename Protocol>
160 return _token.protocol == get_protocol<Protocol>();
164 return get_endpoint<boost::asio::ip::udp>();
168 return get_endpoint<boost::asio::ip::tcp>();
boost::asio::ip::tcp::endpoint to_tcp_endpoint() const
std::array< unsigned char, 24u > data
token_type(stream_id_type stream_id, EndPoint< Protocol, PartiallyDefinedEndPoint > ep)
This file contains definitions of common data structures used in traffic manager. ...
boost::asio::ip::udp::endpoint to_udp_endpoint() const
bool protocol_is_udp() const
boost::asio::ip::address_v6::bytes_type v6
#define DEBUG_ASSERT(predicate)
bool has_same_protocol(const boost::asio::ip::basic_endpoint< Protocol > &) const
bool protocol_is_tcp() const
Serializes a stream endpoint.
token_type(token_data data)
A token that uniquely identify a stream.
token_type(stream_id_type stream_id, const EndPoint< Protocol, FullyDefinedEndPoint > &ep)
bool address_is_v6() const
enum carla::streaming::detail::token_data::address address_type
Keeps the mapping between streams and sessions.
boost::asio::ip::address_v4::bytes_type v4
const auto & get_stream_id() const
boost::asio::ip::basic_endpoint< P > get_endpoint() const
static constexpr auto get_protocol()
bool address_is_v4() const
carla::streaming::detail::token_type token_type
void set_stream_id(stream_id_type id)