Commit Graph

1198 Commits

Author SHA1 Message Date
Zhanglong Xia fab01a7f0f [simulation] use the CSL receiver's peer address to include CSL IE (#11905)
The description of the method `otPlatRadioEnableCsl()` requires the platform
to include the CSL IE in the enhanced ACK when the received data frame's source
address matches the CSL receiver's peer address. This commit implements this
requirement in the simulation radio.
2025-09-29 18:24:38 -07:00
arnulfrupp bb5585d412 [tcat] add tcat implementations and bug fixes (#11402)
Commit adds check if commissioning is possible and if the tcat device is already commissioned.
Adds advertisement update on disconnected and role change.
Fixes key handling for key references.
Fixes the authorization processing.
Implements recent changes of the application TLVs.
2025-07-30 12:27:10 -07:00
Li Cao 6c6e99ee7c [style] upgrade clang-format and clang-tidy from 14 to 16 (#11682) 2025-07-10 18:19:26 -07:00
Zhanglong Xia 4764e6e714 [diag] deprecate otPlatDiagRadioTransmitDone() and otPlatDiagRadioReceiveDone() (#11615)
The radio platform API otPlatDiagRadioTransmitDone() and
otPlatDiagRadioReceiveDone() are the same with the API
otPlatRadioTxDone() and otPlatRadioReceiveDone(). This commit removes
the API otPlatDiagRadioTransmitDone() and otPlatDiagRadioReceiveDone()
to let the MAC layer and the diag module to use the same radio API to
send and receive 154 frames. So that the diag module could process the
ACK frame in the future.
2025-07-09 08:14:18 -07:00
Abtin Keshavarzian a495a2284b [otns] make various enhancements to Otns (#11643)
This commit contains various enhancements to the `Otns` class:

- Makes `Otns` methods non-static. This aligns their use with the
  clang-tidy `readability-static-accessed-through-instance` check,
  which disallows accessing static methods through an instance.
- Updates the `make-pretty` script to enable OTNS and include it in
  `clang-tidy` checks.
- Adds a stub implementation of `otPlatOtnsStatus()` in the simulation
  and fake platforms. This allows the OTNS feature to be enabled in
  `make-pretty` builds and covered by GitHub Action CI checks.
- Simplifies the `EmitStatus` methods to use the `String` class for
  constructing the status string.
- Adds a new helper method to construct the CoAP status string,
  removing duplicated code.
2025-06-30 14:39:30 -07:00
Abtin Keshavarzian f90d50b220 [dhcp6] implement DHCPv6 Prefix Delegation (PD) client (#11584)
This commit introduces the `Dhcp6PdClient` class, which implements
DHCPv6 Prefix Delegation (PD) client functionality. It integrates
with `BorderRouter::RoutingManager` and its `PdPrefixManager`
sub-component. The CMake `OT_BORDER_ROUTING_DHCP6_PD_CLIENT` mapped
to `OPENTHREAD_CONFIG_BORDER_ROUTING_DHCP6_PD_CLIENT_ENABLE` config
enables this feature.

Previously, the platform layer was expected to implement client
functionality, acquiring and providing the delegated prefix(es) to
the OT stack using `otPlatBorderRouter*` callbacks. This approach
continues to be supported. The `Dhcp6PdClient` feature adds native
support for this functionality in the OpenThread core.

The `Dhcp6PdClient` implementation follows RFC 8415, focusing on
prefix delegation and all required behaviors. The client follows the
standard four-message Solicit/Advertise/Request/Reply exchange to
obtain a delegated prefix, followed by a two-message Renew/Reply or
Rebind/Reply exchange to extend the lifetime of the delegated prefix.
When the prefix is no longer needed, a two-message Release/Reply
exchange ends its lease. The current client implementation does not
support the optional "Reconfigure Accept" mechanism.

A set of `otPlatInfraIfDhcp6PdClient*` platform APIs are also
introduced for use by the `Dhcp6PdClient`. These APIs are used to
enable or disable listening for DHCPv6 messages and to handle sending
and receiving them on the standard client and server UDP ports
(546 and 547), effectively acting as a UDP socket.

This commit also includes a comprehensive unit test covering various
aspects of `Dhcp6PdClient`, including common behaviors and many
specific edge cases.
2025-06-20 19:35:44 -07:00
Yakun Xu 1662ca8001 [simulation] add reliable virtual time transport (#11029)
This commit adds a reliable transport based on SEQPACKET unix socket to
simulation platform and use this for tests on simulation platform.
2025-06-04 23:32:25 -07:00
Esko Dijk 1804273276 [posix] set sin6_scope_id / ipi6_ifindex for all transmits to link-local (#11555)
This will avoid the problem that scope id or ifindex remains 0 for a
link-local transmission. If 0, the OS cannot decide which network
interface to use based on address alone.
2025-06-03 09:22:41 -07:00
Jonathan Hui 412596c990 [examples] define OPENTHREAD_FTD and OPENTHREAD_MTD (#11516) 2025-05-20 14:59:24 -07:00
Yang Song 1f54a868cf [dns] signal an error immediately when no upstream DNS server available (#11480)
Currently, if the platform has no upstream DNS server configured,
upstream DNS query will eventually time out. This can lead to delays
in responding to the DNS client.

The new otPlatDnsIsUpstreamQueryAvailable API provides a mechanism for
the platform to proactively signal the unavailability of upstream DNS.
2025-05-20 14:50:18 -07:00
Abtin Keshavarzian 20aefc2215 [dnssd] support generic record queries via discovery proxy and SRP (#11357)
This commit enhances the OpenThread DNSSD name server/resolver and its
native Discovery Proxy to support queries for arbitrary record
types.

To enable this, a new set of `otPlatDnssd` APIs are introduced for
generic `RecordQuerier`. These APIs mirror the existing APIs in the
OpenThread native mDNS module, allowing direct use of the native mDNS
implementation.

The discovery proxy implementation is updated to start and stop the
mDNS `RecordQuerier` when receiving a query for an arbitrary record
type, passing the first response record back to the client.

The unit tests `test_dnssd_discovery_proxy` and `test_dns_client`
are updated to cover all the newly added behaviors in discovery proxy.
2025-04-23 12:14:05 -07:00
Zhanglong Xia c1c5db8f20 [utils] check whether mInfo.mTxInfo.mIeInfo is null before using it (#11238)
The simulation platform radio driver doesn't set the 'mInfo.mTxInfo.mIeInfo'
field of the ACK frame. And the function 'otMacFrameUpdateTimeIe()' directly
use the 'mInfo.mTxInfo.mIeInfo' field, this may cause the program crash.

This commit checks whether 'mInfo.mTxInfo.mIeInfo' is null before using it
and sets the 'mInfo.mTxInfo.mIeInfo' field of the ACK frame to null in
simulation platform.
2025-02-12 10:24:34 -08:00
Abtin Keshavarzian d1147d62b9 [trel] detect and handle socket addr discrepancy for TREL peers (#10869)
This commit introduces a new mechanism for the TREL link to detect and
handle discrepancies between the IPv6 address and port used by a TREL
peer in a received TREL packet, and the information previously
reported by the platform layer (through DNS-SD discovery) for the
same peer.

Ideally, the platform underlying DNS-SD should detect changes to
advertised ports and addresses by peers. However, there are
situations where this is not detected reliably.

As a received frame over the TREL radio link is processed by the MAC
or MLE layers, if the frame passes receive security checks at either
layer (indicating it is a secure and authenticated/fresh frame from a
valid neighbor), the TREL peer socket address is automatically
updated from the received TREL packet info. This ensures the TREL
peer table is updated correctly if there are changes to TREL peer
addresses of valid Thread neighbors upon rx from such neighbor,
increasing the robustness of the TREL link.

This commit also introduces a new `otPlatTrel` platform API,
`otPlatTrelNotifyPeerSocketAddressDifference()`. The TREL
implementation now notifies the platform layer whenever it detects a
discrepancy in a TREL peer's socket address, regardless of whether
the peer table is automatically updated. This allows the platform
layer to take any appropriate action, such as restarting or
confirming DNS-SD service resolution query for the peer service
instance and/or address resolution query for its associated host
name.

This commit also adds a new test that validates the newly added
behavior, including the auto-update of peer table information and
notification of the platform through the new API, triggered by either
MLE or MAC messages over the TREL radio link.
2024-12-18 20:35:58 -08:00
Zhanglong Xia ea7676cd54 [mac_frame] process the key id mode 2 only when the wakeup coordinator is enabled (#11047)
The wakeup frame is sent from the wakeup coordinator rather than the
wakeup end device.  Current code processes the key id mode 2 only when
the device is the wakeup end device.  This commit corrects this issue.
2024-12-13 07:21:22 -08:00
Zhanglong Xia 9fefeedb0d [mac-frame] process the security of the wakeup frame (#11003)
If the radio driver supports the `OT_RADIO_CAPS_TRANSMIT_SEC`, the
radio driver should process the security of the send frame. But the
current method `otMacFrameProcessTransmitSecurity()` doesn't process
the security of the wakeup frame. Which causes sent wakeup frame is not
encrypted.

This commit enables the method `otMacFrameProcessTransmitSecurity()`
to process the security of the wakeup frame.
2024-12-12 15:32:41 -08:00
Abtin Keshavarzian d43cb0d1ea [csl] introduce CslNeighbor class (#10956)
This commit introduces `CslNeighbor`, a subclass of `Neighbor` that
also inherits from `IndirectSender::NeighborInfo` and
`CslTxScheduler::NeighborInfo` to manage indirect transmission and
CSL-specific information.

The `Child` class now inherits from `CslNeighbor`, inheriting all CSL
functionalities while adding extra child-specific information. The
newly added `CslNeighbor` allows extending CSL functionality to
devices in other roles, not just `Child` devices.

The `CslTxScheduler` class is updated to use `CslNeighbor` as well
(instead of `Child`), making it more general-purpose.

`IndirectSender`, its sub-components, and `Mac` are updated to enable
CSL on MTD builds when `OPENTHREAD_CONFIG_MAC_CSL_TRANSMITTER_ENABLE`
is enabled.

This restructuring provides a more flexible and scalable framework for
implementing enhanced CSL functionality on new device types.
2024-11-26 10:58:25 -08:00
Zhanglong Xia c44538e4df [simulation] enable the platform assert (#10952)
When the ot-rcp enters the assert state, the host crashes and exits.
But the ot-rcp still runs in the dead loop and becomes an orphan
process.

This commit enables the platform assert so that the ot-rcp can
automatically exit when entering the assert state.
2024-11-22 16:48:51 -08:00
Zhanglong Xia 7f6723ffb3 [log] add build option OT_LOG_MAX_SIZE to set the max log string size (#10948) 2024-11-20 20:06:35 -08:00
Zhanglong Xia 51169ac032 [simulation] log the exit code when the program exits (#10936)
Sometimes `ot-rcp` will exit without any exit information in the
log. It is hard for developers to know what happens on the `ot-rcp`
side when the `ot-rcp` exits abnormally. This commit calls functions
defined in `lib/platform/exit_code.h` to exit the program and log the
exit information.
2024-11-20 07:22:47 -08:00
Abtin Keshavarzian 444d1dd6bc [mle] implement alternate RLOC16 usage during role transition (#10006)
This commit introduces a mechanism for a device transitioning from
child to router role to keep receiving frames addressed to its
previous short address for a brief period.

A new radio platform API, `otPlatRadioSetAlternateShortAddress()`, is
introduced. This allows the OT stack to configure an alternate short
address. Radio platform support for this function is indicated by the
`OT_RADIO_CAPS_ALT_SHORT_ADDR` capability in `otPlatRadioGetCaps()`
The same function can be used with `OT_RADIO_INVALID_SHORT_ADDR`
(`0xfffe`) to clear a previously set alternate short address. Support
for the new API is implemented in RCP and `RadioSpinel`, ensuring
backward compatibility by dynamically checking supported radio
capabilities.

MLE code is updated to instruct the radio to use the old child RLOC16
as an alternate address upon role transition. The MLE layer will
automatically clear the alternate address after eight seconds, or if
other state/mode changes occur. This eight-second window ensures the
new router can transmit four MLE Advertisement messages.
2024-10-30 16:38:10 -07:00
Li Cao 74cdd26085 [ncp] add empty implementation for dnssd platform APIs (#10877)
This commit adds empty implementation for a NCP based version of
otPlatDnssd APIs.

Like NCP version of otPlatInfraIf APIs, this commit adds a control
option to enable/disable the simulation platform version of
otPlatDnssd APIs to avoid conflict. By default, the simulation version
of implementation will still be turned on.
2024-10-30 13:10:30 -07:00
Thomas 5bd9de5f30 [examples] remove unneeded implementation otTaskletsSignalPending (#10849)
The implementation of `otTaskletsSignalPending` in
`examples/apps/<app>/main.c` is exactly the same as the weak
implementation in `tasklet_api.cpp`. No need to repeat it and blocking
other implementations of that function.
2024-10-21 13:51:19 +01:00
Yakun Xu 2ea0155129 [radio] fix ACK frame counter with previous key (#10816)
This commit tracks the frame counter used for the previous key index and
use it for the ACK frame to a frame still using previous key index.
2024-10-11 08:24:51 -07:00
Jonathan Hui c182933979 [doxygen] remove empty line at end of block (#10748) 2024-09-24 09:51:34 -07:00
Abtin Keshavarzian 4a57dd8e09 [include] fix #include style for public OT headers (#10710)
This commit updates `#include` of public OT headers to follow
the OT style guide and use brace (`<`) and (`>`) style.
2024-09-17 12:13:34 -07:00
Yakun Xu d0f7699110 [radio] add tx timestamp (#10688)
This commit adds tx timestamp so that the pcap callback can get the time
when a frame was transmitted.
2024-09-16 10:13:25 -07:00
Yakun Xu dccc5193af [radio] add a helper of SFD handler (#10670)
This commit adds a helper of SFD handler to deal with IEs and security
needs to be processed in SFD handler from ISR.
2024-09-12 23:02:07 -07:00
Yakun Xu c0690e78fc [build] set default Thread version to 1.4 (#10690)
This commit updates the default Thread version to 1.4, so that most
latest features will be enabled by default. This commit also explicitly
enable the epskc feature just like other features in the build script.
2024-09-10 13:39:38 -07:00
Li Cao c36c0ed760 [ncp] add NCP based implementation (empty) of platform InfraIf APIs (#10638)
This implementation will be used on all platforms for NCP nodes
(simulation, any vendor platforms). However the simulation platform
already has a different implementation. To avoid conflicts, the commit
adds a control flag in simulation config so that we can choose whether
to enable the simulation implementation.
2024-09-04 07:48:59 -07:00
Yakun Xu 2493658d6a [config] disable uptime logging when multi-instance enabled (#10659)
This commit soften enabling log uptime in simulation and posix platform
so that it won't be enabled when multiple instance is also enabled.
2024-09-03 13:05:58 -07:00
Yakun Xu 3c6b8a3dd2 [time] unify macros for time unit conversion (#10636)
This commit unifies macros used for time unit conversion so that we
don't need to define it on different components.
2024-08-26 20:26:31 -07:00
Yakun Xu e219fe92f1 [mac] support frames without sequence number (#10544)
This commit adds the capability to support frames without sequence
number.
2024-08-02 09:50:45 -07:00
Zhanglong Xia 215c23f2a6 [diag] add diag output callback (#10354)
The length of diag output messages is limited by the diag buffer size.
Developers have to change the diag buffer size to allow diag module to
output long messages. If diag output messages become longer and
longer, developers have to keep changing the diag buffer size.

This commit adds an output callback to diag module to output diag
messages.  Then the length of diag output messages won't be limited by
the diag buffer size.
2024-06-19 20:27:35 -07:00
Li Cao fc0646c6eb [simulation] fix tiny issue of infra if (#10402) 2024-06-18 10:38:59 -07:00
Abtin Keshavarzian cb1220d79b [cli] fix unused retval warning on otPlatLogCrashDump() call (#10369) 2024-06-12 17:50:48 -07:00
Abtin Keshavarzian 5dbbab175b [dnssd-server] implement DNS-SD discovery proxy functionality in core (#10050)
This commit implements a generic discovery proxy in the DNS-SD server.
It uses a set of newly added `otPlatDnssd` platform DNS-SD(mDNS) APIs
to start or stop browsers, SRV/TXT resolvers, and IPv6/IPv4 address
resolvers. These APIs closely match the native OpenThread mDNS
implementation.

OpenThread DNS-SD's existing `QueryCallback` mechanism, enabling
customized discovery proxy implementations, remains supported.

This commit includes a comprehensive unit test. This test validates
the discovery proxy's behavior, covering: standard use cases, request
timeout, s hared resolver/browser usage for multiple queries with the
same name, filtering of invalid addresses, and various edge cases.
2024-06-10 12:16:24 -07:00
Przemysław Bida 398df8c408 [tcat] implement tcat advertisement (#9858)
Commit introduces implementation of TCAT advertisement over BLE
compliant with Thread 1.3.1 specification.
2024-06-06 11:26:59 -07:00
Ashish bef804c6be [utils] add API to reset/clear linked list of enh-ack link metrics (#10294)
Enh-ack link metrics required to reset/clear when radio(RCP) is reset to
clear existing data. To support it, added API to reset/clear linked list
of enh-ack link metrics.

Signed-off-by: Ashishkumar Vara <ashish.vara@nxp.com>
2024-05-30 11:21:35 -07:00
Yakun Xu f97a01c40d [simulation] rename local host to local interface (#10241)
This commit renames command line argument --local-host to
--local-interface to reduce confusion as discussed in #10194.

This commit also add help message for local interface.
2024-05-15 11:04:37 -07:00
Yakun Xu 39ce8117a5 [simulation] support simulating radio over IPv6 (#10194)
This commit adds support to simulate Thread radio over IPv6.

With this commit, a simulation will be simulated over either IPv6 or IPv4.
If it's simulated on IPv6, it communicates with other simulation nodes
in IPv6 group `ff02::116`. And if it's simulated on IPv4, it communicates
with other simulation nodes in IPv4 group `224.0.0.116`.

Note that simulating virtual time is not included in this commit.
2024-05-13 09:27:54 -07:00
Abtin Keshavarzian b8f036a570 [simulation] remove example log lines from otPlatLogCrashDump() (#10137)
This commit removes the `LogCrit` example lines emitted from
`otPlatLogCrashDump()` in simulation platform. These extra log
lines can cause test failures.
2024-05-02 12:02:10 -07:00
Mason Tran 502797c0b3 [spinel] add support for logging crash dumps (#10061)
This commit adds a new feature that allows platforms to log crash logs.

### Additions
- `void otPlatLogCrashDump(void)` - API that logs a crash dump using
  OpenThread Logging APIs
- `SPINEL_PROP_RCP_LOG_CRASH_DUMP` - spinel prop that calls
  `otPlatLogCrashDump()` when `Set`
- `SPINEL_CAP_RCP_LOG_CRASH_DUMP` - spinel capability denoting that a
  RCP supports logging crash dumps

### Usage
- For `ot-cli-ftd|mtd`, `otPlatLogCrashDump()` is called at the end of
  app initialization, before the main loop. See [main.c]
- For Host/RCP setups, during initialization, the Host gets the RCP
  capabilities. If the RCP has the `SPINEL_CAP_RCP_LOG_CRASH_DUMP`
  capability, the Host will `Set` the `SPINEL_PROP_RCP_LOG_CRASH_DUMP`
  property, triggering the RCP to call `otPlatLogCrashDump()`.
  - If RCP Recovery is enabled, the this will also happen once the RCP
    has been restored
2024-04-29 09:09:54 -07:00
Abtin Keshavarzian bf41332061 [mdns] add native mDNS support in OT (#9797)
This commit introduces native mDNS support within the OpenThread
stack, implementing RFC 6762 compliant registration of hosts,
services, and keys. It supports the following functionalities:

- Sending probes to claim names.
- Sending announcements on initial registration and changes.
- Sending "goodbye" announcements when unregistered or upon record
  removal.
- Negative responses (NSEC).
- Support for service sub-types and their addition/removal.
- Support for `_services._dns-sd._udp` queries (all service types).
- Responding to queries (including "QU" questions).
- Delay mechanism when responding to multi-question query messages,
  ensuring unique answers.
- Providing extra records in the Additional Data section if not
  already in the Answer section (e.g., on a PTR query, include SRV
  and host AAAA addresses).
- Implementing Known-Answer Suppression.
- Supporting multi-packet queries with known answers in follow-up
  messages.
- Rate-limiting record multicasts (once per second).
- Rate-limiting probe responses (once per 250ms).
- Detecting conflicts after probes.
- Limiting the size of emitted responses or probes, breaking into
  multiple messages if necessary.
- Detecting self originating messages (sent by mDNS module).
- Support for service browser.
- Support for service resolvers (SRV and TXT records) and IPv4/IPv6
  address resolvers for hostnames.
- Introduces smart cache management:
  - Passively caches service records for active browsers.
  - Passively caches address records for active service resolvers.
- Enables multiple simultaneous browsers/resolvers for the same
  service/host.

This commit introduces public `otMdns` OpenThread APIs and related CLI
commands for the mDNS module.

For platform abstraction, `otPlatMdns` APIs are defined in
`mdns_socket.h` (e.g., to send or receive mDNS messages):

- An implementation of the platform APIs is provided for posix.
- Also under the simulation platform, a simplified implementation of the
  `otPlatMdns` APIs is provided (intended for testing).

This commit also adds a detailed `test_mdns` unit test, validating
various functionalities and covering potential edge cases.
2024-04-09 08:32:01 -07:00
Abtin Keshavarzian b146766e3a [plat-utils] enhance otMacFrameDoesAddrMatch() (#9997)
This commit updates `otMacFrameDoesAddrMatch()` to ensure it
does not match if frame is malformed (`Frame::GetDstAddr()`
fails).
2024-04-05 11:18:41 -07:00
Przemysław Bida 3ae275f1ac [simulation] add simulation tests framework for tcat (#9724)
This commit adds simulation framework for tcat based on posix udp
sockets.
2024-03-22 10:30:59 -07:00
Yakun Xu 3ebc3d3a06 [simulation] allow specify local host (#9925)
This commit adds a argument `-L`/`--local-host` to simulation platform
to specify the source IP address for packets simulating 15.4
frames. This allows the simulation packets being transmitted over
different network interfaces, so that the simulation can run on
different hosts.

This can be used to enable multiple emulation devices(e.g. Android
Virtual Device) communicating to each other over emulated Thread
radio.

The argument accepts either an IPv4 address or a network interface
name. In the latter case, the first found IPv4 address on that
interface will be used will be used.
2024-03-13 11:42:53 -07:00
Abtin Keshavarzian 39fcc5ea53 [simulation] implement otPlatInfraIf APIs in simulation platform (#9895)
This commit implements a subset of `otPlatInfraIf` platform APIs in
simulation platforms using the `utilsSocket` to emulate communication
between BRs. This can be used for testing.

This commit also adds one (simple) example test case with two BRs
attached to two different network on same infra-if.
2024-03-06 13:26:06 -08:00
Abtin Keshavarzian 44c39060cd [border-agent] mechanism to use ephemeral key (#9435)
This commit adds a new mechanism in `BorderAgent` to allow the use of
ephemeral key. New `otBorderAgentSetEphemeralKey` API is added to
allow user to set an ephemeral key. The ephemeral key is used
instead of PSKc from Operation Dataset for a given timeout duration.
New API `otBorderAgentClearEphemeralKey` allows users to cancel the
ephemeral key before its timeout expires. While the timeout interval
is in effect, the ephemeral key can be used only once by an external
commissioner to connect. Once the commissioner disconnects, the
ephemeral key is cleared, and Border Agent reverts to using PSKc.

This commit adds a callback mechanism to signal changes related to the
Border Agent's (BA) use of an ephemeral key. It is invoked when the
BA starts/stops using the key, or when parameters (e.g., port number)
change.

This commit also adds CLI command under `ba ephemeralkey` for the new
APIs along with test script validating the new APIs.
2024-03-05 13:53:31 -08:00
Abtin Keshavarzian 5960215508 [simulation] add simul_utils.h for socket operation helpers (#9879)
This commit introduces a new module, `simul_utils.h`, under
`simulation` platform. This module provides common utility functions,
primarily related to socket operations (for emulation of radio or
TREL interface). The new functions are used by `radio.c` and
`trel.c`, consolidating code and preventing repetition.
2024-02-28 11:28:00 -08:00
Abtin Keshavarzian b212a0a748 [srp] implement AdvertisingProxy and define Dnssd platform APIs (#9268)
This commit adds a generic SRP Advertising Proxy implementation to
OpenThread core, which uses a set of newly defined `otPlatDnssd`
platform APIs for DNS-SD (mDNS) support on infrastructure network on
a Border Router.

`Srp::Server` provides `ServiceUpdateHandler` callback mechanism that
allows platforms to implement their own advertising proxy function.
While this is still supported, the new generic advertising proxy
implementation makes it easier to port and support the proxy function
on new platforms. The platform needs to provide the DNS-SD platform
APIs, which are designed to be simple and easy to implement.

The `AdvertisingProxy` directly interacts with `Srp::Server` and its
registered `Host` and `Service` entries, tracking whether an entry
has been successfully advertised, is currently being advertised, or
has been replaced by a new registration.

The `AdvertisingProxy` ensures that consecutive SRP updates for the
same host or service are committed on the server in the order they
are received, even if their advertisements are finished in a
different order. This is important for SRP Replication support, as
the server may receive a large number of SRP updates back-to-back for
the same host.

The `AdvertisingProxy` will also register key records for SRP host and
service instance names. This will keep the claim on the name of a
removed entry while its key lease is not expired. It is also used
when an SRP host registration has no off-mesh routable address.

This commit adds a detailed unit test `test_srp_adv_proxy` that
validates the `AdvertisingProxy` under many scenarios. The test
covers a range of cases, including delayed registration callbacks and
timeouts, new registrations replacing outstanding advertisements,
platform DNS-SD state changes and failures, host address changes
adding/removing OMR addresses.
2024-02-09 10:43:47 -08:00