mirror of
https://github.com/matrix-construct/construct
synced 2024-06-24 12:58:21 +02:00
ircd::rfc1035: Rename constant.
ircd::rfc3986: Add additional convenience constants.
This commit is contained in:
parent
1354066e3d
commit
44cf572ee5
|
@ -28,8 +28,8 @@ namespace ircd::rfc1035
|
|||
constexpr size_t NAME_MAX {255};
|
||||
constexpr size_t TTL_MAX {std::numeric_limits<int32_t>::max()};
|
||||
|
||||
constexpr size_t LABEL_BUF_SIZE {LABEL_MAX + 1};
|
||||
constexpr size_t NAME_BUF_SIZE {NAME_MAX + 1};
|
||||
constexpr size_t LABEL_BUFSIZE {LABEL_MAX + 1};
|
||||
constexpr size_t NAME_BUFSIZE {NAME_MAX + 1};
|
||||
|
||||
extern const std::array<string_view, 25> rcode;
|
||||
extern const std::unordered_map<string_view, uint16_t> qtype;
|
||||
|
@ -107,7 +107,7 @@ struct ircd::rfc1035::question
|
|||
uint16_t qtype {0};
|
||||
uint16_t qclass {0x01};
|
||||
string_view name;
|
||||
char namebuf[NAME_BUF_SIZE];
|
||||
char namebuf[NAME_BUFSIZE];
|
||||
|
||||
/// Composes the question into buffer, returns used portion
|
||||
mutable_buffer print(const mutable_buffer &) const;
|
||||
|
@ -139,7 +139,7 @@ struct ircd::rfc1035::answer
|
|||
uint16_t rdlength {0};
|
||||
const_buffer rdata;
|
||||
string_view name;
|
||||
char namebuf[NAME_BUF_SIZE];
|
||||
char namebuf[NAME_BUFSIZE];
|
||||
|
||||
const_buffer parse(const const_buffer &);
|
||||
|
||||
|
@ -233,7 +233,7 @@ struct ircd::rfc1035::record::CNAME
|
|||
:record
|
||||
{
|
||||
string_view name;
|
||||
char namebuf[NAME_BUF_SIZE];
|
||||
char namebuf[NAME_BUFSIZE];
|
||||
|
||||
void append(json::stack::object &) const;
|
||||
|
||||
|
@ -250,7 +250,7 @@ struct ircd::rfc1035::record::SRV
|
|||
uint16_t weight {0};
|
||||
uint16_t port {0};
|
||||
string_view tgt;
|
||||
char tgtbuf[NAME_BUF_SIZE];
|
||||
char tgtbuf[NAME_BUFSIZE];
|
||||
|
||||
void append(json::stack::object &) const;
|
||||
|
||||
|
|
|
@ -14,15 +14,17 @@
|
|||
/// Universal Resource Indicator (URI) grammars & tools
|
||||
namespace ircd::rfc3986
|
||||
{
|
||||
struct parser;
|
||||
|
||||
IRCD_EXCEPTION(ircd::error, error)
|
||||
IRCD_EXCEPTION(error, coding_error)
|
||||
IRCD_EXCEPTION(coding_error, encoding_error)
|
||||
IRCD_EXCEPTION(coding_error, decoding_error)
|
||||
|
||||
struct parser;
|
||||
|
||||
constexpr size_t HOSTNAME_MAX {rfc1035::LABEL_MAX};
|
||||
constexpr size_t DOMAIN_MAX {rfc1035::NAME_MAX};
|
||||
constexpr size_t HOSTNAME_MAX { rfc1035::LABEL_MAX };
|
||||
constexpr size_t HOSTNAME_BUFSIZE { HOSTNAME_MAX + 1 };
|
||||
constexpr size_t DOMAIN_MAX { rfc1035::NAME_MAX };
|
||||
constexpr size_t DOMAIN_BUFSIZE { DOMAIN_MAX + 1 };
|
||||
|
||||
// urlencoding suite
|
||||
string_view encode(const mutable_buffer &, const string_view &url);
|
||||
|
|
|
@ -3316,7 +3316,7 @@ ircd::m::room::origins::for_each(const closure_bool &view)
|
|||
const
|
||||
{
|
||||
string_view last;
|
||||
char lastbuf[rfc1035::NAME_BUF_SIZE];
|
||||
char lastbuf[rfc1035::NAME_BUFSIZE];
|
||||
return _for_each(*this, [&last, &lastbuf, &view]
|
||||
(const string_view &key)
|
||||
{
|
||||
|
|
|
@ -3650,7 +3650,7 @@ noexcept try
|
|||
|
||||
if(!verifier(true, vc))
|
||||
{
|
||||
thread_local char buf[rfc1035::NAME_BUF_SIZE];
|
||||
thread_local char buf[rfc1035::NAME_BUFSIZE];
|
||||
const critical_assertion ca;
|
||||
throw inauthentic
|
||||
{
|
||||
|
|
|
@ -456,12 +456,12 @@ size_t
|
|||
ircd::rfc1035::parse_name(const mutable_buffer &out,
|
||||
const const_buffer &in)
|
||||
{
|
||||
if(unlikely(size(out) < NAME_BUF_SIZE))
|
||||
if(unlikely(size(out) < NAME_BUFSIZE))
|
||||
throw error
|
||||
{
|
||||
"Name output buffer is %zu but RFC1035 requires %zu",
|
||||
size(out),
|
||||
NAME_BUF_SIZE
|
||||
NAME_BUFSIZE
|
||||
};
|
||||
|
||||
if(unlikely(empty(in)))
|
||||
|
|
|
@ -395,7 +395,7 @@ ircd::net::dns::cache::put(const hostport &hp,
|
|||
make_type(type_buf, opts.qtype)
|
||||
};
|
||||
|
||||
char state_key_buf[rfc1035::NAME_BUF_SIZE * 2];
|
||||
char state_key_buf[rfc1035::NAME_BUFSIZE * 2];
|
||||
const string_view &state_key
|
||||
{
|
||||
opts.qtype == 33?
|
||||
|
@ -423,7 +423,7 @@ ircd::net::dns::cache::put(const hostport &hp,
|
|||
make_type(type_buf, type_code)
|
||||
};
|
||||
|
||||
char state_key_buf[rfc1035::NAME_BUF_SIZE * 2];
|
||||
char state_key_buf[rfc1035::NAME_BUFSIZE * 2];
|
||||
const string_view &state_key
|
||||
{
|
||||
opts.qtype == 33?
|
||||
|
@ -615,7 +615,7 @@ ircd::net::dns::cache::get(const hostport &hp,
|
|||
make_type(type_buf, opts.qtype)
|
||||
};
|
||||
|
||||
char state_key_buf[rfc1035::NAME_BUF_SIZE * 2];
|
||||
char state_key_buf[rfc1035::NAME_BUFSIZE * 2];
|
||||
const string_view &state_key
|
||||
{
|
||||
opts.qtype == 33?
|
||||
|
@ -677,7 +677,7 @@ ircd::net::dns::cache::for_each(const hostport &hp,
|
|||
make_type(type_buf, opts.qtype)
|
||||
};
|
||||
|
||||
char state_key_buf[rfc1035::NAME_BUF_SIZE * 2];
|
||||
char state_key_buf[rfc1035::NAME_BUFSIZE * 2];
|
||||
const string_view &state_key
|
||||
{
|
||||
opts.qtype == 33?
|
||||
|
|
|
@ -57,7 +57,7 @@ struct ircd::net::dns::cache::waiter
|
|||
dns::opts opts;
|
||||
uint16_t port {0};
|
||||
string_view key;
|
||||
char keybuf[rfc1035::NAME_BUF_SIZE*2];
|
||||
char keybuf[rfc1035::NAME_BUFSIZE*2];
|
||||
|
||||
waiter(const hostport &hp, const dns::opts &opts, dns::callback &&callback)
|
||||
:callback{std::move(callback)}
|
||||
|
@ -166,7 +166,7 @@ struct ircd::net::dns::tag
|
|||
uint8_t tries {0};
|
||||
uint rcode {0};
|
||||
ipport server;
|
||||
char hostbuf[rfc1035::NAME_BUF_SIZE];
|
||||
char hostbuf[rfc1035::NAME_BUFSIZE];
|
||||
char qbuf[512];
|
||||
|
||||
tag(const hostport &hp, const dns::opts &opts)
|
||||
|
|
|
@ -177,7 +177,7 @@ ircd::const_buffer
|
|||
ircd::net::dns::resolver::make_query(const mutable_buffer &buf,
|
||||
tag &tag)
|
||||
{
|
||||
thread_local char hostbuf[rfc1035::NAME_BUF_SIZE * 2];
|
||||
thread_local char hostbuf[rfc1035::NAME_BUFSIZE * 2];
|
||||
string_view hoststr;
|
||||
switch(tag.opts.qtype)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue