47#define IAX_FIRMWARE_SUBDIR "/firmware/iax" 
   64    int ifd, 
fd, res, 
len, chunk;
 
   67    unsigned char sum[16], 
buf[1024];
 
   72    last = strrchr(s, 
'/');
 
   78    snprintf(s2, strlen(s) + 100, 
"/var/tmp/%s-%ld", 
last, 
ast_random());
 
   80    if (stat(s, &stbuf) < 0) {
 
   86    if (S_ISDIR(stbuf.st_mode))
 
   88    ifd = open(s, O_RDONLY);
 
  106        if (chunk > 
sizeof(
buf))
 
  108        res = read(ifd, 
buf, chunk);
 
  115        res = write(fd, 
buf, chunk);
 
  126    lseek(fd, 0, SEEK_SET);
 
  127    if ((res = read(fd, &fwh2, 
sizeof(fwh2))) != 
sizeof(fwh2)) {
 
  137    if (ntohl(fwh2.
datalen) != (stbuf.st_size - 
sizeof(fwh2))) {
 
  148    if (fwh == MAP_FAILED) {
 
  156    if (memcmp(sum, fwh->
chksum, 
sizeof(sum))) {
 
  158        munmap((
void*)fwh, stbuf.st_size);
 
  171            munmap((
void*)fwh, stbuf.st_size);
 
  177    if (!cur && ((cur = 
ast_calloc(1, 
sizeof(*cur))))) {
 
 
  224        while((de = readdir(fwd))) {
 
  225            if (de->d_name[0] != 
'.') {
 
  226                snprintf(fn, 
sizeof(fn), 
"%s%s/%s",
 
  229                    ast_verb(2, 
"Loaded firmware '%s'\n", de->d_name);
 
 
  272        if (!strcmp(dev, (
const char *) cur->
fwh->
devname)) {
 
 
  286    unsigned int bs = 
desc & 0xff;
 
  287    unsigned int start = (
desc >> 8) & 0xffffff;
 
  298        if (strcmp(dev, (
const char *) cur->
fwh->
devname))
 
 
struct sla_ringing_trunk * last
Asterisk main include file. File version handling, generic pbx functions.
#define ast_alloca(size)
call __builtin_alloca to ensure we get gcc builtin semantics
#define ast_calloc(num, len)
A wrapper for calloc()
static char version[AST_MAX_EXTENSION]
static struct ast_channel * callback(struct ast_channelstorage_instance *driver, ao2_callback_data_fn *cb_fn, void *arg, void *data, int ao2_flags)
static int try_firmware(char *s)
#define IAX_FIRMWARE_SUBDIR
int iax_firmware_get_version(const char *dev, uint16_t *version)
void iax_firmware_reload(void)
void iax_firmware_unload(void)
static void destroy_firmware(struct iax_firmware *cur)
int iax_firmware_append(struct iax_ie_data *ied, const char *dev, unsigned int desc)
void iax_firmware_traverse(const char *filter, int(*callback)(struct ast_iax2_firmware_header *header, void *data), void *data)
IAX Firmware Support header file.
static int md5(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
static int filter(struct ast_channel *chan, const char *cmd, char *parse, char *buf, size_t len)
#define IAX_FIRMWARE_MAGIC
#define IAX_IE_FWBLOCKDATA
#define IAX_IE_FWBLOCKDESC
#define ast_verb(level,...)
A set of macros to manage forward-linked lists.
#define AST_LIST_HEAD_STATIC(name, type)
Defines a structure to be used to hold a list of specified type, statically initialized.
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
#define AST_LIST_INSERT_TAIL(head, elm, field)
Appends a list entry to the tail of a list.
#define AST_LIST_ENTRY(type)
Declare a forward link structure inside a list entry.
#define AST_LIST_TRAVERSE_SAFE_END
Closes a safe loop traversal block.
#define AST_LIST_LOCK(head)
Locks a list.
#define AST_LIST_TRAVERSE_SAFE_BEGIN(head, var, field)
Loops safely over (traverses) the entries in a list.
#define AST_LIST_REMOVE_CURRENT(field)
Removes the current entry from a list during a traversal.
#define AST_LIST_UNLOCK(head)
Attempts to unlock a list.
void MD5Update(struct MD5Context *context, unsigned char const *buf, unsigned len)
void MD5Init(struct MD5Context *context)
void MD5Final(unsigned char digest[MD5_DIGEST_LENGTH], struct MD5Context *context)
int iax_ie_append(struct iax_ie_data *ied, unsigned char ie)
int iax_ie_append_raw(struct iax_ie_data *ied, unsigned char ie, const void *data, int datalen)
int iax_ie_append_int(struct iax_ie_data *ied, unsigned char ie, unsigned int value)
Asterisk file paths, configured in asterisk.conf.
const char * ast_config_AST_DATA_DIR
static force_inline int attribute_pure ast_strlen_zero(const char *s)
struct iax_firmware::@147 list
struct ast_iax2_firmware_header * fwh
long int ast_random(void)