@@ -539,6 +539,40 @@ typedef struct otPlatDnssdAddressResolver
539539 otPlatDnssdAddressCallback mCallback ; ///< The callback to report result.
540540} otPlatDnssdAddressResolver ;
541541
542+ /**
543+ * Represents a record query result.
544+ */
545+ typedef struct otPlatDnssdRecordResult
546+ {
547+ const char * mFirstLabel ; ///< The first label of the name to be queried.
548+ const char * mNextLabels ; ///< The rest of the name labels. Does not include domain name. Can be NULL.
549+ uint16_t mRecordType ; ///< The record type.
550+ const uint8_t * mRecordData ; ///< The record data bytes.
551+ uint16_t mRecordDataLength ; ///< Number of bytes in record data.
552+ uint32_t mTtl ; ///< TTL in seconds. Zero TTL indicates removal the data.
553+ uint32_t mInfraIfIndex ; ///< The infrastructure network interface index.
554+ } otPlatDnssdRecordResult ;
555+
556+ /**
557+ * Represents the callback function used to report a record querier result.
558+ *
559+ * @param[in] aInstance The OpenThread instance.
560+ * @param[in] aResult The record querier result.
561+ */
562+ typedef void (* otPlatDnssdRecordCallback )(otInstance * aInstance , const otPlatDnssdRecordResult * aResult );
563+
564+ /**
565+ * Represents a record querier.
566+ */
567+ typedef struct otPlatDnssdRecordQuerier
568+ {
569+ const char * mFirstLabel ; ///< The first label of the name to be queried. MUST NOT be NULL.
570+ const char * mNextLabels ; ///< The rest of name labels, excluding domain name. Can be NULL.
571+ uint16_t mRecordType ; ///< The record type to query.
572+ uint32_t mInfraIfIndex ; ///< The infrastructure network interface index.
573+ otPlatDnssdRecordCallback mCallback ; ///< The callback to report result.
574+ } otPlatDnssdRecordQuerier ;
575+
542576/**
543577 * Starts a service browser.
544578 *
@@ -718,6 +752,46 @@ void otPlatDnssdStartIp4AddressResolver(otInstance *aInstance, const otPlatDnssd
718752 */
719753void otPlatDnssdStopIp4AddressResolver (otInstance * aInstance , const otPlatDnssdAddressResolver * aResolver );
720754
755+ /**
756+ * Starts a record querier.
757+ *
758+ * Initiates a continuous query for a given `mRecordType` as specified in @p aQuerier. The queried name is specified
759+ * by the combination of `mFirstLabel` and `mNextLabels` (optional rest of the labels) in @p aQuerier. The
760+ * `mFirstLabel` is always non-NULL but `mNextLabels` can be `NULL` if there are no other labels. The `mNextLabels
761+ * does not include the domain name. The reason for a separate first label is to allow it to include a dot `.`
762+ * character (as allowed for service instance labels).
763+ *
764+ * Discovered results should be reported through the `mCallback` function in @p aQuerier, providing the raw record
765+ * data bytes. A removed record data is indicated with a TTL value of zero. The callback may be invoked immediately
766+ * with cached information (if available) and potentially before this function returns. When cached results are used,
767+ * the reported TTL value should reflect the original TTL from the last received response.
768+ *
769+ * Multiple querier instances can be started for the same name, provided they use different callback functions.
770+ *
771+ * OpenThread will only use a record querier for types other than PTR, SRV, TXT, A, and AAAA. For those, specific
772+ * browsers or resolvers are used. The platform implementation, therefore, can choose to restrict its implementation.
773+ *
774+ * The @p aQuerier and all its contained information (strings) are only valid during this call. The platform MUST save
775+ * a copy of the information if it wants to retain the information after returning from this function.
776+ *
777+ * @param[in] aInstance The OpenThread instance.
778+ * @param[in] aQuerier The record querier to be started.
779+ */
780+ void otPlatDnssdStartRecordQuerier (otInstance * aInstance , const otPlatDnssdRecordQuerier * aQuerier );
781+
782+ /**
783+ * Stops a record querier.
784+ *
785+ * No action is performed if no matching querier with the same name, record type and callback is currently active.
786+ *
787+ * The @p aQuerier and all its contained information (strings) are only valid during this call. The platform MUST save
788+ * a copy of the information if it wants to retain the information after returning from this function.
789+ *
790+ * @param[in] aInstance The OpenThread instance.
791+ * @param[in] aQuerier The record querier to be stopped.
792+ */
793+ void otPlatDnssdStopRecordQuerier (otInstance * aInstance , const otPlatDnssdRecordQuerier * aQuerier );
794+
721795/**
722796 * @}
723797 */
0 commit comments