| 1 |
|
| 2 |
/* base encodings */ |
| 3 |
|
| 4 |
#ifndef UTIL_BASEXX_H |
| 5 |
#define UTIL_BASEXX_H |
| 6 |
|
| 7 |
#include "utiliof.h" |
| 8 |
|
| 9 |
/* base codecs state */ |
| 10 |
|
| 11 |
typedef struct basexx_state basexx_state; |
| 12 |
|
| 13 |
#define BASEXX_MAXLINE 80 |
| 14 |
#define BASEXX_PDF |
| 15 |
|
| 16 |
void basexx_state_init_ln (basexx_state *state, size_t line, size_t maxline); |
| 17 |
#define basexx_state_init(state) basexx_state_init_ln(state, 0, BASEXX_MAXLINE) |
| 18 |
|
| 19 |
/* base16 */ |
| 20 |
|
| 21 |
int base16_getc (iof *I); |
| 22 |
int base16_uc_putc (iof *I, int c); |
| 23 |
int base16_lc_putc (iof *I, int c); |
| 24 |
#define base16_putc base16_uc_putc |
| 25 |
|
| 26 |
iof_status base16_encoded_uc (const void *data, size_t size, iof *O); |
| 27 |
iof_status base16_encoded_lc (const void *data, size_t size, iof *O); |
| 28 |
iof_status base16_encoded_uc_ln (const void *data, size_t size, iof *O, size_t line, size_t maxline); |
| 29 |
iof_status base16_encoded_lc_ln (const void *data, size_t size, iof *O, size_t line, size_t maxline); |
| 30 |
|
| 31 |
iof_status base16_encode_uc (iof *I, iof *O); |
| 32 |
iof_status base16_encode_lc (iof *I, iof *O); |
| 33 |
iof_status base16_encode_uc_ln (iof *I, iof *O, size_t line, size_t maxline); |
| 34 |
iof_status base16_encode_lc_ln (iof *I, iof *O, size_t line, size_t maxline); |
| 35 |
iof_status base16_decode (iof *I, iof *O); |
| 36 |
|
| 37 |
#define base16_encoded base16_encoded_uc |
| 38 |
#define base16_encoded_ln base16_encoded_uc_ln |
| 39 |
#define base16_encode base16_encode_uc |
| 40 |
#define base16_encode_ln base16_encode_uc_ln |
| 41 |
|
| 42 |
iof_status base16_encode_state_uc (iof *I, iof *O, basexx_state *state); |
| 43 |
iof_status base16_encode_state_lc (iof *I, iof *O, basexx_state *state); |
| 44 |
iof_status base16_encode_state_uc_ln (iof *I, iof *O, basexx_state *state); |
| 45 |
iof_status base16_encode_state_lc_ln (iof *I, iof *O, basexx_state *state); |
| 46 |
iof_status base16_decode_state (iof *I, iof *O, basexx_state *state); |
| 47 |
|
| 48 |
#define base16_encode_state base16_encode_state_uc |
| 49 |
#define base16_encode_state_ln base16_encode_state_uc_ln |
| 50 |
|
| 51 |
/* base64 */ |
| 52 |
|
| 53 |
extern const char base64_alphabet[]; |
| 54 |
extern const int base64_lookup[]; |
| 55 |
|
| 56 |
iof_status base64_encoded (const void *data, size_t size, iof *O); |
| 57 |
iof_status base64_encoded_ln (const void *data, size_t size, iof *O, size_t line, size_t maxline); |
| 58 |
|
| 59 |
iof_status base64_encode (iof *I, iof *O); |
| 60 |
iof_status base64_encode_ln (iof *I, iof *O, size_t line, size_t maxline); |
| 61 |
iof_status base64_decode (iof *I, iof *O); |
| 62 |
|
| 63 |
iof_status base64_encode_state (iof *I, iof *O, basexx_state *state); |
| 64 |
iof_status base64_encode_state_ln (iof *I, iof *O, basexx_state *state); |
| 65 |
iof_status base64_decode_state (iof *I, iof *O, basexx_state *state); |
| 66 |
|
| 67 |
/* base85 */ |
| 68 |
|
| 69 |
extern const char base85_alphabet[]; |
| 70 |
extern const int base85_lookup[]; |
| 71 |
|
| 72 |
iof_status base85_encoded (const void *data, size_t size, iof *O); |
| 73 |
iof_status base85_encoded_ln (const void *data, size_t size, iof *O, size_t line, size_t maxline); |
| 74 |
|
| 75 |
iof_status base85_encode (iof *I, iof *O); |
| 76 |
iof_status base85_encode_ln (iof *I, iof *O, size_t line, size_t maxline); |
| 77 |
iof_status base85_decode (iof *I, iof *O); |
| 78 |
|
| 79 |
iof_status base85_encode_state (iof *I, iof *O, basexx_state *state); |
| 80 |
iof_status base85_encode_state_ln (iof *I, iof *O, basexx_state *state); |
| 81 |
iof_status base85_decode_state (iof *I, iof *O, basexx_state *state); |
| 82 |
|
| 83 |
/* run length */ |
| 84 |
|
| 85 |
typedef struct runlength_state runlength_state; |
| 86 |
|
| 87 |
void runlength_state_init (runlength_state *state); |
| 88 |
|
| 89 |
iof_status runlength_encode (iof *I, iof *O); |
| 90 |
iof_status runlength_encode_state (iof *I, iof *O, runlength_state *state); |
| 91 |
|
| 92 |
iof_status runlength_decode (iof *I, iof *O); |
| 93 |
iof_status runlength_decode_state (iof *I, iof *O, runlength_state *state); |
| 94 |
|
| 95 |
/* filters */ |
| 96 |
|
| 97 |
int iof_filter_basexx_encoder_ln (iof *N, size_t line, size_t maxline); |
| 98 |
|
| 99 |
iof * iof_filter_base16_decoder (iof *N); |
| 100 |
iof * iof_filter_base16_encoder (iof *N); |
| 101 |
|
| 102 |
iof * iof_filter_base64_decoder (iof *N); |
| 103 |
iof * iof_filter_base64_encoder (iof *N); |
| 104 |
|
| 105 |
iof * iof_filter_base85_decoder (iof *N); |
| 106 |
iof * iof_filter_base85_encoder (iof *N); |
| 107 |
|
| 108 |
iof * iof_filter_runlength_decoder (iof *N); |
| 109 |
iof * iof_filter_runlength_encoder (iof *N); |
| 110 |
|
| 111 |
#endif |