1 /* 2 * Copyright (c) 2025 Nordic Semiconductor ASA 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #ifndef ZEPHYR_MODULES_OPENTHREAD_OPENTHREAD_UTILS_H_ 8 #define ZEPHYR_MODULES_OPENTHREAD_OPENTHREAD_UTILS_H_ 9 10 #include <stdint.h> 11 12 #ifdef __cplusplus 13 extern "C" { 14 #endif 15 16 /** 17 * @brief Convert a string representation of bytes into a buffer. 18 * 19 * This function parses a string containing hexadecimal byte values and fills 20 * the provided buffer with the corresponding bytes. The string may contain 21 * optional delimiters (such as spaces or colons) between byte values. 22 * 23 * @param buf Pointer to the buffer where the parsed bytes will be stored. 24 * @param buf_len Length of the buffer in bytes. 25 * @param src Null-terminated string containing the hexadecimal byte values. 26 * 27 * @return 0 on success, or a negative value on error. 28 */ 29 int bytes_from_str(uint8_t *buf, int buf_len, const char *src); 30 31 #ifdef __cplusplus 32 } 33 #endif 34 35 #endif /* ZEPHYR_MODULES_OPENTHREAD_OPENTHREAD_UTILS_H_ */ 36