Refactor to match client.c usage

This commit is contained in:
frekky 2015-12-16 22:22:37 +08:00
parent ac60bf66a9
commit 1ff16293dc
6 changed files with 18 additions and 3 deletions

View File

@ -60,7 +60,7 @@ static size_t base128_blksize_enc();
static size_t base128_encoded_length(size_t inputlen); static size_t base128_encoded_length(size_t inputlen);
static size_t base128_raw_length(size_t inputlen); static size_t base128_raw_length(size_t inputlen);
static struct encoder base128_encoder = struct encoder base128_encoder =
{ {
"Base128", "Base128",
base128_encode, base128_encode,
@ -73,6 +73,8 @@ static struct encoder base128_encoder =
base128_raw_length base128_raw_length
}; };
struct encoder *b128 = &base128_encoder;
struct encoder struct encoder
*get_base128_encoder() *get_base128_encoder()
{ {

View File

@ -17,6 +17,9 @@
#ifndef __BASE128_H__ #ifndef __BASE128_H__
#define __BASE128_H__ #define __BASE128_H__
extern struct encoder base128_encoder;
extern struct encoder *b128;
struct encoder *get_base128_encoder(void); struct encoder *get_base128_encoder(void);
#endif #endif

View File

@ -42,7 +42,7 @@ static size_t base32_encoded_length(size_t inputlen);
static size_t base32_raw_length(size_t inputlen); static size_t base32_raw_length(size_t inputlen);
static struct encoder base32_encoder = struct encoder base32_encoder =
{ {
"Base32", "Base32",
base32_encode, base32_encode,
@ -55,6 +55,8 @@ static struct encoder base32_encoder =
base32_raw_length base32_raw_length
}; };
struct encoder *b32 = &base32_encoder;
struct encoder struct encoder
*get_base32_encoder() *get_base32_encoder()
{ {

View File

@ -18,6 +18,9 @@
#ifndef __BASE32_H__ #ifndef __BASE32_H__
#define __BASE32_H__ #define __BASE32_H__
extern struct encoder base32_encoder;
extern struct encoder *b32;
struct encoder *get_base32_encoder(void); struct encoder *get_base32_encoder(void);
int b32_5to8(int); int b32_5to8(int);

View File

@ -41,7 +41,7 @@ static size_t base64_blksize_enc();
static size_t base64_encoded_length(size_t inputlen); static size_t base64_encoded_length(size_t inputlen);
static size_t base64_raw_length(size_t inputlen); static size_t base64_raw_length(size_t inputlen);
static struct encoder base64_encoder = struct encoder base64_encoder =
{ {
"Base64", "Base64",
base64_encode, base64_encode,
@ -54,6 +54,8 @@ static struct encoder base64_encoder =
base64_raw_length base64_raw_length
}; };
struct encoder *b64 = &base64_encoder;
struct encoder struct encoder
*get_base64_encoder() *get_base64_encoder()
{ {

View File

@ -18,6 +18,9 @@
#ifndef __BASE64_H__ #ifndef __BASE64_H__
#define __BASE64_H__ #define __BASE64_H__
extern struct encoder base64_encoder;
extern struct encoder *b64;
struct encoder *get_base64_encoder(void); struct encoder *get_base64_encoder(void);
#endif #endif