BSL v0.0.0 - 0.geda3e66
AMMOS Bundle Protocol Security Library (BSL)
|
This file contains definitions for text CODEC functions. More...
#include <m-string.h>
#include <m-bstring.h>
#include <stdint.h>
Functions | |
int | mock_bpa_uri_percent_encode (m_string_t out, const m_string_t in, const char *safe) |
Encode to URI percent-encoding text form. | |
int | mock_bpa_uri_percent_decode (m_string_t out, const m_string_t in) |
Decode from URI percent-encoding text form. | |
int | mock_bpa_slash_escape (m_string_t out, const m_string_t in, const char quote) |
Escape backslashes in tstr or bstr text form. | |
int | mock_bpa_slash_unescape (m_string_t out, const m_string_t in) |
Unescape backslashes in tstr/bstr text form. | |
void | mock_bpa_strip_space (m_string_t out, const char *in, size_t in_len) |
Remove whitespace characters from a text string. | |
void | mock_bpa_string_tolower (m_string_t out) |
Convert a text string to lowercase. | |
void | mock_bpa_string_toupper (m_string_t out) |
Convert a text string to uppercase. | |
int | mock_bpa_base16_encode (m_string_t out, const m_bstring_t in, bool uppercase) |
Encode to base16 text form. | |
int | mock_bpa_base16_decode (m_bstring_t out, const m_string_t in) |
Decode base16 text form. | |
int | mock_bpa_base64_encode (m_string_t out, const m_bstring_t in, bool useurl, bool usepad) |
Encode base64 and base64url text forms. | |
int | mock_bpa_base64_decode (m_bstring_t out, const m_string_t in) |
Decode base64 and base64url text forms. | |
This file contains definitions for text CODEC functions.
int mock_bpa_base16_decode | ( | m_bstring_t | out, |
const m_string_t | in | ||
) |
Decode base16 text form.
This is defined in Section 8 of RFC 4648 [14].
[out] | out | The output buffer, which will be sized to its data. |
[in] | in | The input buffer to read, which must be null terminated. Whitespace in the input must have already been removed with strip_space(). |
References CHKERR1.
int mock_bpa_base16_encode | ( | m_string_t | out, |
const m_bstring_t | in, | ||
bool | uppercase | ||
) |
Encode to base16 text form.
This is defined in Section 8 of RFC 4648 [14].
[out] | out | The output buffer, which will be appended to. |
[in] | in | The input buffer to read. |
uppercase | True to use upper-case letters, false to use lower-case. |
int mock_bpa_base64_decode | ( | m_bstring_t | out, |
const m_string_t | in | ||
) |
Decode base64 and base64url text forms.
These is defined in Section 4 and 5 of RFC 4648 [14].
[out] | out | The output buffer, which will be sized to its data. |
[in] | in | The input buffer to read, which must be null terminated. Whitespace in the input must have already been removed with strip_space(). |
References CHKERR1.
int mock_bpa_base64_encode | ( | m_string_t | out, |
const m_bstring_t | in, | ||
bool | useurl, | ||
bool | usepad | ||
) |
Encode base64 and base64url text forms.
These is defined in Section 4 and 5 of RFC 4648 [14].
[out] | out | The output buffer, which will be appended to. |
[in] | in | The input buffer to read. |
useurl | True to use the base64url alphabet, false to use the base64 alphabet. | |
usepad | True to include padding characters (=), false to not use padding. |
int mock_bpa_slash_escape | ( | m_string_t | out, |
const m_string_t | in, | ||
const char | quote | ||
) |
Escape backslashes in tstr or bstr text form.
This is defined in Section G.2 of RFC 8610 [2] and Section 7 of RFC 8259 [5].
[out] | out | The output buffer, which will be appended to. |
in | The input buffer to read, which must be null terminated. | |
quote | The character used to quote the string. |
References CHKERR1.
int mock_bpa_slash_unescape | ( | m_string_t | out, |
const m_string_t | in | ||
) |
void mock_bpa_string_tolower | ( | m_string_t | out | ) |
Convert a text string to lowercase.
This is written to work on byte strings, not unicode.
[out] | out | The output buffer, which will be replaced. |
References CHKVOID.
void mock_bpa_string_toupper | ( | m_string_t | out | ) |
Convert a text string to uppercase.
This is written to work on byte strings, not unicode.
[out] | out | The output buffer, which will be replaced. |
References CHKVOID.
void mock_bpa_strip_space | ( | m_string_t | out, |
const char * | in, | ||
size_t | in_len | ||
) |
Remove whitespace characters from a text string.
This is based on isspace() inspection.
[out] | out | The output buffer, which will be replaced. |
[in] | in | The input text to read. |
in_len | The length of text not including null terminator. |
int mock_bpa_uri_percent_decode | ( | m_string_t | out, |
const m_string_t | in | ||
) |
int mock_bpa_uri_percent_encode | ( | m_string_t | out, |
const m_string_t | in, | ||
const char * | safe | ||
) |
Encode to URI percent-encoding text form.
This is defined in Section 2.1 of RFC 3986 [1]. The set of unreserved characters are alpha, digits, and _.-~ characters. in accordance with Section 2.3 of RFC 3986 [1].
[out] | out | The output buffer, which will be appended to. |
in | The input encoded text which is null-terminated. | |
safe | A set of additional safe characters to not be encoded, which is null-terminated. |
References CHKERR1.