15#include <boost/asio/ip/address.hpp>
16#include <boost/asio/ip/tcp.hpp>
17#include <boost/asio/ip/udp.hpp>
68 boost::asio::ip::address_v4::bytes_type
v4;
69 boost::asio::ip::address_v6::bytes_type
v6;
87 "Size shouldn't be more than"
107 template <
typename P>
110 std::is_same<P, boost::asio::ip::tcp>::value ||
111 std::is_same<P, boost::asio::ip::udp>::value,
"Invalid protocol.");
112 return std::is_same<P, boost::asio::ip::tcp>::value ?
123 template <
typename P>
138 template <
typename Protocol>
154 template <
typename Protocol>
190 operator Token()
const;
223 void set_address(
const boost::asio::ip::address &addr);
290 template <
typename Protocol>
302 return get_endpoint<boost::asio::ip::udp>();
312 return get_endpoint<boost::asio::ip::tcp>();
#define DEBUG_ASSERT(predicate)
std::array< unsigned char, 24u > data
Keeps the mapping between streams and sessions.
静态断言,用于确保token_data结构体的大小与Token::data的大小相同。
bool is_valid() const
检查令牌是否有效。
boost::asio::ip::tcp::endpoint to_tcp_endpoint() const
将令牌转换为TCP端点。
boost::asio::ip::address get_address() const
获取地址。
bool address_is_v6() const
检查地址是否为IPv6。
const auto & get_stream_id() const
获取流ID的引用。
static constexpr auto get_protocol()
根据协议类型获取对应的协议枚举值。
boost::asio::ip::basic_endpoint< P > get_endpoint() const
获取与令牌关联的端点。
token_type(stream_id_type stream_id, EndPoint< Protocol, PartiallyDefinedEndPoint > ep)
构造一个token_type对象,使用指定的流ID和部分定义的端点。
bool has_same_protocol(const boost::asio::ip::basic_endpoint< Protocol > &) const
检查是否具有相同的协议。
token_type()=default
默认构造函数,用于创建未初始化的token_type对象。
boost::asio::ip::udp::endpoint to_udp_endpoint() const
将令牌转换为UDP端点。
void set_address(const boost::asio::ip::address &addr)
设置地址。
auto get_port() const
获取端口号。
bool protocol_is_tcp() const
检查协议是否为TCP。
token_type(stream_id_type stream_id, const EndPoint< Protocol, FullyDefinedEndPoint > &ep)
构造函数,根据给定的流ID和端点创建令牌。
bool has_address() const
检查是否已设置地址。
token_data _token
存储令牌数据的成员变量。
bool protocol_is_udp() const
检查协议是否为UDP。
bool address_is_v4() const
检查地址是否为IPv4。
token_type(token_data data)
转换构造函数,从token_data对象创建token_type对象。
token_type(const token_type &)=default
拷贝构造函数,用于创建与另一个token_type对象相同的副本。
void set_stream_id(stream_id_type id)
设置流ID。
uint32_t stream_id_type
流ID的类型定义。
enum carla::streaming::detail::token_data::address address_type
boost::asio::ip::address_v4::bytes_type v4
IPv4地址的字节表示
stream_id_type stream_id
流ID,用于唯一标识一个流。
protocol
协议类型枚举,指示使用的传输协议。
boost::asio::ip::address_v6::bytes_type v6
IPv6地址的字节表示
令牌数据结构,用于存储流传输的相关信息。 ::::