1 /*
2  * Copyright (C) 2015-2018 Alibaba Group Holding Limited
3  */
4 
5 #ifndef __AWSS_UTILS_H__
6 #define __AWSS_UTILS_H__
7 
8 #if defined(__cplusplus) /* If this is a C++ compiler, use C linkage */
9 extern "C" {
10 #endif
11 
12 #include "os.h"
13 #include "linkkit/infra/infra_string.h"
14 
15 /**
16  * @brief string to hex
17  *
18  * @param[in] str: input hex string
19  * @param[in] str_len: length of input hex string
20  * @param[out] out: output hex byte stream
21  * @param[in/out] output_len: [in] for output buffer size, [out] for
22  *                 output hex byte len
23  * @Note None.
24  *
25  * @retval return num of hex bytes converted, 0 means error.
26  */
27 #define utils_str_to_hex LITE_hexstr_convert
28 
29 /**
30  * @brief hex to string
31  *
32  * @param[in] buf: input hex byte stream
33  * @param[in] buf_len: input stream length in byte
34  * @param[out] str: encoded hex string
35  * @param[in/out] str_len: [in] for str buffer size, [out] for
36  *                  encoded string length
37  * @Note output str buffer is NULL-terminated(if str_buf_len is longer enough)
38  *
39  * @retval return length of str converted, 0 means error.
40  */
41 #define utils_hex_to_str(buf, buf_len, str, str_buf_len) \
42     LITE_hexbuf_convert(buf, str, buf_len, 1)
43 
44 #if defined(__cplusplus) /* If this is a C++ compiler, use C linkage */
45 }
46 #endif
47 
48 #endif
49