1 | // Copyright (c) Microsoft. All rights reserved.
|
---|
2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
---|
3 |
|
---|
4 | #ifndef AZURE_BASE32_H
|
---|
5 | #define AZURE_BASE32_H
|
---|
6 |
|
---|
7 | #ifdef __cplusplus
|
---|
8 | #include <cstddef>
|
---|
9 | #else
|
---|
10 | #include <stddef.h>
|
---|
11 | #endif
|
---|
12 |
|
---|
13 | #include "azure_c_shared_utility/strings.h"
|
---|
14 | #include "azure_c_shared_utility/buffer_.h"
|
---|
15 |
|
---|
16 | #include "umock_c/umock_c_prod.h"
|
---|
17 |
|
---|
18 | #ifdef __cplusplus
|
---|
19 | extern "C" {
|
---|
20 | #endif
|
---|
21 |
|
---|
22 | /**
|
---|
23 | * @brief Encodes the BUFFER_HANDLE to a base 32 STRING_HANDLE
|
---|
24 | *
|
---|
25 | * @param input BUFFER_HANDLE of the unsigned char* to be encoded
|
---|
26 | *
|
---|
27 | * @return A base32 encoded STRING_HANDLE that will need to be deallocated
|
---|
28 | */
|
---|
29 | MOCKABLE_FUNCTION(, STRING_HANDLE, Azure_Base32_Encode, BUFFER_HANDLE, input);
|
---|
30 |
|
---|
31 | /**
|
---|
32 | * @brief Encodes the BUFFER_HANDLE to a base 32 char*
|
---|
33 | *
|
---|
34 | * @param source An unsigned char* to be encoded
|
---|
35 | * @param size The lenght in bytes of the source variable
|
---|
36 | *
|
---|
37 | * @return A base32 encoded string that will need to be deallocated
|
---|
38 | */
|
---|
39 | MOCKABLE_FUNCTION(, char*, Azure_Base32_Encode_Bytes, const unsigned char*, source, size_t, size);
|
---|
40 |
|
---|
41 | /**
|
---|
42 | * @brief Decodes a base32 encoded STRING_HANDLE to a BUFFER_HANDLE
|
---|
43 | *
|
---|
44 | * @param handle STRING_HANDLE of a base32 encode string
|
---|
45 | *
|
---|
46 | * @return A BUFFER_HANDLE of the result of decoding the handle
|
---|
47 | */
|
---|
48 | MOCKABLE_FUNCTION(, BUFFER_HANDLE, Azure_Base32_Decode, STRING_HANDLE, handle);
|
---|
49 |
|
---|
50 | /**
|
---|
51 | * @brief Decodes a base32 encoded char* to a BUFFER_HANDLE
|
---|
52 | *
|
---|
53 | * @param source char* of a base32 encode string
|
---|
54 | *
|
---|
55 | * @return A BUFFER_HANDLE of the result of decoding the source
|
---|
56 | */
|
---|
57 | MOCKABLE_FUNCTION(, BUFFER_HANDLE, Azure_Base32_Decode_String, const char*, source);
|
---|
58 |
|
---|
59 | #ifdef __cplusplus
|
---|
60 | }
|
---|
61 | #endif
|
---|
62 |
|
---|
63 | #endif /* AZURE_BASE32_H */
|
---|