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