diff options
Diffstat (limited to 'res')
-rw-r--r-- | res/res_clioriginate.c | 36 | ||||
-rw-r--r-- | res/res_config_odbc.c | 39 | ||||
-rw-r--r-- | res/res_config_sqlite.c | 156 | ||||
-rw-r--r-- | res/res_convert.c | 9 | ||||
-rw-r--r-- | res/res_crypto.c | 85 | ||||
-rw-r--r-- | res/res_indications.c | 47 | ||||
-rw-r--r-- | res/res_monitor.c | 52 | ||||
-rw-r--r-- | res/res_snmp.c | 4 |
8 files changed, 310 insertions, 118 deletions
diff --git a/res/res_clioriginate.c b/res/res_clioriginate.c index 44afd7b76..8497f6387 100644 --- a/res/res_clioriginate.c +++ b/res/res_clioriginate.c @@ -69,6 +69,15 @@ struct ast_cli_entry cli_cliorig[] = { orig_help, complete_orig }, }; +/*! + * \brief orginate a call from the CLI + * \param fd file descriptor for cli + * \param chan channel to create type/data + * \param app application you want to run + * \param appdata data for application + * \retval RESULT_SUCCESS on success. + * \retval RESULT_SHOWUSAGE on failure. +*/ static int orig_app(int fd, const char *chan, const char *app, const char *appdata) { char *chantech; @@ -91,6 +100,14 @@ static int orig_app(int fd, const char *chan, const char *app, const char *appda return RESULT_SUCCESS; } +/*! + * \brief orginate from extension + * \param fd file descriptor for cli + * \param chan channel to create type/data + * \param data contains exten\@context + * \retval RESULT_SUCCESS on success. + * \retval RESULT_SHOWUSAGE on failure. +*/ static int orig_exten(int fd, const char *chan, const char *data) { char *chantech; @@ -122,6 +139,14 @@ static int orig_exten(int fd, const char *chan, const char *data) return RESULT_SUCCESS; } +/*! + * \brief handle for orgination app or exten. + * \param fd file descriptor + * \param argc no of arguements + * \param argv contains either application or extension arguements + * \retval RESULT_SUCCESS on success. + * \retval RESULT_SHOWUSAGE on failure. +*/ static int handle_orig(int fd, int argc, char *argv[]) { int res; @@ -144,6 +169,15 @@ static int handle_orig(int fd, int argc, char *argv[]) return res; } +/*! + * \brief complete suggestions for orginate command + * \param line + * \param word to be completed word + * \param pos position + * \param state + * \retval completed word + * \retval NULL on failure +*/ static char *complete_orig(const char *line, const char *word, int pos, int state) { static char *choices[] = { "application", "extension", NULL }; @@ -160,12 +194,14 @@ static char *complete_orig(const char *line, const char *word, int pos, int stat return ret; } +/*! \brief Unload orginate module */ static int unload_module(void) { ast_cli_unregister_multiple(cli_cliorig, sizeof(cli_cliorig) / sizeof(struct ast_cli_entry)); return 0; } +/*! \brief Load orginate module */ static int load_module(void) { ast_cli_register_multiple(cli_cliorig, sizeof(cli_cliorig) / sizeof(struct ast_cli_entry)); diff --git a/res/res_config_odbc.c b/res/res_config_odbc.c index 28c8c316e..2c8b90e3d 100644 --- a/res/res_config_odbc.c +++ b/res/res_config_odbc.c @@ -54,6 +54,18 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/res_odbc.h" #include "asterisk/utils.h" +/*! + * \brief Excute an SQL query and return ast_variable list + * \param database + * \param table + * \param ap list containing one or more field/operator/value set + * Select database and preform query on table, prepare the sql statement + * Sub-in the values to the prepared statement and execute it. Return results + * as a ast_variable list. + * + * \retval var on success + * \retval NULL on failure +*/ static struct ast_variable *realtime_odbc(const char *database, const char *table, va_list ap) { struct odbc_obj *obj; @@ -204,6 +216,19 @@ static struct ast_variable *realtime_odbc(const char *database, const char *tabl return var; } +/*! + * \brief Excute an Select query and return ast_config list + * \param database + * \param table + * \param ap list containing one or more field/operator/value set + * Select database and preform query on table, prepare the sql statement + * Sub-in the values to the prepared statement and execute it. + * Execute this prepared query against several ODBC connected databases. + * Return results as an ast_config variable. + * + * \retval var on success + * \retval NULL on failure +*/ static struct ast_config *realtime_multi_odbc(const char *database, const char *table, va_list ap) { struct odbc_obj *obj; @@ -360,6 +385,20 @@ static struct ast_config *realtime_multi_odbc(const char *database, const char * return cfg; } +/*! + * \brief Excute an UPDATE query + * \param database + * \param table + * \param keyfield where clause field + * \param lookup value of field for where clause + * \param ap list containing one or more field/value set(s) + * Update a database table, prepare the sql statement using keyfield and lookup + * control the number of records to change. All values to be changed are stored in ap list. + * Sub-in the values to the prepared statement and execute it. + * + * \retval number of rows affected + * \retval -1 on failure +*/ static int update_odbc(const char *database, const char *table, const char *keyfield, const char *lookup, va_list ap) { struct odbc_obj *obj; diff --git a/res/res_config_sqlite.c b/res/res_config_sqlite.c index 9aa37d5f0..c9c65f881 100644 --- a/res/res_config_sqlite.c +++ b/res/res_config_sqlite.c @@ -20,7 +20,7 @@ */ /*! - * \mainpage res_config_sqlite + * \page res_config_sqlite * * \section intro_sec Presentation * @@ -232,56 +232,58 @@ struct rt_multi_cfg_entry_args { }; /*! - * Allocate a variable. - * - * \param var the address of the variable to set (it will be allocated) - * \param name the name of the variable (for error handling) + * \brief Allocate a variable. + * \param var the address of the variable to set (it will be allocated) + * \param name the name of the variable (for error handling) * \param value the value to store in var - * \return 1 if an allocation error occurred, 0 otherwise + * \retval 0 on success + * \retval 1 if an allocation error occurred */ static int set_var(char **var, char *name, char *value); /*! - * Load the configuration file. + * \brief Load the configuration file. + * \see unload_config() * * This function sets dbfile, config_table, and cdr_table. It calls * check_vars() before returning, and unload_config() if an error occurred. * - * \return 1 if an error occurred, 0 otherwise - * \see unload_config() + * \retval 0 on success + * \retval 1 if an error occurred */ static int load_config(void); /*! - * Free resources related to configuration. - * + * \brief Free resources related to configuration. * \see load_config() */ static void unload_config(void); /*! - * Asterisk callback function for CDR support. + * \brief Asterisk callback function for CDR support. + * \param cdr the CDR entry Asterisk sends us * * Asterisk will call this function each time a CDR entry must be logged if * CDR support is enabled. * - * \param cdr the CDR entry Asterisk sends us - * \return 1 if an error occurred, 0 otherwise + * \retval 0 on success + * \retval 1 if an error occurred */ static int cdr_handler(struct ast_cdr *cdr); /*! - * SQLite callback function for static configuration. + * \brief SQLite callback function for static configuration. * * This function is passed to the SQLite engine as a callback function to * parse a row and store it in a struct ast_config object. It relies on * resulting rows being sorted by category. * - * \param arg a pointer to a struct cfg_entry_args object - * \param argc number of columns - * \param argv values in the row + * \param arg a pointer to a struct cfg_entry_args object + * \param argc number of columns + * \param argv values in the row * \param columnNames names and types of the columns - * \return 1 if an error occurred, 0 otherwise + * \retval 0 on success + * \retval 1 if an error occurred * \see cfg_entry_args * \see sql_get_config_table * \see config_handler() @@ -289,17 +291,18 @@ static int cdr_handler(struct ast_cdr *cdr); static int add_cfg_entry(void *arg, int argc, char **argv, char **columnNames); /*! - * Asterisk callback function for static configuration. + * \brief Asterisk callback function for static configuration. * * Asterisk will call this function when it loads its static configuration, * which usually happens at startup and reload. * * \param database the database to use (ignored) - * \param table the table to use - * \param file the file to load from the database - * \param cfg the struct ast_config object to use when storing variables + * \param table the table to use + * \param file the file to load from the database + * \param cfg the struct ast_config object to use when storing variables * \param withcomments Integer. Flag - * \return NULL if an error occurred, cfg otherwise + * \retval cfg object + * \retval NULL if an error occurred * \see add_cfg_entry() */ static struct ast_config * config_handler(const char *database, @@ -307,7 +310,7 @@ static struct ast_config * config_handler(const char *database, struct ast_config *cfg, int withcomments); /*! - * Helper function to parse a va_list object into 2 dynamic arrays of + * \brief Helper function to parse a va_list object into 2 dynamic arrays of * strings, parameters and values. * * ap must have the following format : param1 val1 param2 val2 param3 val3 ... @@ -322,26 +325,27 @@ static struct ast_config * config_handler(const char *database, * is the responsibility of the caller to release the memory of these arrays. * It is considered an error that va_list has a null or odd number of strings. * - * \param ap the va_list object to parse + * \param ap the va_list object to parse * \param params_ptr where the address of the params array is stored - * \param vals_ptr where the address of the vals array is stored - * \return 0 if an error occurred, the number of elements in the arrays (which - * have the same size) otherwise + * \param vals_ptr where the address of the vals array is stored + * \retval the number of elements in the arrays (which have the same size). + * \retval 0 if an error occurred. */ static size_t get_params(va_list ap, const char ***params_ptr, const char ***vals_ptr); /*! - * SQLite callback function for RealTime configuration. + * \brief SQLite callback function for RealTime configuration. * * This function is passed to the SQLite engine as a callback function to * parse a row and store it in a linked list of struct ast_variable objects. * - * \param arg a pointer to a struct rt_cfg_entry_args object - * \param argc number of columns - * \param argv values in the row + * \param arg a pointer to a struct rt_cfg_entry_args object + * \param argc number of columns + * \param argv values in the row * \param columnNames names and types of the columns - * \return 1 if an error occurred, 0 otherwise + * \retval 0 on success. + * \retval 1 if an error occurred. * \see rt_cfg_entry_args * \see realtime_handler() */ @@ -360,25 +364,27 @@ static int add_rt_cfg_entry(void *arg, int argc, char **argv, * \param database the database to use (ignored) * \param table the table to use * \param ap list of parameters and values to match - * \return NULL if an error occurred, a linked list of struct ast_variable - * objects otherwise + * + * \retval a linked list of struct ast_variable objects + * \retval NULL if an error occurred * \see add_rt_cfg_entry() */ static struct ast_variable * realtime_handler(const char *database, const char *table, va_list ap); /*! - * SQLite callback function for RealTime configuration. + * \brief SQLite callback function for RealTime configuration. * * This function performs the same actions as add_rt_cfg_entry() except * that the rt_multi_cfg_entry_args structure is designed to store * categories in addition of variables. * - * \param arg a pointer to a struct rt_multi_cfg_entry_args object - * \param argc number of columns - * \param argv values in the row + * \param arg a pointer to a struct rt_multi_cfg_entry_args object + * \param argc number of columns + * \param argv values in the row * \param columnNames names and types of the columns - * \return 1 if an error occurred, 0 otherwise + * \retval 0 on success. + * \retval 1 if an error occurred. * \see rt_multi_cfg_entry_args * \see realtime_multi_handler() */ @@ -386,17 +392,18 @@ static int add_rt_multi_cfg_entry(void *arg, int argc, char **argv, char **columnNames); /*! - * Asterisk callback function for RealTime configuration. + * \brief Asterisk callback function for RealTime configuration. * * This function performs the same actions as realtime_handler() except * that it can store variables per category, and can return several * categories. * * \param database the database to use (ignored) - * \param table the table to use - * \param ap list of parameters and values to match - * \return NULL if an error occurred, a struct ast_config object storing - * categories and variables + * \param table the table to use + * \param ap list of parameters and values to match + * \retval a struct ast_config object storing categories and variables. + * \retval NULL if an error occurred. + * * \see add_rt_multi_cfg_entry() */ static struct ast_config * realtime_multi_handler(const char *database, @@ -404,7 +411,7 @@ static struct ast_config * realtime_multi_handler(const char *database, va_list ap); /*! - * Asterisk callback function for RealTime configuration (variable + * \brief Asterisk callback function for RealTime configuration (variable * update). * * Asterisk will call this function each time a variable has been modified @@ -414,64 +421,49 @@ static struct ast_config * realtime_multi_handler(const char *database, * same format as the other realtime functions. * * \param database the database to use (ignored) - * \param table the table to use + * \param table the table to use * \param keyfield the column of the matching cell - * \param entity the value of the matching cell - * \param ap list of parameters and new values to update in the database - * \return -1 if an error occurred, the number of affected rows otherwise + * \param entity the value of the matching cell + * \param ap list of parameters and new values to update in the database + * \retval the number of affected rows. + * \retval -1 if an error occurred. */ static int realtime_update_handler(const char *database, const char *table, const char *keyfield, const char *entity, va_list ap); /*! - * Asterisk callback function for the CLI status command. + * \brief Asterisk callback function for the CLI status command. * - * \param fd file descriptor provided by Asterisk to use with ast_cli() + * \param fd file descriptor provided by Asterisk to use with ast_cli() * \param argc number of arguments * \param argv arguments list * \return RESULT_SUCCESS */ static int cli_status(int fd, int argc, char *argv[]); -/*! - * The SQLite database object. - */ +/*! The SQLite database object. */ static sqlite *db; -/*! - * Set to 1 if CDR support is enabled. - */ +/*! Set to 1 if CDR support is enabled. */ static int use_cdr; -/*! - * Set to 1 if the CDR callback function was registered. - */ +/*! Set to 1 if the CDR callback function was registered. */ static int cdr_registered; -/*! - * Set to 1 if the CLI status command callback function was registered. - */ +/*! Set to 1 if the CLI status command callback function was registered. */ static int cli_status_registered; -/*! - * The path of the database file. - */ +/*! The path of the database file. */ static char *dbfile; -/*! - * The name of the static configuration table. - */ +/*! The name of the static configuration table. */ static char *config_table; -/*! - * The name of the table used to store CDR entries. - */ +/*! The name of the table used to store CDR entries. */ static char *cdr_table; -/*! - * The number of registered virtual machines. - */ +/*! The number of registered virtual machines. */ static int vm_count; /*! @@ -509,9 +501,7 @@ static struct ast_cli_entry cli_status_cmd = * Taken from Asterisk 1.2 cdr_sqlite.so. */ -/*! - * SQL query format to create the CDR table if non existent. - */ +/*! SQL query format to create the CDR table if non existent. */ static char *sql_create_cdr_table = "CREATE TABLE '%q' (" " id INTEGER PRIMARY KEY," @@ -535,9 +525,7 @@ static char *sql_create_cdr_table = " userfield VARCHAR(255) NOT NULL DEFAULT ''" ");"; -/*! - * SQL query format to insert a CDR entry. - */ +/*! SQL query format to insert a CDR entry. */ static char *sql_add_cdr_entry = "INSERT INTO '%q' (" " clid," @@ -583,7 +571,7 @@ static char *sql_add_cdr_entry = * SQL query format to fetch the static configuration of a file. * Rows must be sorted by category. * - * @see add_cfg_entry() + * \see add_cfg_entry() */ static char *sql_get_config_table = "SELECT *" diff --git a/res/res_convert.c b/res/res_convert.c index be3d177eb..34606ac24 100644 --- a/res/res_convert.c +++ b/res/res_convert.c @@ -56,7 +56,14 @@ static int split_ext(char *filename, char **name, char **ext) return 0; } -/*! \brief Convert a file from one format to another */ +/*! + * \brief Convert a file from one format to another + * \param fd file descriptor + * \param argc no arguements + * \param argv list of arguements + * \retval RESULT_SUCCESS on success. + * \retval RESULT_SHOWUSAGE on failure. +*/ static int cli_audio_convert(int fd, int argc, char *argv[]) { int ret = RESULT_FAILURE; diff --git a/res/res_crypto.c b/res/res_crypto.c index 73a54ba6d..1897ab1cf 100644 --- a/res/res_crypto.c +++ b/res/res_crypto.c @@ -84,21 +84,21 @@ AST_MUTEX_DEFINE_STATIC(keylock); #define KEY_NEEDS_PASSCODE (1 << 16) struct ast_key { - /* Name of entity */ + /*! Name of entity */ char name[80]; - /* File name */ + /*! File name */ char fn[256]; - /* Key type (AST_KEY_PUB or AST_KEY_PRIV, along with flags from above) */ + /*! Key type (AST_KEY_PUB or AST_KEY_PRIV, along with flags from above) */ int ktype; - /* RSA structure (if successfully loaded) */ + /*! RSA structure (if successfully loaded) */ RSA *rsa; - /* Whether we should be deleted */ + /*! Whether we should be deleted */ int delme; - /* FD for input (or -1 if no input allowed, or -2 if we needed input) */ + /*! FD for input (or -1 if no input allowed, or -2 if we needed input) */ int infd; - /* FD for output */ + /*! FD for output */ int outfd; - /* Last MD5 Digest */ + /*! Last MD5 Digest */ unsigned char digest[16]; struct ast_key *next; }; @@ -112,6 +112,16 @@ static int fdprint(int fd, char *s) return write(fd, s, strlen(s) + 1); } #endif + + +/*! + * \brief setting of priv key + * \param buf + * \param size + * \param rwflag + * \param userdata + * \return length of string,-1 on failure +*/ static int pw_cb(char *buf, int size, int rwflag, void *userdata) { struct ast_key *key = (struct ast_key *)userdata; @@ -137,6 +147,10 @@ static int pw_cb(char *buf, int size, int rwflag, void *userdata) return -1; } +/*! + * \brief return the ast_key structure for name + * \see ast_key_get +*/ static struct ast_key *__ast_key_get(const char *kname, int ktype) { struct ast_key *key; @@ -152,6 +166,16 @@ static struct ast_key *__ast_key_get(const char *kname, int ktype) return key; } +/*! + * \brief load RSA key from file + * \param dir directory string + * \param fname name of file + * \param ifd incoming file descriptor + * \param ofd outgoing file descriptor + * \param not2 + * \retval key on success. + * \retval NULL on failure. +*/ static struct ast_key *try_load_key (char *dir, char *fname, int ifd, int ofd, int *not2) { int ktype = 0; @@ -318,6 +342,10 @@ static char *binary(int y, int len) #endif +/*! + * \brief signs outgoing message with public key + * \see ast_sign_bin +*/ static int __ast_sign_bin(struct ast_key *key, const char *msg, int msglen, unsigned char *dsig) { unsigned char digest[20]; @@ -349,6 +377,10 @@ static int __ast_sign_bin(struct ast_key *key, const char *msg, int msglen, unsi } +/*! + * \brief decrypt a message + * \see ast_decrypt_bin +*/ static int __ast_decrypt_bin(unsigned char *dst, const unsigned char *src, int srclen, struct ast_key *key) { int res; @@ -375,6 +407,10 @@ static int __ast_decrypt_bin(unsigned char *dst, const unsigned char *src, int s return pos; } +/*! + * \brief encrypt a message + * \see ast_encrypt_bin +*/ static int __ast_encrypt_bin(unsigned char *dst, const unsigned char *src, int srclen, struct ast_key *key) { int res; @@ -403,6 +439,10 @@ static int __ast_encrypt_bin(unsigned char *dst, const unsigned char *src, int s return pos; } +/*! + * \brief wrapper for __ast_sign_bin then base64 encode it + * \see ast_sign +*/ static int __ast_sign(struct ast_key *key, char *msg, char *sig) { unsigned char dsig[128]; @@ -416,6 +456,10 @@ static int __ast_sign(struct ast_key *key, char *msg, char *sig) } +/*! + * \brief check signature of a message + * \see ast_check_signature_bin +*/ static int __ast_check_signature_bin(struct ast_key *key, const char *msg, int msglen, const unsigned char *dsig) { unsigned char digest[20]; @@ -442,6 +486,10 @@ static int __ast_check_signature_bin(struct ast_key *key, const char *msg, int m return 0; } +/*! + * \brief base64 decode then sent to __ast_check_signature_bin + * \see ast_check_signature +*/ static int __ast_check_signature(struct ast_key *key, const char *msg, const char *sig) { unsigned char dsig[128]; @@ -457,6 +505,12 @@ static int __ast_check_signature(struct ast_key *key, const char *msg, const cha return res; } +/*! + * \brief refresh RSA keys from file + * \param ifd file descriptor + * \param ofd file descriptor + * \return void +*/ static void crypto_load(int ifd, int ofd) { struct ast_key *key, *nkey, *last; @@ -512,6 +566,13 @@ static void md52sum(char *sum, unsigned char *md5) sum += sprintf(sum, "%02x", *(md5++)); } +/*! + * \brief show the list of RSA keys + * \param fd file descriptor + * \param argc no of arguements + * \param argv list of arguements + * \return RESULT_SUCCESS +*/ static int show_keys(int fd, int argc, char *argv[]) { struct ast_key *key; @@ -535,6 +596,13 @@ static int show_keys(int fd, int argc, char *argv[]) return RESULT_SUCCESS; } +/*! + * \brief initialize all RSA keys + * \param fd file descriptor + * \param argc no of arguements + * \param argv list of arguements + * \return RESULT_SUCCESS +*/ static int init_keys(int fd, int argc, char *argv[]) { struct ast_key *key; @@ -573,6 +641,7 @@ static struct ast_cli_entry cli_crypto[] = { init_keys_usage }, }; +/*! \brief initialise the res_crypto module */ static int crypto_init(void) { SSL_library_init(); diff --git a/res/res_indications.c b/res/res_indications.c index 7397218dc..2a4f38a3a 100644 --- a/res/res_indications.c +++ b/res/res_indications.c @@ -80,8 +80,11 @@ char *playtones_desc= * Implementation of functions provided by this module */ -/* - * ADD INDICATION command stuff +/*! + * \brief Add a country to indication + * \param fd file descriptor of CLI + * \param argc no of args + * \param argv arguements */ static int handle_add_indication(int fd, int argc, char *argv[]) { @@ -114,8 +117,11 @@ static int handle_add_indication(int fd, int argc, char *argv[]) return 0; } -/* - * REMOVE INDICATION command stuff +/*! + * \brief Remove a country from indication + * \param fd file descriptor of CLI + * \param argc no of args + * \param argv arguements */ static int handle_remove_indication(int fd, int argc, char *argv[]) { @@ -143,8 +149,11 @@ static int handle_remove_indication(int fd, int argc, char *argv[]) return 0; } -/* - * SHOW INDICATIONS command stuff +/*! + * \brief Show the current indications + * \param fd file descriptor of CLI + * \param argc no of args + * \param argv arguements */ static int handle_show_indications(int fd, int argc, char *argv[]) { @@ -191,8 +200,10 @@ static int handle_show_indications(int fd, int argc, char *argv[]) return -1; } -/* - * Playtones command stuff +/*! + * \brief play tone for indication country + * \param chan ast_channel to play the sounds back to + * \param data contains tone to play */ static int handle_playtones(struct ast_channel *chan, void *data) { @@ -213,8 +224,10 @@ static int handle_playtones(struct ast_channel *chan, void *data) return res; } -/* - * StopPlaylist command stuff +/*! + * \brief Stop tones playing + * \param chan + * \param data */ static int handle_stopplaytones(struct ast_channel *chan, void *data) { @@ -222,9 +235,7 @@ static int handle_stopplaytones(struct ast_channel *chan, void *data) return 0; } -/* - * Load module stuff - */ +/*! \brief load indications module */ static int ind_load_module(void) { struct ast_config *cfg; @@ -342,9 +353,7 @@ out: v = v->next; return 0; } -/* - * CLI entries for commands provided by this module - */ +/*! \brief CLI entries for commands provided by this module */ static struct ast_cli_entry cli_indications[] = { { { "indication", "add", NULL }, handle_add_indication, "Add the given indication to the country", @@ -359,9 +368,7 @@ static struct ast_cli_entry cli_indications[] = { help_show_indications }, }; -/* - * Standard module functions ... - */ +/*! \brief Unload indicators module */ static int unload_module(void) { /* remove the registed indications... */ @@ -375,6 +382,7 @@ static int unload_module(void) } +/*! \brief Load indications module */ static int load_module(void) { if (ind_load_module()) @@ -386,6 +394,7 @@ static int load_module(void) return 0; } +/*! \brief Reload indications module */ static int reload(void) { /* remove the registed indications... */ diff --git a/res/res_monitor.c b/res/res_monitor.c index cc4701049..6a7330142 100644 --- a/res/res_monitor.c +++ b/res/res_monitor.c @@ -115,6 +115,13 @@ static char *unpausemonitor_descrip = "UnpauseMonitor\n" "Unpauses monitoring of a channel on which monitoring had\n" "previously been paused with PauseMonitor.\n"; +/*! + * \brief Change state of monitored channel + * \param chan + * \param state monitor state + * \retval 0 on success. + * \retval -1 on failure. +*/ static int ast_monitor_set_state(struct ast_channel *chan, int state) { LOCK_IF_NEEDED(chan, 1); @@ -133,7 +140,10 @@ static int ast_monitor_set_state(struct ast_channel *chan, int state) * \param fname_base filename base to record to * \param need_lock whether to lock the channel mutex * \param stream_action whether to record the input and/or output streams. X_REC_IN | X_REC_OUT is most often used - * \returns 0 on success, -1 on failure + * Creates the file to record, if no format is specified it assumes WAV + * It also sets channel variable __MONITORED=yes + * \retval 0 on success + * \retval -1 on failure */ int ast_monitor_start( struct ast_channel *chan, const char *format_spec, const char *fname_base, int need_lock, int stream_action) @@ -241,7 +251,9 @@ int ast_monitor_start( struct ast_channel *chan, const char *format_spec, return res; } -/* +/*! + * \brief Get audio format. + * \param format recording format. * The file format extensions that Asterisk uses are not all the same as that * which soxmix expects. This function ensures that the format used as the * extension on the filename is something soxmix will understand. @@ -258,7 +270,13 @@ static const char *get_soxmix_format(const char *format) return res; } -/* Stop monitoring a channel */ +/*! + * \brief Stop monitoring channel + * \param chan + * \param need_lock + * Stop the recording, close any open streams, mix in/out channels if required + * \return Always 0 +*/ int ast_monitor_stop(struct ast_channel *chan, int need_lock) { int delfiles = 0; @@ -339,29 +357,38 @@ int ast_monitor_stop(struct ast_channel *chan, int need_lock) } -/* Pause monitoring of a channel */ +/*! \brief Pause monitoring of channel */ int ast_monitor_pause(struct ast_channel *chan) { return ast_monitor_set_state(chan, AST_MONITOR_PAUSED); } -/* Unpause monitoring of a channel */ +/*! \brief Unpause monitoring of channel */ int ast_monitor_unpause(struct ast_channel *chan) { return ast_monitor_set_state(chan, AST_MONITOR_RUNNING); } +/*! \brief Wrapper for ast_monitor_pause */ static int pause_monitor_exec(struct ast_channel *chan, void *data) { return ast_monitor_pause(chan); } +/*! \brief Wrapper for ast_monitor_unpause */ static int unpause_monitor_exec(struct ast_channel *chan, void *data) { return ast_monitor_unpause(chan); } -/* Change monitoring filename of a channel */ +/*! + * \brief Change monitored filename of channel + * \param chan + * \param fname_base new filename + * \param need_lock + * \retval 0 on success. + * \retval -1 on failure. +*/ int ast_monitor_change_fname(struct ast_channel *chan, const char *fname_base, int need_lock) { if (ast_strlen_zero(fname_base)) { @@ -390,6 +417,14 @@ int ast_monitor_change_fname(struct ast_channel *chan, const char *fname_base, i return 0; } + +/*! + * \brief Start monitor + * \param chan + * \param data arguements passed fname|options + * \retval 0 on success. + * \retval -1 on failure. +*/ static int start_monitor_exec(struct ast_channel *chan, void *data) { char *arg = NULL; @@ -470,11 +505,13 @@ static int start_monitor_exec(struct ast_channel *chan, void *data) return res; } +/*! \brief Wrapper function \see ast_monitor_stop */ static int stop_monitor_exec(struct ast_channel *chan, void *data) { return ast_monitor_stop(chan, 1); } +/*! \brief Wrapper function \see ast_monitor_change_fname */ static int change_monitor_exec(struct ast_channel *chan, void *data) { return ast_monitor_change_fname(chan, (const char*)data, 1); @@ -494,6 +531,7 @@ static char start_monitor_action_help[] = " the input and output channels together after the\n" " recording is finished.\n"; +/*! \brief Start monitoring a channel by manager connection */ static int start_monitor_action(struct mansession *s, const struct message *m) { struct ast_channel *c = NULL; @@ -547,6 +585,7 @@ static char stop_monitor_action_help[] = " started 'Monitor' action. The only parameter is 'Channel', the name\n" " of the channel monitored.\n"; +/*! \brief Stop monitoring a channel by manager connection */ static int stop_monitor_action(struct mansession *s, const struct message *m) { struct ast_channel *c = NULL; @@ -579,6 +618,7 @@ static char change_monitor_action_help[] = " File - Required. Is the new name of the file created in the\n" " monitor spool directory.\n"; +/*! \brief Change filename of a monitored channel by manager connection */ static int change_monitor_action(struct mansession *s, const struct message *m) { struct ast_channel *c = NULL; diff --git a/res/res_snmp.c b/res/res_snmp.c index a0be455ef..b820c98ac 100644 --- a/res/res_snmp.c +++ b/res/res_snmp.c @@ -40,6 +40,10 @@ int res_snmp_enabled; static pthread_t thread = AST_PTHREADT_NULL; +/*! + * \brief Load res_snmp.conf config file + * \return 1 on load, 0 file does not exist +*/ static int load_config(void) { struct ast_variable *var; |