mirror of
https://github.com/espressif/openthread.git
synced 2026-10-01 21:37:39 +00:00
[dnssd-server] typos and smaller style changes (#6791)
This commit is contained in:
@@ -78,6 +78,7 @@ exit:
|
|||||||
{
|
{
|
||||||
IgnoreError(mSocket.Close());
|
IgnoreError(mSocket.Close());
|
||||||
}
|
}
|
||||||
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,6 +92,7 @@ void Server::Stop(void)
|
|||||||
FinalizeQuery(query, Header::kResponseServerFailure);
|
FinalizeQuery(query, Header::kResponseServerFailure);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mTimer.Stop();
|
mTimer.Stop();
|
||||||
|
|
||||||
IgnoreError(mSocket.Close());
|
IgnoreError(mSocket.Close());
|
||||||
@@ -217,13 +219,14 @@ Header::Response Server::AddQuestions(const Header & aRequestHeader,
|
|||||||
for (uint16_t i = 0; i < aRequestHeader.GetQuestionCount(); i++)
|
for (uint16_t i = 0; i < aRequestHeader.GetQuestionCount(); i++)
|
||||||
{
|
{
|
||||||
NameComponentsOffsetInfo nameComponentsOffsetInfo;
|
NameComponentsOffsetInfo nameComponentsOffsetInfo;
|
||||||
|
uint16_t qtype;
|
||||||
|
|
||||||
VerifyOrExit(kErrorNone == Name::ReadName(aRequestMessage, readOffset, name, sizeof(name)),
|
VerifyOrExit(kErrorNone == Name::ReadName(aRequestMessage, readOffset, name, sizeof(name)),
|
||||||
response = Header::kResponseFormatError);
|
response = Header::kResponseFormatError);
|
||||||
VerifyOrExit(kErrorNone == aRequestMessage.Read(readOffset, question), response = Header::kResponseFormatError);
|
VerifyOrExit(kErrorNone == aRequestMessage.Read(readOffset, question), response = Header::kResponseFormatError);
|
||||||
readOffset += sizeof(question);
|
readOffset += sizeof(question);
|
||||||
|
|
||||||
uint16_t qtype = question.GetType();
|
qtype = question.GetType();
|
||||||
|
|
||||||
VerifyOrExit(qtype == ResourceRecord::kTypePtr || qtype == ResourceRecord::kTypeSrv ||
|
VerifyOrExit(qtype == ResourceRecord::kTypePtr || qtype == ResourceRecord::kTypeSrv ||
|
||||||
qtype == ResourceRecord::kTypeTxt || qtype == ResourceRecord::kTypeAaaa,
|
qtype == ResourceRecord::kTypeTxt || qtype == ResourceRecord::kTypeAaaa,
|
||||||
@@ -423,8 +426,7 @@ exit:
|
|||||||
|
|
||||||
Error Server::AppendInstanceName(Message &aMessage, const char *aName, NameCompressInfo &aCompressInfo)
|
Error Server::AppendInstanceName(Message &aMessage, const char *aName, NameCompressInfo &aCompressInfo)
|
||||||
{
|
{
|
||||||
Error error;
|
Error error;
|
||||||
|
|
||||||
uint16_t instanceCompressOffset = aCompressInfo.GetInstanceNameOffset(aMessage, aName);
|
uint16_t instanceCompressOffset = aCompressInfo.GetInstanceNameOffset(aMessage, aName);
|
||||||
|
|
||||||
if (instanceCompressOffset != NameCompressInfo::kUnknownOffset)
|
if (instanceCompressOffset != NameCompressInfo::kUnknownOffset)
|
||||||
@@ -817,11 +819,11 @@ Server::QueryTransaction *Server::NewQuery(const Header & aResponseHead
|
|||||||
}
|
}
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
|
||||||
if (newQuery != nullptr)
|
if (newQuery != nullptr)
|
||||||
{
|
{
|
||||||
ResetTimer();
|
ResetTimer();
|
||||||
}
|
}
|
||||||
|
|
||||||
return newQuery;
|
return newQuery;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -986,22 +988,24 @@ void Server::HandleDiscoveredHost(const char *aHostFullName, const otDnssdHostIn
|
|||||||
|
|
||||||
const otDnssdQuery *Server::GetNextQuery(const otDnssdQuery *aQuery) const
|
const otDnssdQuery *Server::GetNextQuery(const otDnssdQuery *aQuery) const
|
||||||
{
|
{
|
||||||
const QueryTransaction *now = &mQueryTransactions[0];
|
const QueryTransaction *cur = &mQueryTransactions[0];
|
||||||
const QueryTransaction *found = nullptr;
|
const QueryTransaction *found = nullptr;
|
||||||
const QueryTransaction *query = static_cast<const QueryTransaction *>(aQuery);
|
const QueryTransaction *query = static_cast<const QueryTransaction *>(aQuery);
|
||||||
|
|
||||||
if (aQuery != nullptr)
|
if (aQuery != nullptr)
|
||||||
{
|
{
|
||||||
now = query + 1;
|
cur = query + 1;
|
||||||
}
|
}
|
||||||
for (; now < &mQueryTransactions[OT_ARRAY_LENGTH(mQueryTransactions)]; now++)
|
|
||||||
|
for (; cur < OT_ARRAY_END(mQueryTransactions); cur++)
|
||||||
{
|
{
|
||||||
if (now->IsValid())
|
if (cur->IsValid())
|
||||||
{
|
{
|
||||||
found = now;
|
found = cur;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return static_cast<const otDnssdQuery *>(found);
|
return static_cast<const otDnssdQuery *>(found);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ class Server : public InstanceLocator, private NonCopyable
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* This enumeration specifies a dns-sd query type.
|
* This enumeration specifies a DNS-SD query type.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
enum DnsQueryType : uint8_t
|
enum DnsQueryType : uint8_t
|
||||||
@@ -125,7 +125,7 @@ public:
|
|||||||
void HandleDiscoveredHost(const char *aHostFullName, const otDnssdHostInfo &aHostInfo);
|
void HandleDiscoveredHost(const char *aHostFullName, const otDnssdHostInfo &aHostInfo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function aquires the next query in the server.
|
* This method acquires the next query in the server.
|
||||||
*
|
*
|
||||||
* @param[in] aQuery The query pointer. Pass nullptr to get the first query.
|
* @param[in] aQuery The query pointer. Pass nullptr to get the first query.
|
||||||
*
|
*
|
||||||
@@ -135,12 +135,12 @@ public:
|
|||||||
const otDnssdQuery *GetNextQuery(const otDnssdQuery *aQuery) const;
|
const otDnssdQuery *GetNextQuery(const otDnssdQuery *aQuery) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function aquires the dns-sd query type and name for a specific query.
|
* This method acquires the DNS-SD query type and name for a specific query.
|
||||||
*
|
*
|
||||||
* @param[in] aQuery The query pointer.
|
* @param[in] aQuery The query pointer.
|
||||||
* @param[out] aNameOutput The name output buffer.
|
* @param[out] aNameOutput The name output buffer.
|
||||||
*
|
*
|
||||||
* @returns The dns-sd query type.
|
* @returns The DNS-SD query type.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static DnsQueryType GetQueryTypeAndName(const otDnssdQuery *aQuery, char (&aName)[Name::kMaxNameSize]);
|
static DnsQueryType GetQueryTypeAndName(const otDnssdQuery *aQuery, char (&aName)[Name::kMaxNameSize]);
|
||||||
|
|||||||
Reference in New Issue
Block a user