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 | |
| AST_MODULE_INFO_STANDARD (ASTERISK_GPL_KEY,"base64 encode/decode dialplan functions") | |
| 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_custom_function | base64_decode_function |
| static struct ast_custom_function | base64_encode_function |
Use the base64 as functions.
Definition in file func_base64.c.
| AST_MODULE_INFO_STANDARD | ( | ASTERISK_GPL_KEY | , | |
| "base64 encode/decode dialplan functions" | ||||
| ) |
| static int base64_decode | ( | struct ast_channel * | chan, | |
| const char * | cmd, | |||
| char * | data, | |||
| char * | buf, | |||
| size_t | len | |||
| ) | [static] |
Definition at line 75 of file func_base64.c.
References ast_base64decode(), ast_log(), ast_strlen_zero(), and LOG_WARNING.
00077 { 00078 int decoded_len; 00079 00080 if (ast_strlen_zero(data)) { 00081 ast_log(LOG_WARNING, "Syntax: BASE64_DECODE(<base_64 string>) - missing argument!\n"); 00082 return -1; 00083 } 00084 00085 decoded_len = ast_base64decode((unsigned char *) buf, data, len); 00086 if (decoded_len <= (len - 1)) { /* if not truncated, */ 00087 buf[decoded_len] = '\0'; 00088 } else { 00089 buf[len - 1] = '\0'; 00090 } 00091 00092 return 0; 00093 }
| static int base64_encode | ( | struct ast_channel * | chan, | |
| const char * | cmd, | |||
| char * | data, | |||
| char * | buf, | |||
| size_t | len | |||
| ) | [static] |
Definition at line 62 of file func_base64.c.
References ast_base64encode(), ast_log(), ast_strlen_zero(), and LOG_WARNING.
00064 { 00065 if (ast_strlen_zero(data)) { 00066 ast_log(LOG_WARNING, "Syntax: BASE64_ENCODE(<data>) - missing argument!\n"); 00067 return -1; 00068 } 00069 00070 ast_base64encode(buf, (unsigned char *) data, strlen(data), len); 00071 00072 return 0; 00073 }
| static int load_module | ( | void | ) | [static] |
Definition at line 111 of file func_base64.c.
References ast_custom_function_register.
00112 { 00113 return ast_custom_function_register(&base64_encode_function) | 00114 ast_custom_function_register(&base64_decode_function); 00115 }
| static int unload_module | ( | void | ) | [static] |
Definition at line 105 of file func_base64.c.
References ast_custom_function_unregister().
00106 { 00107 return ast_custom_function_unregister(&base64_encode_function) | 00108 ast_custom_function_unregister(&base64_decode_function); 00109 }
struct ast_custom_function base64_decode_function [static] |
{
.name = "BASE64_DECODE",
.read = base64_decode,
}
Definition at line 100 of file func_base64.c.
struct ast_custom_function base64_encode_function [static] |
{
.name = "BASE64_ENCODE",
.read = base64_encode,
}
Definition at line 95 of file func_base64.c.
1.6.1