RTEMS 6.1-rc2
Loading...
Searching...
No Matches
base64.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-2-Clause */
2
12/*
13 * Copyright (C) 2020, 2024 embedded brains GmbH & Co. KG
14 *
15 * Redistribution and use in source and binary forms, with or without
16 * modification, are permitted provided that the following conditions
17 * are met:
18 * 1. Redistributions of source code must retain the above copyright
19 * notice, this list of conditions and the following disclaimer.
20 * 2. Redistributions in binary form must reproduce the above copyright
21 * notice, this list of conditions and the following disclaimer in the
22 * documentation and/or other materials provided with the distribution.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
28 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 * POSSIBILITY OF SUCH DAMAGE.
35 */
36
37#ifndef _RTEMS_BASE64_H
38#define _RTEMS_BASE64_H
39
40#include <rtems/dev/io.h>
41
42#ifdef __cplusplus
43extern "C" {
44#endif /* __cplusplus */
45
60extern const uint8_t _Base64_Encoding[ 64 ];
61
65extern const uint8_t _Base64url_Encoding[ 64 ];
66
90 IO_Put_char put_char,
91 void *arg,
92 const void *src,
93 size_t len,
94 const char *wordbreak,
95 int wordlen
96);
97
121 IO_Put_char put_char,
122 void *arg,
123 const void *src,
124 size_t len,
125 const char *wordbreak,
126 int wordlen
127);
128
132typedef enum {
133 BASE64_DECODE_STATE_0,
134 BASE64_DECODE_STATE_1,
135 BASE64_DECODE_STATE_2,
136 BASE64_DECODE_STATE_3
138
142typedef struct {
144 uint8_t *target;
145 const uint8_t *target_end;
147
152extern const uint8_t _Base64_Decoding[ 128 ];
153
165 uint8_t *target,
166 size_t target_size
167);
168
172typedef enum {
173 BASE64_DECODE_SUCCESS,
174 BASE64_DECODE_OVERFLOW,
175 BASE64_DECODE_INVALID_INPUT
177
189 char ch
190);
191
194#ifdef __cplusplus
195}
196#endif /* __cplusplus */
197
198#endif /* _RTEMS_BASE64_H */
This header file provides the interfaces of the Device I/O Support.
void(* IO_Put_char)(int c, void *arg)
This type defines the put character handler.
Definition: io.h:65
void _Base64_Decode_initialize(Base64_Decode_control *self, uint8_t *target, size_t target_size)
Initializes the base64 decoder.
Definition: base64-decode.c:79
Base64_Decode_status _Base64_Decode(Base64_Decode_control *self, char ch)
Decodes the character.
Definition: base64-decode.c:87
int _Base64_Encode(IO_Put_char put_char, void *arg, const void *src, size_t len, const char *wordbreak, int wordlen)
Outputs the source buffer in base64 encoding.
Definition: base64-encode.c:100
Base64_Decode_status
Represents the base64 and base64url decoder status.
Definition: base64.h:172
Base64_Decode_state
Represents the base64 and base64url decoder state.
Definition: base64.h:132
const uint8_t _Base64_Decoding[128]
Maps a 7-bit character to the associated 6-bit integer as defined by the base64 or base64url encoding...
Definition: base64-decode.c:45
const uint8_t _Base64url_Encoding[64]
Maps a 6-bit integer to the corresponding base64url encoding.
Definition: base64-encode.c:107
const uint8_t _Base64_Encoding[64]
Maps a 6-bit integer to the corresponding base64 encoding.
Definition: base64-encode.c:91
int _Base64url_Encode(IO_Put_char put_char, void *arg, const void *src, size_t len, const char *wordbreak, int wordlen)
Outputs the source buffer in base64url encoding.
Definition: base64-encode.c:116
Contains the base64 and base64url decoder control.
Definition: base64.h:142