#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include "asterisk.h"
#include "asterisk/channel.h"
#include "asterisk/pbx.h"
#include "asterisk/logger.h"
#include "asterisk/utils.h"
#include "asterisk/app.h"
#include "asterisk/module.h"
Include dependency graph for func_uri.c:
Go to the source code of this file.
Functions | |
static char * | builtin_function_uridecode (struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len) |
builtin_function_uridecode: Decode URI according to RFC 2396 | |
static char * | builtin_function_uriencode (struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len) |
builtin_function_uriencode: Encode URL according to RFC 2396 | |
char * | description (void) |
Provides a description of the module. | |
char * | key () |
Returns the ASTERISK_GPL_KEY. | |
int | load_module (void) |
Initialize the module. | |
int | unload_module (void) |
Cleanup all module structures, sockets, etc. | |
int | usecount (void) |
Provides a usecount. | |
Variables | |
static char * | tdesc = "URI encode/decode functions" |
static struct ast_custom_function | urldecode_function |
static struct ast_custom_function | urlencode_function |
Definition in file func_uri.c.
static char* builtin_function_uridecode | ( | struct ast_channel * | chan, | |
char * | cmd, | |||
char * | data, | |||
char * | buf, | |||
size_t | len | |||
) | [static] |
builtin_function_uridecode: Decode URI according to RFC 2396
Definition at line 61 of file func_uri.c.
References ast_log(), ast_strlen_zero(), ast_uri_decode(), and LOG_WARNING.
00062 { 00063 if (ast_strlen_zero(data)) { 00064 ast_log(LOG_WARNING, "Syntax: URIDECODE(<data>) - missing argument!\n"); 00065 return NULL; 00066 } 00067 00068 00069 ast_copy_string(buf, data, len); 00070 ast_uri_decode(buf); 00071 return buf; 00072 }
static char* builtin_function_uriencode | ( | struct ast_channel * | chan, | |
char * | cmd, | |||
char * | data, | |||
char * | buf, | |||
size_t | len | |||
) | [static] |
builtin_function_uriencode: Encode URL according to RFC 2396
Definition at line 45 of file func_uri.c.
References ast_log(), ast_strlen_zero(), ast_uri_encode(), and LOG_WARNING.
00046 { 00047 char uri[BUFSIZ]; 00048 00049 if (ast_strlen_zero(data)) { 00050 ast_log(LOG_WARNING, "Syntax: URIENCODE(<data>) - missing argument!\n"); 00051 return NULL; 00052 } 00053 00054 ast_uri_encode(data, uri, sizeof(uri), 1); 00055 ast_copy_string(buf, uri, len); 00056 00057 return buf; 00058 }
char* description | ( | void | ) |
Provides a description of the module.
Definition at line 107 of file func_uri.c.
References tdesc.
00108 { 00109 return tdesc; 00110 }
char* key | ( | void | ) |
Returns the ASTERISK_GPL_KEY.
This returns the ASTERISK_GPL_KEY, signifiying that you agree to the terms of the GPL stated in the ASTERISK_GPL_KEY. Your module will not load if it does not return the EXACT message:
char *key(void) { return ASTERISK_GPL_KEY; }
Definition at line 117 of file func_uri.c.
References ASTERISK_GPL_KEY.
00118 { 00119 return ASTERISK_GPL_KEY; 00120 }
int load_module | ( | void | ) |
Initialize the module.
Initialize the Agents module. This function is being called by Asterisk when loading the module. Among other thing it registers applications, cli commands and reads the cofiguration file.
Definition at line 102 of file func_uri.c.
References ast_custom_function_register(), urldecode_function, and urlencode_function.
00103 { 00104 return ast_custom_function_register(&urldecode_function) || ast_custom_function_register(&urlencode_function); 00105 }
int unload_module | ( | void | ) |
Cleanup all module structures, sockets, etc.
This is called at exit. Any registrations and memory allocations need to be unregistered and free'd here. Nothing else will do these for you (until exit).
Definition at line 97 of file func_uri.c.
References ast_custom_function_unregister(), urldecode_function, and urlencode_function.
00098 { 00099 return ast_custom_function_unregister(&urldecode_function) || ast_custom_function_unregister(&urlencode_function); 00100 }
int usecount | ( | void | ) |
Provides a usecount.
This function will be called by various parts of asterisk. Basically, all it has to do is to return a usecount when called. You will need to maintain your usecount within the module somewhere. The usecount should be how many channels provided by this module are in use.
Definition at line 112 of file func_uri.c.
char* tdesc = "URI encode/decode functions" [static] |
Definition at line 95 of file func_uri.c.
struct ast_custom_function urldecode_function [static] |
struct ast_custom_function urlencode_function [static] |