pub unsafe extern "C" fn otSrpServerEnableFastStartMode(
aInstance: *mut otInstance,
) -> otError
Expand description
Enables the “Fast Start Mode” on the SRP server.
Requires the OPENTHREAD_CONFIG_SRP_SERVER_FAST_START_MODE_ENABLE
feature to be enabled.
The Fast Start Mode is designed for scenarios where a device, often a mobile device, needs to act as a provisional SRP server (e.g., functioning as a temporary Border Router). The SRP server function is enabled only if no other Border Routers (BRs) are already providing the SRP service within the Thread network. A common use case is a mobile device joining a Thread network where it may be the first, or only, BR. Importantly, Fast Start Mode allows the device to quickly start its SRP server functionality upon joining the network, allowing other Thread devices to quickly connect and register their services without the typical delays associated with standard Border Router initialization (and SRP server startup).
When Fast Start Mode is enabled, the SRP server manages when to start or stop based on the presence of other BRs, following this process:
- Upon initial attachment to the Thread network, the device immediately inspects the received Network Data for any
existing “SRP/DNS” entries. These entries indicate the presence of other active BRs providing SRP server service:
- If no “SRP/DNS” entries from other BRs are found, the device immediately enables its own SRP server. This
activation uses
OT_SRP_SERVER_ADDRESS_MODE_UNICAST_FORCE_ADD
, which bypasses the usual delay associated with the standard Network Data publisher, directly adding its own “SRP/DNS unicast” entry to the Network Data. - If “SRP/DNS” entries from other BRs are detected, the device will not enable its SRP server, deferring to the existing ones.
- If no “SRP/DNS” entries from other BRs are found, the device immediately enables its own SRP server. This
activation uses
- After starting its SRP server in Fast Start Mode, the device continuously monitors the Network Data. If, at any point, new “SRP/DNS” entries appear (indicating that another BR has become active), the device automatically disables its own SRP server functionality, relinquishing the role to the newly available BR.
The Fast Start Mode can be enabled when the device is in the detached or disabled state, the SRP server is currently
disabled, and “auto-enable mode” is not in use (i.e., otSrpServerIsAutoEnableMode()
returns false
).
After successfully enabling Fast Start Mode, it can be disabled either by a call to otSrpServerSetEnabled()
,
explicitly enabling or disabling the SRP server, or by a call to otSrpServerSetAutoEnableMode()
, enabling or
disabling the auto-enable mode. If the Fast Start Mode (while active) enables the SRP server, upon disabling
Fast Start Mode (regardless of how it is done), the SRP server will also be stopped, and the use of the
OT_SRP_SERVER_ADDRESS_MODE_UNICAST_FORCE_ADD
address mode will be stopped, and the address mode will be
automatically reverted back to its previous setting before Fast Start Mode was enabled.
@param[in] aInstance A pointer to the OpenThread instance.
@retval OT_ERROR_NONE Fast Start Mode was successfully enabled. @retval OT_ERROR_INVALID_STATE Cannot enable Fast Start Mode (e.g., already attached or server already enabled).