Wed Mar 2 18:56:43 2011

Asterisk developer's documentation


func_base64.c File Reference

Use the base64 as functions. More...

#include "asterisk.h"
#include "asterisk/module.h"
#include "asterisk/pbx.h"
#include "asterisk/utils.h"

Include dependency graph for func_base64.c:

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 __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT , .description = "base64 encode/decode dialplan functions" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .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


Detailed Description

Use the base64 as functions.

Definition in file func_base64.c.


Function Documentation

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.

00087 {
00088    int decoded_len;
00089 
00090    if (ast_strlen_zero(data)) {
00091       ast_log(LOG_WARNING, "Syntax: BASE64_DECODE(<base_64 string>) - missing argument!\n");
00092       return -1;
00093    }
00094 
00095    decoded_len = ast_base64decode((unsigned char *) buf, data, len);
00096    if (decoded_len <= (len - 1)) {     /* if not truncated, */
00097       buf[decoded_len] = '\0';
00098    } else {
00099       buf[len - 1] = '\0';
00100    }
00101 
00102    return 0;
00103 }

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.

00074 {
00075    if (ast_strlen_zero(data)) {
00076       ast_log(LOG_WARNING, "Syntax: BASE64_ENCODE(<data>) - missing argument!\n");
00077       return -1;
00078    }
00079 
00080    ast_base64encode(buf, (unsigned char *) data, strlen(data), len);
00081 
00082    return 0;
00083 }

static int load_module ( void   )  [static]

static int unload_module ( void   )  [static]


Variable Documentation

struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT , .description = "base64 encode/decode dialplan functions" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = AST_BUILDOPT_SUM, .load = load_module, .unload = unload_module, } [static]

Definition at line 127 of file func_base64.c.

Definition at line 127 of file func_base64.c.

Initial value:

 {
   .name = "BASE64_DECODE",
   .read = base64_decode,
}

Definition at line 110 of file func_base64.c.

Initial value:

 {
   .name = "BASE64_ENCODE",
   .read = base64_encode,
}

Definition at line 105 of file func_base64.c.


Generated on Wed Mar 2 18:56:44 2011 for Asterisk - the Open Source PBX by  doxygen 1.5.9