zephyr/modules/openthread/include/openthread_utils.h
Arkadiusz Balys 1dbe7fa2b8 openthread: Fix OpenThread independence from Zephyr network.
If CONFIG_OPENTHREAD_SYS_INIT is enabled, OpenThread initialisation
should also consider running OpenThread automatically if
CONFIG_OPENTHREAD_MANUAL_START is disabled.

Removed also dependency on the `net_bytes_from_str` functions from
the openthread.h file. Now, in the OpenThread module, there is an
additional `openthread_utils.c/.h` file that can implement useful
utilities for the OpenThread platform. Currently, it implements
the `bytes_from_str` function to use it instead of
`net_bytes_from_str`.

Signed-off-by: Arkadiusz Balys <arkadiusz.balys@nordicsemi.no>
2025-06-03 14:48:56 +01:00

36 lines
995 B
C

/*
* Copyright (c) 2025 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef ZEPHYR_MODULES_OPENTHREAD_OPENTHREAD_UTILS_H_
#define ZEPHYR_MODULES_OPENTHREAD_OPENTHREAD_UTILS_H_
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Convert a string representation of bytes into a buffer.
*
* This function parses a string containing hexadecimal byte values and fills
* the provided buffer with the corresponding bytes. The string may contain
* optional delimiters (such as spaces or colons) between byte values.
*
* @param buf Pointer to the buffer where the parsed bytes will be stored.
* @param buf_len Length of the buffer in bytes.
* @param src Null-terminated string containing the hexadecimal byte values.
*
* @return 0 on success, or a negative value on error.
*/
int bytes_from_str(uint8_t *buf, int buf_len, const char *src);
#ifdef __cplusplus
}
#endif
#endif /* ZEPHYR_MODULES_OPENTHREAD_OPENTHREAD_UTILS_H_ */