diff options
author | Sean Bright <sean@malleable.com> | 2013-01-31 19:52:48 +0000 |
---|---|---|
committer | Sean Bright <sean@malleable.com> | 2013-01-31 19:52:48 +0000 |
commit | d6e05d5bf3509c3d1c1f8ddb2937acc65db180bc (patch) | |
tree | 9fb64874bcf958f201578f8f5e32c65cf5a61af7 /channels/iax2/include | |
parent | c1b4a93f4987bbf7066ab32ad023979f591446e1 (diff) |
Move IAX firmware related functionality into separate files.
This patch is mostly a reorganization of existing code with a few exceptions:
* Added doxygen comments to all of the extracted functions.
* Split reload_firmware(int unload) into iax_firmware_reload() and
iax_firmware_unload() for readability.
* Create iax_firmware_traverse() to support the 'iax2 show firmware' CLI
command.
* Renamed iax_check_version() to iax_firmware_get_version() and change its
arguments and return value so that it returns a success/failure value and sets
the selected version into an out parameter to avoid confusion with failure and
version 0.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@380695 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/iax2/include')
-rw-r--r-- | channels/iax2/include/firmware.h | 105 | ||||
-rw-r--r-- | channels/iax2/include/parser.h | 1 |
2 files changed, 106 insertions, 0 deletions
diff --git a/channels/iax2/include/firmware.h b/channels/iax2/include/firmware.h new file mode 100644 index 000000000..f8063b7aa --- /dev/null +++ b/channels/iax2/include/firmware.h @@ -0,0 +1,105 @@ +/* + * Asterisk -- An open source telephony toolkit. + * + * Copyright (C) 2013, Digium, Inc. + * + * Mark Spencer <markster@digium.com> + * + * See http://www.asterisk.org for more information about + * the Asterisk project. Please do not directly contact + * any of the maintainers of this project for assistance; + * the project provides a web site, mailing lists and IRC + * channels for your use. + * + * This program is free software, distributed under the terms of + * the GNU General Public License Version 2. See the LICENSE file + * at the top of the source tree. + */ + +/*! \file + * + * \brief IAX Firmware Support header file + */ + +#ifndef _IAX2_FIRMWARE_H +#define _IAX2_FIRMWARE_H + +#include "parser.h" + +/*! + * \internal + * \brief Reload the list of available firmware. + * + * Searches the IAX firmware directory, adding new firmware that is available + * and removing firmware that is no longer available. + * + * \return Nothing + */ +void iax_firmware_reload(void); + +/*! + * \internal + * \brief Unload all of the currently loaded firmware. + * + * return Nothing + */ +void iax_firmware_unload(void); + +/*! + * \internal + * \brief Determine the version number of the specified firmware. + * + * \param device_name The device name of the firmware for which we want the + * version. + * \param[out] version Pointer to a variable where the version number is + * stored upon return. + * + * \retval 1 on success + * \retval 0 on failure + */ +int iax_firmware_get_version(const char *device_name, + uint16_t *version); + +/*! + * \internal + * \brief Add firwmare related IEs to an IAX2 IE buffer. + * + * \param ie_data The IE buffer being appended to. + * \param device_name The name of the requested firmware. + * \param block_desc The requested firmware block identification. + * + * Search the list of loaded firmware for \c device_name and, if found, add the + * appropriate FWBLOCKDESC and FWBLOCKDATA IEs to the specified \c ie_data + * list. + * + * \retval 0 on success + * \retval non-zero on failure + */ +int iax_firmware_append(struct iax_ie_data *ie_data, + const char *device_name, unsigned int block_desc); + +/*! + * \internal + * \brief Iterate over the list of currently loaded IAX firmware. + * + * \param prefix The prefix of the device to filter for, or \c NULL to visit + * all firmware records. + * \param callback A pointer to a function to call for each firmware record + * that is visited. + * \param user_data A pointer to user supplied data that will be passed to the + * \c callback function each time it is invoked. + * + * This function visits each of the elements in the IAX firmware list, calling + * the specfied \c callback for each element. Iteration continues until the end + * of the list is reached, or the \c callback returns non-zero. + * + * The \c callback function receives a pointer to the firmware header and the + * value of the \c user_data argument that was passed in, which may be \c NULL. + * + * \return Nothing + */ +void iax_firmware_traverse(const char *prefix, + int (*callback)(struct ast_iax2_firmware_header *header, void *user_data), + void *user_data); + +#endif diff --git a/channels/iax2/include/parser.h b/channels/iax2/include/parser.h index caa121039..caaa098c9 100644 --- a/channels/iax2/include/parser.h +++ b/channels/iax2/include/parser.h @@ -18,6 +18,7 @@ #ifndef _IAX2_PARSER_H #define _IAX2_PARSER_H +#include "asterisk/frame.h" #include "asterisk/linkedlists.h" #include "asterisk/crypto.h" #include "iax2.h" |