mirror of
https://github.com/espressif/openthread.git
synced 2026-07-28 14:47:46 +00:00
[dns-client] add const to address pointer (#4399)
- Also change CLI implementation to avoid reference binding to null pointer.
This commit is contained in:
@@ -85,11 +85,11 @@ typedef struct otDnsQuery
|
||||
* @retval OT_ERROR_FAILED A response was received but status code is different than success.
|
||||
*
|
||||
*/
|
||||
typedef void (*otDnsResponseHandler)(void * aContext,
|
||||
const char * aHostname,
|
||||
otIp6Address *aAddress,
|
||||
uint32_t aTtl,
|
||||
otError aResult);
|
||||
typedef void (*otDnsResponseHandler)(void * aContext,
|
||||
const char * aHostname,
|
||||
const otIp6Address *aAddress,
|
||||
uint32_t aTtl,
|
||||
otError aResult);
|
||||
|
||||
/**
|
||||
* This function sends a DNS query for AAAA (IPv6) record.
|
||||
|
||||
+12
-9
@@ -1078,23 +1078,26 @@ exit:
|
||||
}
|
||||
}
|
||||
|
||||
void Interpreter::HandleDnsResponse(void * aContext,
|
||||
const char * aHostname,
|
||||
otIp6Address *aAddress,
|
||||
uint32_t aTtl,
|
||||
otError aResult)
|
||||
void Interpreter::HandleDnsResponse(void * aContext,
|
||||
const char * aHostname,
|
||||
const otIp6Address *aAddress,
|
||||
uint32_t aTtl,
|
||||
otError aResult)
|
||||
{
|
||||
static_cast<Interpreter *>(aContext)->HandleDnsResponse(aHostname, *static_cast<Ip6::Address *>(aAddress), aTtl,
|
||||
aResult);
|
||||
static_cast<Interpreter *>(aContext)->HandleDnsResponse(aHostname, static_cast<const Ip6::Address *>(aAddress),
|
||||
aTtl, aResult);
|
||||
}
|
||||
|
||||
void Interpreter::HandleDnsResponse(const char *aHostname, Ip6::Address &aAddress, uint32_t aTtl, otError aResult)
|
||||
void Interpreter::HandleDnsResponse(const char *aHostname, const Ip6::Address *aAddress, uint32_t aTtl, otError aResult)
|
||||
{
|
||||
mServer->OutputFormat("DNS response for %s - ", aHostname);
|
||||
|
||||
if (aResult == OT_ERROR_NONE)
|
||||
{
|
||||
OutputIp6Address(aAddress);
|
||||
if (aAddress != NULL)
|
||||
{
|
||||
OutputIp6Address(*aAddress);
|
||||
}
|
||||
mServer->OutputFormat(" TTL: %d\r\n", aTtl);
|
||||
}
|
||||
else
|
||||
|
||||
+6
-6
@@ -350,11 +350,11 @@ private:
|
||||
static void HandleDiagnosticGetResponse(otMessage *aMessage, const otMessageInfo *aMessageInfo, void *aContext);
|
||||
|
||||
#if OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE
|
||||
static void HandleDnsResponse(void * aContext,
|
||||
const char * aHostname,
|
||||
otIp6Address *aAddress,
|
||||
uint32_t aTtl,
|
||||
otError aResult);
|
||||
static void HandleDnsResponse(void * aContext,
|
||||
const char * aHostname,
|
||||
const otIp6Address *aAddress,
|
||||
uint32_t aTtl,
|
||||
otError aResult);
|
||||
#endif
|
||||
|
||||
#if OPENTHREAD_CONFIG_SNTP_CLIENT_ENABLE
|
||||
@@ -368,7 +368,7 @@ private:
|
||||
void HandleLinkPcapReceive(const otRadioFrame *aFrame, bool aIsTx);
|
||||
void HandleDiagnosticGetResponse(Message &aMessage, const Ip6::MessageInfo &aMessageInfo);
|
||||
#if OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE
|
||||
void HandleDnsResponse(const char *aHostname, Ip6::Address &aAddress, uint32_t aTtl, otError aResult);
|
||||
void HandleDnsResponse(const char *aHostname, const Ip6::Address *aAddress, uint32_t aTtl, otError aResult);
|
||||
#endif
|
||||
#if OPENTHREAD_CONFIG_SNTP_CLIENT_ENABLE
|
||||
void HandleSntpResponse(uint64_t aTime, otError aResult);
|
||||
|
||||
@@ -382,7 +382,7 @@ exit:
|
||||
|
||||
void Client::FinalizeDnsTransaction(Message & aQuery,
|
||||
const QueryMetadata &aQueryMetadata,
|
||||
otIp6Address * aAddress,
|
||||
const otIp6Address * aAddress,
|
||||
uint32_t aTtl,
|
||||
otError aResult)
|
||||
{
|
||||
|
||||
@@ -206,7 +206,7 @@ private:
|
||||
Message *FindRelatedQuery(const Header &aResponseHeader, QueryMetadata &aQueryMetadata);
|
||||
void FinalizeDnsTransaction(Message & aQuery,
|
||||
const QueryMetadata &aQueryMetadata,
|
||||
otIp6Address * aAddress,
|
||||
const otIp6Address * aAddress,
|
||||
uint32_t aTtl,
|
||||
otError aResult);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user