Asterisk - The Open Source Telephony Project  21.4.1
firmware.h
Go to the documentation of this file.
1 /*
2  * Asterisk -- An open source telephony toolkit.
3  *
4  * Copyright (C) 2013, Digium, Inc.
5  *
6  * Mark Spencer <markster@digium.com>
7  *
8  * See http://www.asterisk.org for more information about
9  * the Asterisk project. Please do not directly contact
10  * any of the maintainers of this project for assistance;
11  * the project provides a web site, mailing lists and IRC
12  * channels for your use.
13  *
14  * This program is free software, distributed under the terms of
15  * the GNU General Public License Version 2. See the LICENSE file
16  * at the top of the source tree.
17  */
18 
19 /*! \file
20  *
21  * \brief IAX Firmware Support header file
22  */
23 
24 #ifndef _IAX2_FIRMWARE_H
25 #define _IAX2_FIRMWARE_H
26 
27 #include "parser.h"
28 
29 /*!
30  * \internal
31  * \brief Reload the list of available firmware.
32  *
33  * Searches the IAX firmware directory, adding new firmware that is available
34  * and removing firmware that is no longer available.
35  */
36 void iax_firmware_reload(void);
37 
38 /*!
39  * \internal
40  * \brief Unload all of the currently loaded firmware.
41  */
42 void iax_firmware_unload(void);
43 
44 /*!
45  * \internal
46  * \brief Determine the version number of the specified firmware.
47  *
48  * \param device_name The device name of the firmware for which we want the
49  * version.
50  * \param[out] version Pointer to a variable where the version number is
51  * stored upon return.
52  *
53  * \retval 1 on success
54  * \retval 0 on failure
55  */
56 int iax_firmware_get_version(const char *device_name,
57  uint16_t *version);
58 
59 /*!
60  * \internal
61  * \brief Add firmware related IEs to an IAX2 IE buffer.
62  *
63  * \param ie_data The IE buffer being appended to.
64  * \param device_name The name of the requested firmware.
65  * \param block_desc The requested firmware block identification.
66  *
67  * Search the list of loaded firmware for \c device_name and, if found, add the
68  * appropriate FWBLOCKDESC and FWBLOCKDATA IEs to the specified \c ie_data
69  * list.
70  *
71  * \retval 0 on success
72  * \retval non-zero on failure
73  */
74 int iax_firmware_append(struct iax_ie_data *ie_data,
75  const char *device_name, unsigned int block_desc);
76 
77 /*!
78  * \internal
79  * \brief Iterate over the list of currently loaded IAX firmware.
80  *
81  * \param prefix The prefix of the device to filter for, or \c NULL to visit
82  * all firmware records.
83  * \param callback A pointer to a function to call for each firmware record
84  * that is visited.
85  * \param user_data A pointer to user supplied data that will be passed to the
86  * \c callback function each time it is invoked.
87  *
88  * This function visits each of the elements in the IAX firmware list, calling
89  * the specfied \c callback for each element. Iteration continues until the end
90  * of the list is reached, or the \c callback returns non-zero.
91  *
92  * The \c callback function receives a pointer to the firmware header and the
93  * value of the \c user_data argument that was passed in, which may be \c NULL.
94  */
95 void iax_firmware_traverse(const char *prefix,
96  int (*callback)(struct ast_iax2_firmware_header *header, void *user_data),
97  void *user_data);
98 
99 #endif
Implementation of the IAX2 protocol.