Use the base64 as functions. More...
#include "asterisk.h"
#include "asterisk/module.h"
#include "asterisk/pbx.h"
#include "asterisk/utils.h"
Go to the source code of this file.
Functions | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
static int | base64_decode (struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len) |
static int | base64_encode (struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len) |
static int | load_module (void) |
static int | unload_module (void) |
Variables | |
static struct ast_module_info __MODULE_INFO_SECTION | __mod_info = { __MODULE_INFO_GLOBALS .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT , .description = "base64 encode/decode dialplan functions" , .key = ASTERISK_GPL_KEY , .buildopt_sum = AST_BUILDOPT_SUM, .load = load_module, .unload = unload_module, } |
static struct ast_module_info * | ast_module_info = &__mod_info |
static struct ast_custom_function | base64_decode_function |
static struct ast_custom_function | base64_encode_function |
Use the base64 as functions.
Definition in file func_base64.c.
static void __reg_module | ( | void | ) | [static] |
Definition at line 127 of file func_base64.c.
static void __unreg_module | ( | void | ) | [static] |
Definition at line 127 of file func_base64.c.
static int base64_decode | ( | struct ast_channel * | chan, |
const char * | cmd, | ||
char * | data, | ||
char * | buf, | ||
size_t | len | ||
) | [static] |
Definition at line 85 of file func_base64.c.
References ast_base64decode(), ast_log(), ast_strlen_zero(), and LOG_WARNING.
{ int decoded_len; if (ast_strlen_zero(data)) { ast_log(LOG_WARNING, "Syntax: BASE64_DECODE(<base_64 string>) - missing argument!\n"); return -1; } decoded_len = ast_base64decode((unsigned char *) buf, data, len); if (decoded_len <= (len - 1)) { /* if not truncated, */ buf[decoded_len] = '\0'; } else { buf[len - 1] = '\0'; } return 0; }
static int base64_encode | ( | struct ast_channel * | chan, |
const char * | cmd, | ||
char * | data, | ||
char * | buf, | ||
size_t | len | ||
) | [static] |
Definition at line 72 of file func_base64.c.
References ast_base64encode(), ast_log(), ast_strlen_zero(), and LOG_WARNING.
{ if (ast_strlen_zero(data)) { ast_log(LOG_WARNING, "Syntax: BASE64_ENCODE(<data>) - missing argument!\n"); return -1; } ast_base64encode(buf, (unsigned char *) data, strlen(data), len); return 0; }
static int load_module | ( | void | ) | [static] |
Definition at line 121 of file func_base64.c.
References ast_custom_function_register.
static int unload_module | ( | void | ) | [static] |
Definition at line 115 of file func_base64.c.
References ast_custom_function_unregister().
struct ast_module_info __MODULE_INFO_SECTION __mod_info = { __MODULE_INFO_GLOBALS .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT , .description = "base64 encode/decode dialplan functions" , .key = ASTERISK_GPL_KEY , .buildopt_sum = AST_BUILDOPT_SUM, .load = load_module, .unload = unload_module, } [static] |
Definition at line 127 of file func_base64.c.
struct ast_module_info* ast_module_info = &__mod_info [static] |
Definition at line 127 of file func_base64.c.
struct ast_custom_function base64_decode_function [static] |
{ .name = "BASE64_DECODE", .read = base64_decode, }
Definition at line 110 of file func_base64.c.
struct ast_custom_function base64_encode_function [static] |
{ .name = "BASE64_ENCODE", .read = base64_encode, }
Definition at line 105 of file func_base64.c.