base64.c File Reference

#include <config.h>
#include <isc/base64.h>
#include <isc/buffer.h>
#include <isc/lex.h>
#include <isc/string.h>
#include <isc/util.h>

Go to the source code of this file.

Data Structures

struct  base64_decode_ctx_t
 State of a base64 decoding process in progress. More...
static const char base64 []
static isc_result_t str_totext (const char *source, isc_buffer_t *target)
static isc_result_t mem_tobuffer (isc_buffer_t *target, void *base, unsigned int length)

Defines

#define RETERR(x)

Functions

isc_result_t isc_base64_totext (isc_region_t *source, int wordlength, const char *wordbreak, isc_buffer_t *target)
 Convert data into base64 encoded text.
static void base64_decode_init (base64_decode_ctx_t *ctx, int length, isc_buffer_t *target)
static isc_result_t base64_decode_char (base64_decode_ctx_t *ctx, int c)
static isc_result_t base64_decode_finish (base64_decode_ctx_t *ctx)
isc_result_t isc_base64_tobuffer (isc_lex_t *lexer, isc_buffer_t *target, int length)
 Convert base64 encoded text from a lexer context into data.
isc_result_t isc_base64_decodestring (const char *cstr, isc_buffer_t *target)
 Decode a null-terminated base64 string.


Detailed Description

Definition in file base64.c.


Define Documentation

#define RETERR (  ) 

Value:

do { \
        isc_result_t _r = (x); \
        if (_r != ISC_R_SUCCESS) \
                return (_r); \
        } while (0)

Definition at line 30 of file base64.c.


Function Documentation

static isc_result_t str_totext ( const char *  source,
isc_buffer_t target 
) [static]

These static functions are also present in lib/dns/rdata.c. I'm not sure where they should go. -- bwelling

Definition at line 227 of file base64.c.

References isc_region::base, isc_buffer_add, isc_buffer_availableregion, ISC_R_NOSPACE, ISC_R_SUCCESS, and isc_region::length.

static isc_result_t mem_tobuffer ( isc_buffer_t target,
void *  base,
unsigned int  length 
) [static]

Definition at line 243 of file base64.c.

References isc_region::base, isc_buffer_add, isc_buffer_availableregion, ISC_R_NOSPACE, ISC_R_SUCCESS, and isc_region::length.

isc_result_t isc_base64_totext ( isc_region_t source,
int  wordlength,
const char *  wordbreak,
isc_buffer_t target 
)

Convert data into base64 encoded text.

Notes:

Requires: Ensures:

Definition at line 53 of file base64.c.

References isc_region::base, base64, ISC_R_SUCCESS, isc_region_consume, isc_region::length, RETERR, and str_totext().

Referenced by dst__privstruct_writefile(), generate_session_key(), isccc_base64_encode(), totext_any_tsig(), totext_cdnskey(), totext_cert(), totext_dnskey(), totext_hip(), totext_in_dhcid(), totext_ipseckey(), totext_key(), totext_keydata(), totext_openpgpkey(), totext_opt(), totext_rrsig(), totext_sig(), and totext_tkey().

static void base64_decode_init ( base64_decode_ctx_t ctx,
int  length,
isc_buffer_t target 
) [inline, static]

Definition at line 111 of file base64.c.

References base64_decode_ctx_t::digits, ISC_FALSE, base64_decode_ctx_t::length, base64_decode_ctx_t::seen_end, and base64_decode_ctx_t::target.

Referenced by isc_base64_decodestring(), and isc_base64_tobuffer().

static isc_result_t base64_decode_char ( base64_decode_ctx_t ctx,
int  c 
) [inline, static]

Definition at line 120 of file base64.c.

References base64, base64_decode_ctx_t::digits, ISC_R_BADBASE64, ISC_R_SUCCESS, ISC_TRUE, base64_decode_ctx_t::length, mem_tobuffer(), RETERR, s, base64_decode_ctx_t::seen_end, base64_decode_ctx_t::target, and base64_decode_ctx_t::val.

Referenced by isc_base64_decodestring(), and isc_base64_tobuffer().

static isc_result_t base64_decode_finish ( base64_decode_ctx_t ctx  )  [inline, static]

Definition at line 171 of file base64.c.

References base64_decode_ctx_t::digits, ISC_R_BADBASE64, ISC_R_SUCCESS, ISC_R_UNEXPECTEDEND, and base64_decode_ctx_t::length.

Referenced by isc_base64_decodestring(), and isc_base64_tobuffer().

isc_result_t isc_base64_tobuffer ( isc_lex_t lexer,
isc_buffer_t target,
int  length 
)

Convert base64 encoded text from a lexer context into data.

Requires:

Ensures:

Definition at line 180 of file base64.c.

References isc_tokenvalue_t::as_textregion, isc_textregion::base, base64_decode_char(), base64_decode_finish(), base64_decode_init(), ISC_FALSE, isc_lex_getmastertoken(), isc_lex_ungettoken(), ISC_R_SUCCESS, isc_tokentype_string, ISC_TRUE, isc_textregion::length, base64_decode_ctx_t::length, RETERR, base64_decode_ctx_t::seen_end, token, isc_token::type, and isc_token::value.

Referenced by dst__privstruct_parse(), fromtext_any_tsig(), fromtext_cdnskey(), fromtext_cert(), fromtext_dnskey(), fromtext_in_dhcid(), fromtext_ipseckey(), fromtext_key(), fromtext_keydata(), fromtext_openpgpkey(), fromtext_rrsig(), fromtext_sig(), and fromtext_tkey().

isc_result_t isc_base64_decodestring ( const char *  cstr,
isc_buffer_t target 
)

Decode a null-terminated base64 string.

Requires:

Returns: Other error returns are any possible error code from:

Definition at line 210 of file base64.c.

References base64_decode_char(), base64_decode_finish(), base64_decode_init(), ISC_R_SUCCESS, and RETERR.

Referenced by add_initial_keys(), bind9_check_key(), check_trusted_key(), dstkey_fromconfig(), evaluate_key(), fromtext_hip(), get_rndckey(), isccc_base64_decode(), register_keys(), setup_keystr(), and setup_text_key().


Variable Documentation

const char base64[] [static]

Initial value:

        "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="

Definition at line 48 of file base64.c.

Referenced by base64_decode_char(), and isc_base64_totext().


Generated on Tue Apr 28 17:41:14 2015 by Doxygen 1.5.4 for BIND9 Internals 9.11.0pre-alpha