|
35 | 35 | #ifndef OPENTHREAD_BORDER_AGENT_H_ |
36 | 36 | #define OPENTHREAD_BORDER_AGENT_H_ |
37 | 37 |
|
| 38 | +#include <openthread/dns.h> |
38 | 39 | #include <openthread/instance.h> |
39 | 40 | #include <openthread/ip6.h> |
40 | 41 |
|
@@ -242,6 +243,41 @@ void otBorderAgentSetMeshCoPServiceChangedCallback(otInstance |
242 | 243 | */ |
243 | 244 | otError otBorderAgentGetMeshCoPServiceTxtData(otInstance *aInstance, otBorderAgentMeshCoPServiceTxtData *aTxtData); |
244 | 245 |
|
| 246 | +/** |
| 247 | + * Maximum string length of base name used in `otBorderAgentSetMeshCoPServiceBaseName()`. |
| 248 | + * |
| 249 | + * The full DNS label is constructed by appending the Extended Address of the device (as 16-character hex digits) to |
| 250 | + * the given base name. |
| 251 | + */ |
| 252 | +#define OT_BORDER_AGENT_MESHCOP_SERVICE_BASE_NAME_MAX_LENGTH (OT_DNS_MAX_LABEL_SIZE - 17) |
| 253 | + |
| 254 | +/** |
| 255 | + * Sets the base name to construct the service instance name used when advertising the mDNS `_meshcop._udp` service by |
| 256 | + * the Border Agent. |
| 257 | + * |
| 258 | + * Requires the `OPENTHREAD_CONFIG_BORDER_AGENT_MESHCOP_SERVICE_ENABLE` feature. |
| 259 | + * |
| 260 | + * The name can also be configured using the `OPENTHREAD_CONFIG_BORDER_AGENT_MESHCOP_SERVICE_BASE_NAME` configuration |
| 261 | + * option (which is the recommended way to specify this name). This API is provided for projects where the name needs |
| 262 | + * to be set after device initialization and at run-time. |
| 263 | + * |
| 264 | + * Per the Thread specification, the service instance should be a user-friendly name identifying the device model or |
| 265 | + * product. A recommended format is "<VendorName> <ProductName>". |
| 266 | + * |
| 267 | + * To construct the full name and ensure name uniqueness, the OpenThread Border Agent module will append the Extended |
| 268 | + * Address of the device (as 16-character hex digits) to the given base name. |
| 269 | + * |
| 270 | + * Note that the same name will be used for the ephemeral key service `_meshcop-e._udp` when the ephemeral key feature |
| 271 | + * is enabled and used. |
| 272 | + * |
| 273 | + * @param[in] aInstance The OpenThread instance. |
| 274 | + * @param[in] aBaseName The base name to use (MUST not be NULL). |
| 275 | + * |
| 276 | + * @retval OT_ERROR_NONE The name was set successfully. |
| 277 | + * @retval OT_ERROR_INVALID_ARGS The name is too long or invalid. |
| 278 | + */ |
| 279 | +otError otBorderAgentSetMeshCoPServiceBaseName(otInstance *aInstance, const char *aBaseName); |
| 280 | + |
245 | 281 | /** |
246 | 282 | * Gets the randomly generated Border Agent ID. |
247 | 283 | * |
|
0 commit comments