Asterisk - The Open Source Telephony Project  18.5.0
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 <[email protected]>
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  * \return Nothing
37  */
38 void iax_firmware_reload(void);
39 
40 /*!
41  * \internal
42  * \brief Unload all of the currently loaded firmware.
43  *
44  * return Nothing
45  */
46 void iax_firmware_unload(void);
47 
48 /*!
49  * \internal
50  * \brief Determine the version number of the specified firmware.
51  *
52  * \param device_name The device name of the firmware for which we want the
53  * version.
54  * \param[out] version Pointer to a variable where the version number is
55  * stored upon return.
56  *
57  * \retval 1 on success
58  * \retval 0 on failure
59  */
60 int iax_firmware_get_version(const char *device_name,
61  uint16_t *version);
62 
63 /*!
64  * \internal
65  * \brief Add firwmare related IEs to an IAX2 IE buffer.
66  *
67  * \param ie_data The IE buffer being appended to.
68  * \param device_name The name of the requested firmware.
69  * \param block_desc The requested firmware block identification.
70  *
71  * Search the list of loaded firmware for \c device_name and, if found, add the
72  * appropriate FWBLOCKDESC and FWBLOCKDATA IEs to the specified \c ie_data
73  * list.
74  *
75  * \retval 0 on success
76  * \retval non-zero on failure
77  */
78 int iax_firmware_append(struct iax_ie_data *ie_data,
79  const char *device_name, unsigned int block_desc);
80 
81 /*!
82  * \internal
83  * \brief Iterate over the list of currently loaded IAX firmware.
84  *
85  * \param prefix The prefix of the device to filter for, or \c NULL to visit
86  * all firmware records.
87  * \param callback A pointer to a function to call for each firmware record
88  * that is visited.
89  * \param user_data A pointer to user supplied data that will be passed to the
90  * \c callback function each time it is invoked.
91  *
92  * This function visits each of the elements in the IAX firmware list, calling
93  * the specfied \c callback for each element. Iteration continues until the end
94  * of the list is reached, or the \c callback returns non-zero.
95  *
96  * The \c callback function receives a pointer to the firmware header and the
97  * value of the \c user_data argument that was passed in, which may be \c NULL.
98  *
99  * \return Nothing
100  */
101 void iax_firmware_traverse(const char *prefix,
102  int (*callback)(struct ast_iax2_firmware_header *header, void *user_data),
103  void *user_data);
104 
105 #endif
void iax_firmware_reload(void)
Definition: firmware.c:206
void iax_firmware_traverse(const char *prefix, int(*callback)(struct ast_iax2_firmware_header *header, void *user_data), void *user_data)
Implementation of the IAX2 protocol.
int iax_firmware_append(struct iax_ie_data *ie_data, const char *device_name, unsigned int block_desc)
Definition: firmware.c:283
int iax_firmware_get_version(const char *device_name, uint16_t *version)
Definition: firmware.c:263
static char version[AST_MAX_EXTENSION]
Definition: chan_ooh323.c:391
void iax_firmware_unload(void)
Definition: firmware.c:250
static char prefix[MAX_PREFIX]
Definition: http.c:141