Sese Framework  x.y.z
A cross-platform framework
载入中...
搜索中...
未找到
sese::net::dns::DnsPackage类 参考

DNS 包对象 更多...

#include <DnsPackage.h>

struct  Answer
 DNS 应答 更多...
 
struct  DnsHeader
 
struct  Flags
 DNS Flags 工具 更多...
 
class  Index
 DNS 打包压缩索引 更多...
 
struct  Question
 DNS 请求 更多...
 

Public 类型

using Authority = Answer
 DNS 权威应答
 
using Additional = Answer
 DNS 附加应答
 
using Ptr = std::shared_ptr<DnsPackage>
 

Public 成员函数

Index buildIndex ()
 
bool encode (void *buffer, size_t &length, Index &index) const
 
std::vector< Question > & getQuestions ()
 
std::vector< Answer > & getAnswers ()
 
std::vector< Authority > & getAuthorities ()
 
std::vector< Additional > & getAdditionals ()
 
auto getId () const
 
auto getFlags () const
 
void setId (uint16_t id)
 
void setFlags (uint16_t flags)
 

静态 Public 成员函数

static Ptr new_ ()
 
static Ptr decode (const uint8_t *buffer, size_t length)
 

Private 成员函数

 DnsPackage ()=default
 

静态 Private 成员函数

static std::string decodeWords (const uint8_t *buffer, size_t length, size_t &offset)
 
static bool decodeAnswers (std::vector< Answer > &answers, size_t expect_size, const uint8_t *buffer, size_t length, size_t &pos)
 
static std::string encodeWords (const std::string &fullname)
 
static bool encodeQuestions (const std::vector< Question > &questions, void *buffer, size_t &length, Index &index, size_t offset)
 
static bool encodeAnswers (const std::vector< Answer > &answers, void *buffer, size_t &length, Index &index, size_t offset)
 

Private 属性

struct sese::net::dns::DnsPackage::DnsHeader header
 
std::vector< Questionquestions
 
std::vector< Answeranswers
 
std::vector< Authorityauthorities
 
std::vector< Additionaladditionals
 

详细描述

DNS 包对象

成员类型定义说明

◆ Additional

◆ Authority

◆ Ptr

using sese::net::dns::DnsPackage::Ptr = std::shared_ptr<DnsPackage>

构造及析构函数说明

◆ DnsPackage()

sese::net::dns::DnsPackage::DnsPackage ( )
privatedefault

被这些函数引用 new_().

成员函数说明

◆ buildIndex()

DnsPackage::Index DnsPackage::buildIndex ( )

获取 DNS 打包压缩索引

返回
索引

引用了 additionals, answers, authorities , 以及 questions.

◆ decode()

DnsPackage::Ptr DnsPackage::decode ( const uint8_t * buffer,
size_t length )
static

解析 DNS 原始包

参数
bufferDNS 包缓存
length缓存大小
返回
成功返回对象,反之返回nullptr

引用了 sese::net::dns::DnsPackage::Question::class_, DECODE_HEADER, decodeAnswers(), decodeWords(), FromBigEndian16(), sese::net::dns::DnsPackage::Question::name, new_() , 以及 sese::net::dns::DnsPackage::Question::type.

被这些函数引用 sese::internal::net::service::dns::DnsService::handle().

◆ decodeAnswers()

bool DnsPackage::decodeAnswers ( std::vector< Answer > & answers,
size_t expect_size,
const uint8_t * buffer,
size_t length,
size_t & pos )
staticprivate

◆ decodeWords()

std::string DnsPackage::decodeWords ( const uint8_t * buffer,
size_t length,
size_t & offset )
staticprivate

解码 DNS 名称

警告
注意此函数会进行递归调用解码多级指针
参数
buffer完整 buffer
lengthbuffer 大小
offset需要解码的偏移位置,解码完成后停留在 00 位置
返回
解码后字符串

引用了 sese::text::AbstractStringBuffer::append(), decodeWords(), FromBigEndian16() , 以及 sese::text::AbstractStringBuffer::toString().

被这些函数引用 decode(), decodeAnswers() , 以及 decodeWords().

◆ encode()

bool DnsPackage::encode ( void * buffer,
size_t & length,
Index & index ) const

将 DNS 包编码至缓存

参数
buffer输出缓存
length输出缓存大小,执行成功将返回实际所用大小;若输入0则计算所需缓存大小,不执行实际打包操作
indexDNS 打包压缩索引
返回
是否执行成功

引用了 additionals, answers, authorities, sese::net::dns::DnsPackage::Index::clearPos(), encodeAnswers(), encodeQuestions(), sese::net::dns::DnsPackage::DnsHeader::flags, header, sese::net::dns::DnsPackage::DnsHeader::id, questions , 以及 ToBigEndian16().

◆ encodeAnswers()

bool DnsPackage::encodeAnswers ( const std::vector< Answer > & answers,
void * buffer,
size_t & length,
Index & index,
size_t offset )
staticprivate

◆ encodeQuestions()

bool DnsPackage::encodeQuestions ( const std::vector< Question > & questions,
void * buffer,
size_t & length,
Index & index,
size_t offset )
staticprivate

◆ encodeWords()

std::string DnsPackage::encodeWords ( const std::string & fullname)
staticprivate

◆ getAdditionals()

std::vector< Additional > & sese::net::dns::DnsPackage::getAdditionals ( )
inlinenodiscard

引用了 additionals.

◆ getAnswers()

std::vector< Answer > & sese::net::dns::DnsPackage::getAnswers ( )
inlinenodiscard

引用了 answers.

◆ getAuthorities()

std::vector< Authority > & sese::net::dns::DnsPackage::getAuthorities ( )
inlinenodiscard

引用了 authorities.

◆ getFlags()

auto sese::net::dns::DnsPackage::getFlags ( ) const
inlinenodiscard

◆ getId()

auto sese::net::dns::DnsPackage::getId ( ) const
inlinenodiscard

◆ getQuestions()

std::vector< Question > & sese::net::dns::DnsPackage::getQuestions ( )
inlinenodiscard

引用了 questions.

◆ new_()

DnsPackage::Ptr DnsPackage::new_ ( )
static
返回
空 DNS 打包压缩索引

引用了 DnsPackage().

被这些函数引用 decode(), sese::internal::net::service::dns::DnsService::handle() , 以及 sese::net::dns::Resolver::resolve().

◆ setFlags()

void sese::net::dns::DnsPackage::setFlags ( uint16_t flags)
inline

◆ setId()

void sese::net::dns::DnsPackage::setId ( uint16_t id)
inline

类成员变量说明

◆ additionals

std::vector<Additional> sese::net::dns::DnsPackage::additionals
private

被这些函数引用 buildIndex(), encode() , 以及 getAdditionals().

◆ answers

std::vector<Answer> sese::net::dns::DnsPackage::answers
private

◆ authorities

std::vector<Authority> sese::net::dns::DnsPackage::authorities
private

被这些函数引用 buildIndex(), encode() , 以及 getAuthorities().

◆ header

struct sese::net::dns::DnsPackage::DnsHeader sese::net::dns::DnsPackage::header
private

被这些函数引用 encode(), getFlags(), getId(), setFlags() , 以及 setId().

◆ questions

std::vector<Question> sese::net::dns::DnsPackage::questions
private

被这些函数引用 buildIndex(), encode(), encodeQuestions() , 以及 getQuestions().


该类的文档由以下文件生成: