firmware.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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. /*! \file
  19. *
  20. * \brief IAX Firmware Support header file
  21. */
  22. #ifndef _IAX2_FIRMWARE_H
  23. #define _IAX2_FIRMWARE_H
  24. #include "parser.h"
  25. /*!
  26. * \internal
  27. * \brief Reload the list of available firmware.
  28. *
  29. * Searches the IAX firmware directory, adding new firmware that is available
  30. * and removing firmware that is no longer available.
  31. *
  32. * \return Nothing
  33. */
  34. void iax_firmware_reload(void);
  35. /*!
  36. * \internal
  37. * \brief Unload all of the currently loaded firmware.
  38. *
  39. * return Nothing
  40. */
  41. void iax_firmware_unload(void);
  42. /*!
  43. * \internal
  44. * \brief Determine the version number of the specified firmware.
  45. *
  46. * \param device_name The device name of the firmware for which we want the
  47. * version.
  48. * \param[out] version Pointer to a variable where the version number is
  49. * stored upon return.
  50. *
  51. * \retval 1 on success
  52. * \retval 0 on failure
  53. */
  54. int iax_firmware_get_version(const char *device_name,
  55. uint16_t *version);
  56. /*!
  57. * \internal
  58. * \brief Add firwmare related IEs to an IAX2 IE buffer.
  59. *
  60. * \param ie_data The IE buffer being appended to.
  61. * \param device_name The name of the requested firmware.
  62. * \param block_desc The requested firmware block identification.
  63. *
  64. * Search the list of loaded firmware for \c device_name and, if found, add the
  65. * appropriate FWBLOCKDESC and FWBLOCKDATA IEs to the specified \c ie_data
  66. * list.
  67. *
  68. * \retval 0 on success
  69. * \retval non-zero on failure
  70. */
  71. int iax_firmware_append(struct iax_ie_data *ie_data,
  72. const char *device_name, unsigned int block_desc);
  73. /*!
  74. * \internal
  75. * \brief Iterate over the list of currently loaded IAX firmware.
  76. *
  77. * \param prefix The prefix of the device to filter for, or \c NULL to visit
  78. * all firmware records.
  79. * \param callback A pointer to a function to call for each firmware record
  80. * that is visited.
  81. * \param user_data A pointer to user supplied data that will be passed to the
  82. * \c callback function each time it is invoked.
  83. *
  84. * This function visits each of the elements in the IAX firmware list, calling
  85. * the specfied \c callback for each element. Iteration continues until the end
  86. * of the list is reached, or the \c callback returns non-zero.
  87. *
  88. * The \c callback function receives a pointer to the firmware header and the
  89. * value of the \c user_data argument that was passed in, which may be \c NULL.
  90. *
  91. * \return Nothing
  92. */
  93. void iax_firmware_traverse(const char *prefix,
  94. int (*callback)(struct ast_iax2_firmware_header *header, void *user_data),
  95. void *user_data);
  96. #endif