Asterisk - The Open Source Telephony Project
18.5.0
|
IAX Firmware Support. More...
#include "asterisk.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
#include <dirent.h>
#include <sys/mman.h>
#include <arpa/inet.h>
#include "asterisk/linkedlists.h"
#include "asterisk/md5.h"
#include "asterisk/paths.h"
#include "asterisk/utils.h"
#include "include/firmware.h"
Go to the source code of this file.
Data Structures | |
struct | firmwares |
struct | iax_firmware |
Macros | |
#define | IAX_FIRMWARE_SUBDIR "/firmware/iax" |
Functions | |
static void | destroy_firmware (struct iax_firmware *cur) |
int | iax_firmware_append (struct iax_ie_data *ied, const char *dev, unsigned int desc) |
int | iax_firmware_get_version (const char *dev, uint16_t *version) |
void | iax_firmware_reload (void) |
void | iax_firmware_traverse (const char *filter, int(*callback)(struct ast_iax2_firmware_header *header, void *data), void *data) |
void | iax_firmware_unload (void) |
static int | try_firmware (char *s) |
Variables | |
static struct firmwares | firmwares = { .first = NULL, .last = NULL, .lock = { PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP , NULL, {1, 0} } , } |
IAX Firmware Support.
Definition in file firmware.c.
#define IAX_FIRMWARE_SUBDIR "/firmware/iax" |
Definition at line 47 of file firmware.c.
Referenced by iax_firmware_reload().
|
static |
Definition at line 196 of file firmware.c.
References ast_free, ast_iax2_firmware_header::datalen, iax_firmware::fd, and iax_firmware::fwh.
Referenced by iax_firmware_reload(), and iax_firmware_unload().
int iax_firmware_append | ( | struct iax_ie_data * | ied, |
const char * | dev, | ||
unsigned int | desc | ||
) |
Definition at line 283 of file firmware.c.
References AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, ast_strlen_zero, bs, ast_iax2_firmware_header::data, ast_iax2_firmware_header::datalen, ast_iax2_firmware_header::devname, iax_firmware::fwh, iax_ie_append(), iax_ie_append_int(), iax_ie_append_raw(), IAX_IE_FWBLOCKDATA, IAX_IE_FWBLOCKDESC, and iax_firmware::list.
Referenced by socket_process_helper().
int iax_firmware_get_version | ( | const char * | dev, |
uint16_t * | version | ||
) |
Definition at line 263 of file firmware.c.
References AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, ast_strlen_zero, ast_iax2_firmware_header::devname, iax_firmware::fwh, iax_firmware::list, NULL, and ast_iax2_firmware_header::version.
Referenced by update_registry().
void iax_firmware_reload | ( | void | ) |
Definition at line 206 of file firmware.c.
References ast_config_AST_DATA_DIR, AST_LIST_LOCK, AST_LIST_REMOVE_CURRENT, AST_LIST_TRAVERSE, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, AST_LIST_UNLOCK, ast_log, ast_verb, iax_firmware::dead, destroy_firmware(), errno, IAX_FIRMWARE_SUBDIR, iax_firmware::list, LOG_WARNING, NULL, PATH_MAX, and try_firmware().
Referenced by load_module(), and reload_config().
void iax_firmware_traverse | ( | const char * | filter, |
int(*)(struct ast_iax2_firmware_header *header, void *data) | callback, | ||
void * | data | ||
) |
Definition at line 321 of file firmware.c.
References AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, ast_iax2_firmware_header::devname, iax_firmware::fwh, iax_firmware::list, and NULL.
Referenced by handle_cli_iax2_show_firmware().
void iax_firmware_unload | ( | void | ) |
Definition at line 250 of file firmware.c.
References AST_LIST_LOCK, AST_LIST_REMOVE_CURRENT, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, AST_LIST_UNLOCK, destroy_firmware(), iax_firmware::list, and NULL.
Referenced by __unload_module().
|
static |
Definition at line 60 of file firmware.c.
References ast_alloca, ast_calloc, AST_FILE_MODE, AST_LIST_INSERT_TAIL, AST_LIST_TRAVERSE, ast_log, ast_random(), ast_strlen_zero, iax_firmware::buf, ast_iax2_firmware_header::chksum, ast_iax2_firmware_header::data, ast_iax2_firmware_header::datalen, iax_firmware::dead, ast_iax2_firmware_header::devname, errno, iax_firmware::fd, iax_firmware::fwh, IAX_FIRMWARE_MAGIC, last, len(), iax_firmware::list, LOG_WARNING, ast_iax2_firmware_header::magic, MD5Final(), MD5Init(), MD5Update(), iax_firmware::mmaplen, NULL, and ast_iax2_firmware_header::version.
Referenced by iax_firmware_reload().