}
-static long get_now(struct ast_jb *jb, struct timeval *tv)
+static long get_now(struct ast_jb *jb, struct timeval *when)
{
struct timeval now;
- if (!tv) {
- tv = &now;
- gettimeofday(tv, NULL);
+ if (!when) {
+ when = &now;
+ gettimeofday(when, NULL);
}
- return ast_tvdiff_ms(*tv, jb->timebase);
+ return ast_tvdiff_ms(*when, jb->timebase);
}
{
struct ast_ha *start = original;
struct ast_ha *ret = NULL;
- struct ast_ha *link, *prev = NULL;
+ struct ast_ha *current, *prev = NULL;
while (start) {
- link = ast_duplicate_ha(start); /* Create copy of this object */
+ current = ast_duplicate_ha(start); /* Create copy of this object */
if (prev)
- prev->next = link; /* Link previous to this object */
+ prev->next = current; /* Link previous to this object */
if (!ret)
- ret = link; /* Save starting point */
+ ret = current; /* Save starting point */
start = start->next; /* Go to next object */
- prev = link; /* Save pointer to this object */
+ prev = current; /* Save pointer to this object */
}
return ret; /* Return start of list */
}
int ast_control_streamfile(struct ast_channel *chan, const char *file,
const char *fwd, const char *rev,
- const char *stop, const char *pause,
+ const char *stop, const char *suspend,
const char *restart, int skipms, long *offsetms)
{
char *breaks = NULL;
if (stop)
blen += strlen(stop);
- if (pause)
- blen += strlen(pause);
+ if (suspend)
+ blen += strlen(suspend);
if (restart)
blen += strlen(restart);
breaks[0] = '\0';
if (stop)
strcat(breaks, stop);
- if (pause)
- strcat(breaks, pause);
+ if (suspend)
+ strcat(breaks, suspend);
if (restart)
strcat(breaks, restart);
}
continue;
}
- if (pause && strchr(pause, res)) {
+ if (suspend && strchr(suspend, res)) {
pause_restart_point = ast_tellstream(chan->stream);
for (;;) {
ast_stopstream(chan);
res = ast_waitfordigit(chan, 1000);
if (!res)
continue;
- else if (res == -1 || strchr(pause, res) || (stop && strchr(stop, res)))
+ else if (res == -1 || strchr(suspend, res) || (stop && strchr(stop, res)))
break;
}
- if (res == *pause) {
+ if (res == *suspend) {
res = 0;
continue;
}
ast_cli(a->fd, "%6s %8s %10s %12s %12s %s\n", "ID", "Scale", "Events",
"Value", "Average", "Name");
for (i = min; i < max; i++) {
- struct profile_entry *e = &prof_data->e[i];
+ struct profile_entry *entry = &prof_data->e[i];
if (!search || strstr(prof_data->e[i].name, search))
ast_cli(a->fd, "%6d: [%8ld] %10ld %12lld %12lld %s\n",
i,
- (long)e->scale,
- (long)e->events, (long long)e->value,
- (long long)(e->events ? e->value / e->events : e->value),
- e->name);
+ (long)entry->scale,
+ (long)entry->events, (long long)entry->value,
+ (long long)(entry->events ? entry->value / entry->events : entry->value),
+ entry->name);
}
return CLI_SUCCESS;
}
}
/*! \brief NULL handler so we can collect the child exit status */
-static void null_sig_handler(int signal)
+static void null_sig_handler(int sig)
{
}
AST_RWLIST_UNLOCK(&atexits);
}
-static void quit_handler(int num, int nice, int safeshutdown, int restart)
+static void quit_handler(int num, int niceness, int safeshutdown, int restart)
{
char filename[80] = "";
time_t s,e;
ast_cdr_engine_term();
if (safeshutdown) {
shuttingdown = 1;
- if (!nice) {
+ if (!niceness) {
/* Begin shutdown routine, hanging up active channels */
ast_begin_shutdown(1);
if (option_verbose && ast_opt_console)
usleep(100000);
}
} else {
- if (nice < 2)
+ if (niceness < 2)
ast_begin_shutdown(0);
if (option_verbose && ast_opt_console)
ast_verbose("Waiting for inactivity to perform %s...\n", restart ? "restart" : "halt");
return;
}
- if (nice)
+ if (niceness)
ast_module_shutdown();
}
if (ast_opt_console || ast_opt_remote) {
#endif /* ! LOW_MEMORY */
};
-static int ast_el_read_char(EditLine *el, char *cp)
+static int ast_el_read_char(EditLine *editline, char *cp)
{
int num_read = 0;
int lastpos = 0;
static struct ast_str *prompt = NULL;
-static char *cli_prompt(EditLine *el)
+static char *cli_prompt(EditLine *editline)
{
char tmp[100];
char *pfmt;
}
-static char *cli_complete(EditLine *el, int ch)
+static char *cli_complete(EditLine *editline, int ch)
{
int len = 0;
char *ptr;
char buf[2048];
int res;
- LineInfo *lf = (LineInfo *)el_line(el);
+ LineInfo *lf = (LineInfo *)el_line(editline);
*(char *)lf->cursor = '\0';
ptr = (char *)lf->cursor;
int matches_num, maxlen, match_len;
if (matches[0][0] != '\0') {
- el_deletestr(el, (int) len);
- el_insertstr(el, matches[0]);
+ el_deletestr(editline, (int) len);
+ el_insertstr(editline, matches[0]);
retval = CC_REFRESH;
}
if (nummatches == 1) {
/* Found an exact match */
- el_insertstr(el, " ");
+ el_insertstr(editline, " ");
retval = CC_REFRESH;
} else {
/* Must be more than one match */
ast_cli_display_match_list(matches, nummatches, maxlen);
retval = CC_REDISPLAY;
} else {
- el_insertstr(el," ");
+ el_insertstr(editline," ");
retval = CC_REFRESH;
}
}
char *cpid;
char *version;
int pid;
- char tmp[80];
char *stringp = NULL;
char *ebuf;
else
pid = -1;
if (!data) {
+ char tmp[80];
snprintf(tmp, sizeof(tmp), "core set verbose atleast %d", option_verbose);
fdsend(ast_consock, tmp);
snprintf(tmp, sizeof(tmp), "core set debug atleast %d", option_debug);
fds.events = POLLIN;
fds.revents = 0;
while (poll(&fds, 1, 500) > 0) {
- char buf[512] = "", *curline = buf, *nextline;
+ char buffer[512] = "", *curline = buffer, *nextline;
int not_written = 1;
- if (read(ast_consock, buf, sizeof(buf) - 1) <= 0) {
+ if (read(ast_consock, buffer, sizeof(buffer) - 1) <= 0) {
break;
}
ebuf[strlen(ebuf)-1] = '\0';
if (!remoteconsolehandler(ebuf)) {
/* Strip preamble from output */
- char *tmp;
- for (tmp = ebuf; *tmp; tmp++) {
- if (*tmp == 127) {
- memmove(tmp, tmp + 1, strlen(tmp));
- tmp--;
+ char *temp;
+ for (temp = ebuf; *temp; temp++) {
+ if (*temp == 127) {
+ memmove(temp, temp + 1, strlen(temp));
+ temp--;
}
}
res = write(ast_consock, ebuf, strlen(ebuf) + 1);
static void *canary_thread(void *unused)
{
struct stat canary_stat;
- struct timeval tv;
+ struct timeval now;
/* Give the canary time to sing */
sleep(120);
for (;;) {
stat(canary_filename, &canary_stat);
- tv = ast_tvnow();
- if (tv.tv_sec > canary_stat.st_mtime + 60) {
+ now = ast_tvnow();
+ if (now.tv_sec > canary_stat.st_mtime + 60) {
ast_log(LOG_WARNING, "The canary is no more. He has ceased to be! He's expired and gone to meet his maker! He's a stiff! Bereft of life, he rests in peace. His metabolic processes are now history! He's off the twig! He's kicked the bucket. He's shuffled off his mortal coil, run down the curtain, and joined the bleeding choir invisible!! THIS is an EX-CANARY. (Reducing priority)\n");
ast_set_priority(0);
pthread_exit(NULL);
_ao2_callback(c, OBJ_UNLINK, cd_cb, NULL);
for (i = 0; i < c->n_buckets; i++) {
- struct bucket_list *cur;
+ struct bucket_list *current;
- while ((cur = AST_LIST_REMOVE_HEAD(&c->buckets[i], entry))) {
- ast_free(cur);
+ while ((current = AST_LIST_REMOVE_HEAD(&c->buckets[i], entry))) {
+ ast_free(current);
}
}
_ao2_callback_debug(c, OBJ_UNLINK, cd_cb_debug, NULL, "container_destruct_debug called", __FILE__, __LINE__, __PRETTY_FUNCTION__);
for (i = 0; i < c->n_buckets; i++) {
- struct bucket_list *cur;
+ struct bucket_list *current;
- while ((cur = AST_LIST_REMOVE_HEAD(&c->buckets[i], entry))) {
- ast_free(cur);
+ while ((current = AST_LIST_REMOVE_HEAD(&c->buckets[i], entry))) {
+ ast_free(current);
}
}
{
struct ast_slinfactory *factory = (direction == AST_AUDIOHOOK_DIRECTION_READ ? &audiohook->read_factory : &audiohook->write_factory);
struct ast_slinfactory *other_factory = (direction == AST_AUDIOHOOK_DIRECTION_READ ? &audiohook->write_factory : &audiohook->read_factory);
- struct timeval *time = (direction == AST_AUDIOHOOK_DIRECTION_READ ? &audiohook->read_time : &audiohook->write_time), previous_time = *time;
+ struct timeval *rwtime = (direction == AST_AUDIOHOOK_DIRECTION_READ ? &audiohook->read_time : &audiohook->write_time), previous_time = *rwtime;
/* Update last feeding time to be current */
- *time = ast_tvnow();
+ *rwtime = ast_tvnow();
/* If we are using a sync trigger and this factory suddenly got audio fed in after a lapse, then flush both factories to ensure they remain in sync */
- if (ast_test_flag(audiohook, AST_AUDIOHOOK_TRIGGER_SYNC) && ast_slinfactory_available(other_factory) && (ast_tvdiff_ms(*time, previous_time) > (ast_slinfactory_available(other_factory) / 8))) {
+ if (ast_test_flag(audiohook, AST_AUDIOHOOK_TRIGGER_SYNC) && ast_slinfactory_available(other_factory) && (ast_tvdiff_ms(*rwtime, previous_time) > (ast_slinfactory_available(other_factory) / 8))) {
if (option_debug)
ast_log(LOG_DEBUG, "Flushing audiohook %p so it remains in sync\n", audiohook);
ast_slinfactory_flush(factory);
*/
void ast_audiohook_trigger_wait(struct ast_audiohook *audiohook)
{
- struct timeval tv;
+ struct timeval wait;
struct timespec ts;
- tv = ast_tvadd(ast_tvnow(), ast_samp2tv(50000, 1000));
- ts.tv_sec = tv.tv_sec;
- ts.tv_nsec = tv.tv_usec * 1000;
+ wait = ast_tvadd(ast_tvnow(), ast_samp2tv(50000, 1000));
+ ts.tv_sec = wait.tv_sec;
+ ts.tv_nsec = wait.tv_usec * 1000;
ast_cond_timedwait(&audiohook->trigger, &audiohook->lock, &ts);
static int callerid_genmsg(char *msg, int size, const char *number, const char *name, int flags)
{
- struct timeval tv = ast_tvnow();
+ struct timeval now = ast_tvnow();
struct ast_tm tm;
char *ptr;
int res;
int i, x;
/* Get the time */
- ast_localtime(&tv, &tm, NULL);
+ ast_localtime(&now, &tm, NULL);
ptr = msg;
return NULL;
}
-static void cdr_get_tv(struct timeval tv, const char *fmt, char *buf, int bufsize)
+static void cdr_get_tv(struct timeval when, const char *fmt, char *buf, int bufsize)
{
if (fmt == NULL) { /* raw mode */
- snprintf(buf, bufsize, "%ld.%06ld", (long)tv.tv_sec, (long)tv.tv_usec);
+ snprintf(buf, bufsize, "%ld.%06ld", (long)when.tv_sec, (long)when.tv_usec);
} else {
- if (tv.tv_sec) {
+ if (when.tv_sec) {
struct ast_tm tm;
- ast_localtime(&tv, &tm, NULL);
+ ast_localtime(&when, &tm, NULL);
ast_strftime(buf, bufsize, fmt, &tm);
}
}
void ast_cdr_reset(struct ast_cdr *cdr, struct ast_flags *_flags)
{
- struct ast_cdr *dup;
+ struct ast_cdr *duplicate;
struct ast_flags flags = { 0 };
if (_flags)
if (ast_test_flag(&flags, AST_CDR_FLAG_LOCKED) || !ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
if (ast_test_flag(&flags, AST_CDR_FLAG_POSTED)) {
ast_cdr_end(cdr);
- if ((dup = ast_cdr_dup(cdr))) {
- ast_cdr_detach(dup);
+ if ((duplicate = ast_cdr_dup(cdr))) {
+ ast_cdr_detach(duplicate);
}
ast_set_flag(cdr, AST_CDR_FLAG_POSTED);
}
return NULL;
}
-void ast_cdr_submit_batch(int shutdown)
+void ast_cdr_submit_batch(int do_shutdown)
{
struct ast_cdr_batch_item *oldbatchitems = NULL;
pthread_t batch_post_thread = AST_PTHREADT_NULL;
/* if configured, spawn a new thread to post these CDRs,
also try to save as much as possible if we are shutting down safely */
- if (batchscheduleronly || shutdown) {
+ if (batchscheduleronly || do_shutdown) {
ast_debug(1, "CDR single-threaded batch processing begins now\n");
do_batch_backend_process(oldbatchitems);
} else {
void ast_channel_setwhentohangup(struct ast_channel *chan, time_t offset)
{
- struct timeval tv = { offset, };
- ast_channel_setwhentohangup_tv(chan, tv);
+ struct timeval when = { offset, };
+ ast_channel_setwhentohangup_tv(chan, when);
}
/*! \brief Compare a offset with when to hangup channel */
return res;
}
-static void free_translation(struct ast_channel *clone)
+static void free_translation(struct ast_channel *clonechan)
{
- if (clone->writetrans)
- ast_translator_free_path(clone->writetrans);
- if (clone->readtrans)
- ast_translator_free_path(clone->readtrans);
- clone->writetrans = NULL;
- clone->readtrans = NULL;
- clone->rawwriteformat = clone->nativeformats;
- clone->rawreadformat = clone->nativeformats;
+ if (clonechan->writetrans)
+ ast_translator_free_path(clonechan->writetrans);
+ if (clonechan->readtrans)
+ ast_translator_free_path(clonechan->readtrans);
+ clonechan->writetrans = NULL;
+ clonechan->readtrans = NULL;
+ clonechan->rawwriteformat = clonechan->nativeformats;
+ clonechan->rawreadformat = clonechan->nativeformats;
}
/*! \brief Hangup a channel */
return rc;
}
-int ast_channel_masquerade(struct ast_channel *original, struct ast_channel *clone)
+int ast_channel_masquerade(struct ast_channel *original, struct ast_channel *clonechan)
{
int res = -1;
struct ast_channel *final_orig, *final_clone, *base;
retrymasq:
final_orig = original;
- final_clone = clone;
+ final_clone = clonechan;
ast_channel_lock(original);
- while (ast_channel_trylock(clone)) {
+ while (ast_channel_trylock(clonechan)) {
ast_channel_unlock(original);
usleep(1);
ast_channel_lock(original);
if (original->_bridge && (original->_bridge != ast_bridged_channel(original)) && (original->_bridge->_bridge != original))
final_orig = original->_bridge;
- if (clone->_bridge && (clone->_bridge != ast_bridged_channel(clone)) && (clone->_bridge->_bridge != clone))
- final_clone = clone->_bridge;
+ if (clonechan->_bridge && (clonechan->_bridge != ast_bridged_channel(clonechan)) && (clonechan->_bridge->_bridge != clonechan))
+ final_clone = clonechan->_bridge;
if (final_clone->tech->get_base_channel && (base = final_clone->tech->get_base_channel(final_clone))) {
final_clone = base;
}
- if ((final_orig != original) || (final_clone != clone)) {
+ if ((final_orig != original) || (final_clone != clonechan)) {
/* Lots and lots of deadlock avoidance. The main one we're competing with
* is ast_write(), which locks channels recursively, when working with a
* proxy channel. */
if (ast_channel_trylock(final_orig)) {
- ast_channel_unlock(clone);
+ ast_channel_unlock(clonechan);
ast_channel_unlock(original);
goto retrymasq;
}
if (ast_channel_trylock(final_clone)) {
ast_channel_unlock(final_orig);
- ast_channel_unlock(clone);
+ ast_channel_unlock(clonechan);
ast_channel_unlock(original);
goto retrymasq;
}
- ast_channel_unlock(clone);
+ ast_channel_unlock(clonechan);
ast_channel_unlock(original);
original = final_orig;
- clone = final_clone;
+ clonechan = final_clone;
}
- if (original == clone) {
+ if (original == clonechan) {
ast_log(LOG_WARNING, "Can't masquerade channel '%s' into itself!\n", original->name);
- ast_channel_unlock(clone);
+ ast_channel_unlock(clonechan);
ast_channel_unlock(original);
return -1;
}
ast_debug(1, "Planning to masquerade channel %s into the structure of %s\n",
- clone->name, original->name);
+ clonechan->name, original->name);
if (original->masq) {
ast_log(LOG_WARNING, "%s is already going to masquerade as %s\n",
original->masq->name, original->name);
- } else if (clone->masqr) {
+ } else if (clonechan->masqr) {
ast_log(LOG_WARNING, "%s is already going to masquerade as %s\n",
- clone->name, clone->masqr->name);
+ clonechan->name, clonechan->masqr->name);
} else {
- original->masq = clone;
- clone->masqr = original;
+ original->masq = clonechan;
+ clonechan->masqr = original;
ast_queue_frame(original, &ast_null_frame);
- ast_queue_frame(clone, &ast_null_frame);
- ast_debug(1, "Done planning to masquerade channel %s into the structure of %s\n", clone->name, original->name);
+ ast_queue_frame(clonechan, &ast_null_frame);
+ ast_debug(1, "Done planning to masquerade channel %s into the structure of %s\n", clonechan->name, original->name);
res = 0;
}
- ast_channel_unlock(clone);
+ ast_channel_unlock(clonechan);
ast_channel_unlock(original);
return res;
\note Assumes locks will be in place on both channels when called.
*/
-static void clone_variables(struct ast_channel *original, struct ast_channel *clone)
+static void clone_variables(struct ast_channel *original, struct ast_channel *clonechan)
{
struct ast_var_t *current, *newvar;
/* Append variables from clone channel into original channel */
/* XXX Is this always correct? We have to in order to keep MACROS working XXX */
- if (AST_LIST_FIRST(&clone->varshead))
- AST_LIST_APPEND_LIST(&original->varshead, &clone->varshead, entries);
+ if (AST_LIST_FIRST(&clonechan->varshead))
+ AST_LIST_APPEND_LIST(&original->varshead, &clonechan->varshead, entries);
/* then, dup the varshead list into the clone */
AST_LIST_TRAVERSE(&original->varshead, current, entries) {
newvar = ast_var_assign(current->name, current->value);
if (newvar)
- AST_LIST_INSERT_TAIL(&clone->varshead, newvar, entries);
+ AST_LIST_INSERT_TAIL(&clonechan->varshead, newvar, entries);
}
}
int x,i;
int res=0;
int origstate;
- struct ast_frame *cur;
+ struct ast_frame *current;
const struct ast_channel_tech *t;
void *t_pvt;
struct ast_callerid tmpcid;
- struct ast_channel *clone = original->masq;
+ struct ast_channel *clonechan = original->masq;
struct ast_cdr *cdr;
int rformat = original->readformat;
int wformat = original->writeformat;
char zombn[AST_CHANNEL_NAME];
ast_debug(4, "Actually Masquerading %s(%d) into the structure of %s(%d)\n",
- clone->name, clone->_state, original->name, original->_state);
+ clonechan->name, clonechan->_state, original->name, original->_state);
manager_event(EVENT_FLAG_CALL, "Masquerade", "Clone: %s\r\nCloneState: %s\r\nOriginal: %s\r\nOriginalState: %s\r\n",
- clone->name, ast_state2str(clone->_state), original->name, ast_state2str(original->_state));
+ clonechan->name, ast_state2str(clonechan->_state), original->name, ast_state2str(original->_state));
/* XXX This is a seriously wacked out operation. We're essentially putting the guts of
the clone channel into the original channel. Start by killing off the original
while the features are nice, the cost is very high in terms of pure nastiness. XXX */
/* We need the clone's lock, too */
- ast_channel_lock(clone);
+ ast_channel_lock(clonechan);
- ast_debug(2, "Got clone lock for masquerade on '%s' at %p\n", clone->name, &clone->lock_dont_use);
+ ast_debug(2, "Got clone lock for masquerade on '%s' at %p\n", clonechan->name, &clonechan->lock_dont_use);
/* Having remembered the original read/write formats, we turn off any translation on either
one */
- free_translation(clone);
+ free_translation(clonechan);
free_translation(original);
/* Unlink the masquerade */
original->masq = NULL;
- clone->masqr = NULL;
+ clonechan->masqr = NULL;
/* Save the original name */
ast_copy_string(orig, original->name, sizeof(orig));
/* Save the new name */
- ast_copy_string(newn, clone->name, sizeof(newn));
+ ast_copy_string(newn, clonechan->name, sizeof(newn));
/* Create the masq name */
snprintf(masqn, sizeof(masqn), "%s<MASQ>", newn);
ast_string_field_set(original, name, newn);
/* Mangle the name of the clone channel */
- ast_string_field_set(clone, name, masqn);
+ ast_string_field_set(clonechan, name, masqn);
/* Notify any managers of the change, first the masq then the other */
- manager_event(EVENT_FLAG_CALL, "Rename", "Channel: %s\r\nNewname: %s\r\nUniqueid: %s\r\n", newn, masqn, clone->uniqueid);
+ manager_event(EVENT_FLAG_CALL, "Rename", "Channel: %s\r\nNewname: %s\r\nUniqueid: %s\r\n", newn, masqn, clonechan->uniqueid);
manager_event(EVENT_FLAG_CALL, "Rename", "Channel: %s\r\nNewname: %s\r\nUniqueid: %s\r\n", orig, newn, original->uniqueid);
/* Swap the technologies */
t = original->tech;
- original->tech = clone->tech;
- clone->tech = t;
+ original->tech = clonechan->tech;
+ clonechan->tech = t;
/* Swap the cdrs */
cdr = original->cdr;
- original->cdr = clone->cdr;
- clone->cdr = cdr;
+ original->cdr = clonechan->cdr;
+ clonechan->cdr = cdr;
t_pvt = original->tech_pvt;
- original->tech_pvt = clone->tech_pvt;
- clone->tech_pvt = t_pvt;
+ original->tech_pvt = clonechan->tech_pvt;
+ clonechan->tech_pvt = t_pvt;
/* Swap the alertpipes */
for (i = 0; i < 2; i++) {
x = original->alertpipe[i];
- original->alertpipe[i] = clone->alertpipe[i];
- clone->alertpipe[i] = x;
+ original->alertpipe[i] = clonechan->alertpipe[i];
+ clonechan->alertpipe[i] = x;
}
/*
AST_LIST_HEAD_SET_NOLOCK(&tmp_readq, NULL);
AST_LIST_APPEND_LIST(&tmp_readq, &original->readq, frame_list);
- AST_LIST_APPEND_LIST(&original->readq, &clone->readq, frame_list);
+ AST_LIST_APPEND_LIST(&original->readq, &clonechan->readq, frame_list);
- while ((cur = AST_LIST_REMOVE_HEAD(&tmp_readq, frame_list))) {
- AST_LIST_INSERT_TAIL(&original->readq, cur, frame_list);
+ while ((current = AST_LIST_REMOVE_HEAD(&tmp_readq, frame_list))) {
+ AST_LIST_INSERT_TAIL(&original->readq, current, frame_list);
if (original->alertpipe[1] > -1) {
int poke = 0;
write(original->alertpipe[1], &poke, sizeof(poke));
/* Swap the raw formats */
x = original->rawreadformat;
- original->rawreadformat = clone->rawreadformat;
- clone->rawreadformat = x;
+ original->rawreadformat = clonechan->rawreadformat;
+ clonechan->rawreadformat = x;
x = original->rawwriteformat;
- original->rawwriteformat = clone->rawwriteformat;
- clone->rawwriteformat = x;
+ original->rawwriteformat = clonechan->rawwriteformat;
+ clonechan->rawwriteformat = x;
- clone->_softhangup = AST_SOFTHANGUP_DEV;
+ clonechan->_softhangup = AST_SOFTHANGUP_DEV;
/* And of course, so does our current state. Note we need not
call ast_setstate since the event manager doesn't really consider
these separate. We do this early so that the clone has the proper
state of the original channel. */
origstate = original->_state;
- original->_state = clone->_state;
- clone->_state = origstate;
+ original->_state = clonechan->_state;
+ clonechan->_state = origstate;
- if (clone->tech->fixup){
- res = clone->tech->fixup(original, clone);
+ if (clonechan->tech->fixup){
+ res = clonechan->tech->fixup(original, clonechan);
if (res)
- ast_log(LOG_WARNING, "Fixup failed on channel %s, strange things may happen.\n", clone->name);
+ ast_log(LOG_WARNING, "Fixup failed on channel %s, strange things may happen.\n", clonechan->name);
}
/* Start by disconnecting the original's physical side */
- if (clone->tech->hangup)
- res = clone->tech->hangup(clone);
+ if (clonechan->tech->hangup)
+ res = clonechan->tech->hangup(clonechan);
if (res) {
ast_log(LOG_WARNING, "Hangup failed! Strange things may happen!\n");
- ast_channel_unlock(clone);
+ ast_channel_unlock(clonechan);
return -1;
}
snprintf(zombn, sizeof(zombn), "%s<ZOMBIE>", orig);
/* Mangle the name of the clone channel */
- ast_string_field_set(clone, name, zombn);
- manager_event(EVENT_FLAG_CALL, "Rename", "Channel: %s\r\nNewname: %s\r\nUniqueid: %s\r\n", masqn, zombn, clone->uniqueid);
+ ast_string_field_set(clonechan, name, zombn);
+ manager_event(EVENT_FLAG_CALL, "Rename", "Channel: %s\r\nNewname: %s\r\nUniqueid: %s\r\n", masqn, zombn, clonechan->uniqueid);
/* Update the type. */
t_pvt = original->monitor;
- original->monitor = clone->monitor;
- clone->monitor = t_pvt;
+ original->monitor = clonechan->monitor;
+ clonechan->monitor = t_pvt;
/* Keep the same language. */
- ast_string_field_set(original, language, clone->language);
+ ast_string_field_set(original, language, clonechan->language);
/* Copy the FD's other than the generator fd */
for (x = 0; x < AST_MAX_FDS; x++) {
if (x != AST_GENERATOR_FD)
- ast_channel_set_fd(original, x, clone->fds[x]);
+ ast_channel_set_fd(original, x, clonechan->fds[x]);
}
- ast_app_group_update(clone, original);
+ ast_app_group_update(clonechan, original);
/* Move data stores over */
- if (AST_LIST_FIRST(&clone->datastores)) {
+ if (AST_LIST_FIRST(&clonechan->datastores)) {
struct ast_datastore *ds;
- AST_LIST_APPEND_LIST(&original->datastores, &clone->datastores, entry);
+ AST_LIST_APPEND_LIST(&original->datastores, &clonechan->datastores, entry);
AST_LIST_TRAVERSE(&original->datastores, ds, entry) {
if (ds->info->chan_fixup)
- ds->info->chan_fixup(ds->data, clone, original);
+ ds->info->chan_fixup(ds->data, clonechan, original);
}
}
- clone_variables(original, clone);
+ clone_variables(original, clonechan);
/* Presense of ADSI capable CPE follows clone */
- original->adsicpe = clone->adsicpe;
+ original->adsicpe = clonechan->adsicpe;
/* Bridge remains the same */
/* CDR fields remain the same */
/* XXX What about blocking, softhangup, blocker, and lock and blockproc? XXX */
/* Application and data remain the same */
/* Clone exception becomes real one, as with fdno */
- ast_copy_flags(original, clone, AST_FLAG_EXCEPTION);
- original->fdno = clone->fdno;
+ ast_copy_flags(original, clonechan, AST_FLAG_EXCEPTION);
+ original->fdno = clonechan->fdno;
/* Schedule context remains the same */
/* Stream stuff stays the same */
/* Keep the original state. The fixup code will need to work with it most likely */
/* Just swap the whole structures, nevermind the allocations, they'll work themselves
out. */
tmpcid = original->cid;
- original->cid = clone->cid;
- clone->cid = tmpcid;
+ original->cid = clonechan->cid;
+ clonechan->cid = tmpcid;
/* Restore original timing file descriptor */
ast_channel_set_fd(original, AST_TIMING_FD, original->timingfd);
/* Our native formats are different now */
- original->nativeformats = clone->nativeformats;
+ original->nativeformats = clonechan->nativeformats;
/* Context, extension, priority, app data, jump table, remain the same */
/* pvt switches. pbx stays the same, as does next */
ast_set_read_format(original, rformat);
/* Copy the music class */
- ast_string_field_set(original, musicclass, clone->musicclass);
+ ast_string_field_set(original, musicclass, clonechan->musicclass);
ast_debug(1, "Putting channel %s in %d/%d formats\n", original->name, wformat, rformat);
/* Okay. Last thing is to let the channel driver know about all this mess, so he
can fix up everything as best as possible */
if (original->tech->fixup) {
- res = original->tech->fixup(clone, original);
+ res = original->tech->fixup(clonechan, original);
if (res) {
ast_log(LOG_WARNING, "Channel for type '%s' could not fixup channel %s\n",
original->tech->type, original->name);
- ast_channel_unlock(clone);
+ ast_channel_unlock(clonechan);
return -1;
}
} else
/* Now, at this point, the "clone" channel is totally F'd up. We mark it as
a zombie so nothing tries to touch it. If it's already been marked as a
zombie, then free it now (since it already is considered invalid). */
- if (ast_test_flag(clone, AST_FLAG_ZOMBIE)) {
- ast_debug(1, "Destroying channel clone '%s'\n", clone->name);
- ast_channel_unlock(clone);
+ if (ast_test_flag(clonechan, AST_FLAG_ZOMBIE)) {
+ ast_debug(1, "Destroying channel clone '%s'\n", clonechan->name);
+ ast_channel_unlock(clonechan);
manager_event(EVENT_FLAG_CALL, "Hangup",
"Channel: %s\r\n"
"Uniqueid: %s\r\n"
"Cause: %d\r\n"
"Cause-txt: %s\r\n",
- clone->name,
- clone->uniqueid,
- clone->hangupcause,
- ast_cause2str(clone->hangupcause)
+ clonechan->name,
+ clonechan->uniqueid,
+ clonechan->hangupcause,
+ ast_cause2str(clonechan->hangupcause)
);
- ast_channel_free(clone);
+ ast_channel_free(clonechan);
} else {
- ast_debug(1, "Released clone lock on '%s'\n", clone->name);
- ast_set_flag(clone, AST_FLAG_ZOMBIE);
- ast_queue_frame(clone, &ast_null_frame);
- ast_channel_unlock(clone);
+ ast_debug(1, "Released clone lock on '%s'\n", clonechan->name);
+ ast_set_flag(clonechan, AST_FLAG_ZOMBIE);
+ ast_queue_frame(clonechan, &ast_null_frame);
+ ast_channel_unlock(clonechan);
}
/* Signal any blocker */
/* #exec </path/to/executable>
We create a tmp file, then we #include it, then we delete it. */
if (!do_include) {
- struct timeval tv = ast_tvnow();
+ struct timeval now = ast_tvnow();
if (!ast_test_flag(&flags, CONFIG_FLAG_NOCACHE))
config_cache_attribute(configfile, ATTRIBUTE_EXEC, NULL, who_asked);
- snprintf(exec_file, sizeof(exec_file), "/var/tmp/exec.%d%d.%ld", (int)tv.tv_sec, (int)tv.tv_usec, (long)pthread_self());
+ snprintf(exec_file, sizeof(exec_file), "/var/tmp/exec.%d%d.%ld", (int)now.tv_sec, (int)now.tv_usec, (long)pthread_self());
snprintf(cmd, sizeof(cmd), "%s > %s 2>&1", cur, exec_file);
ast_safe_system(cmd);
cur = exec_file;
* incorrectly cause no reload to be necessary. */
char fn2[256];
#ifdef AST_INCLUDE_GLOB
- int glob_ret;
- glob_t globbuf = { .gl_offs = 0 };
- glob_ret = glob(cfinclude->include, MY_GLOB_FLAGS, NULL, &globbuf);
+ int glob_return;
+ glob_t glob_buf = { .gl_offs = 0 };
+ glob_return = glob(cfinclude->include, MY_GLOB_FLAGS, NULL, &glob_buf);
/* On error, we reparse */
- if (glob_ret == GLOB_NOSPACE || glob_ret == GLOB_ABORTED)
+ if (glob_return == GLOB_NOSPACE || glob_return == GLOB_ABORTED)
unchanged = 0;
else {
/* loop over expanded files */
int j;
- for (j = 0; j < globbuf.gl_pathc; j++) {
- ast_copy_string(fn2, globbuf.gl_pathv[j], sizeof(fn2));
+ for (j = 0; j < glob_buf.gl_pathc; j++) {
+ ast_copy_string(fn2, glob_buf.gl_pathv[j], sizeof(fn2));
#else
ast_copy_string(fn2, cfinclude->include);
#endif
}
if (process_buf) {
- char *buf = ast_strip(process_buf);
- if (!ast_strlen_zero(buf)) {
- if (process_text_line(cfg, &cat, buf, lineno, fn, flags, comment_buffer, lline_buffer, suggested_include_file, &last_cat, &last_var, who_asked)) {
+ char *buffer = ast_strip(process_buf);
+ if (!ast_strlen_zero(buffer)) {
+ if (process_text_line(cfg, &cat, buffer, lineno, fn, flags, comment_buffer, lline_buffer, suggested_include_file, &last_cat, &last_var, who_asked)) {
cfg = NULL;
break;
}
EPG *e;
EPGNO *parent;
PAGE *h;
- indx_t index = 0;
+ indx_t idx = 0;
pgno_t pgno;
recno_t nextpg, prevpg;
int exact, level;
/* Move to the next index. */
if (parent->index != NEXTINDEX(h) - 1) {
- index = parent->index + 1;
- BT_PUSH(t, h->pgno, index);
+ idx = parent->index + 1;
+ BT_PUSH(t, h->pgno, idx);
break;
}
mpool_put(t->bt_mp, h, 0);
/* Restore the stack. */
while (level--) {
/* Push the next level down onto the stack. */
- bi = GETBINTERNAL(h, index);
+ bi = GETBINTERNAL(h, idx);
pgno = bi->pgno;
BT_PUSH(t, pgno, 0);
/* Get the next level down. */
if ((h = mpool_get(t->bt_mp, pgno, 0)) == NULL)
return (1);
- index = 0;
+ idx = 0;
}
mpool_put(t->bt_mp, h, 0);
if ((h = mpool_get(t->bt_mp, nextpg, 0)) == NULL)
/* Move to the next index. */
if (parent->index != 0) {
- index = parent->index - 1;
- BT_PUSH(t, h->pgno, index);
+ idx = parent->index - 1;
+ BT_PUSH(t, h->pgno, idx);
break;
}
mpool_put(t->bt_mp, h, 0);
/* Restore the stack. */
while (level--) {
/* Push the next level down onto the stack. */
- bi = GETBINTERNAL(h, index);
+ bi = GETBINTERNAL(h, idx);
pgno = bi->pgno;
/* Lose the currently pinned page. */
if ((h = mpool_get(t->bt_mp, pgno, 0)) == NULL)
return (1);
- index = NEXTINDEX(h) - 1;
- BT_PUSH(t, pgno, index);
+ idx = NEXTINDEX(h) - 1;
+ BT_PUSH(t, pgno, idx);
}
mpool_put(t->bt_mp, h, 0);
if ((h = mpool_get(t->bt_mp, prevpg, 0)) == NULL)
BINTERNAL *bi;
PAGE *pg;
EPGNO *parent;
- indx_t cnt, index, *ip, offset;
+ indx_t cnt, idx, *ip, offset;
u_int32_t nksize;
char *from;
if ((pg = mpool_get(t->bt_mp, parent->pgno, 0)) == NULL)
return (RET_ERROR);
- index = parent->index;
- bi = GETBINTERNAL(pg, index);
+ idx = parent->index;
+ bi = GETBINTERNAL(pg, idx);
/* Free any overflow pages. */
if (bi->flags & P_BIGKEY &&
pg->upper += nksize;
/* Adjust indices' offsets, shift the indices down. */
- offset = pg->linp[index];
- for (cnt = index, ip = &pg->linp[0]; cnt--; ++ip)
+ offset = pg->linp[idx];
+ for (cnt = idx, ip = &pg->linp[0]; cnt--; ++ip)
if (ip[0] < offset)
ip[0] += nksize;
- for (cnt = NEXTINDEX(pg) - index; --cnt; ++ip)
+ for (cnt = NEXTINDEX(pg) - idx; --cnt; ++ip)
ip[0] = ip[1] < offset ? ip[1] + nksize : ip[1];
pg->lower -= sizeof(indx_t);
}
* RET_SUCCESS, RET_ERROR.
*/
int
-__bt_dleaf(t, key, h, index)
+__bt_dleaf(t, key, h, idx)
BTREE *t;
const DBT *key;
PAGE *h;
- u_int index;
+ u_int idx;
{
BLEAF *bl;
indx_t cnt, *ip, offset;
/* If this record is referenced by the cursor, delete the cursor. */
if (F_ISSET(&t->bt_cursor, CURS_INIT) &&
!F_ISSET(&t->bt_cursor, CURS_ACQUIRE) &&
- t->bt_cursor.pg.pgno == h->pgno && t->bt_cursor.pg.index == index &&
- __bt_curdel(t, key, h, index))
+ t->bt_cursor.pg.pgno == h->pgno && t->bt_cursor.pg.index == idx &&
+ __bt_curdel(t, key, h, idx))
return (RET_ERROR);
/* If the entry uses overflow pages, make them available for reuse. */
- to = bl = GETBLEAF(h, index);
+ to = bl = GETBLEAF(h, idx);
if (bl->flags & P_BIGKEY && __ovfl_delete(t, bl->bytes) == RET_ERROR)
return (RET_ERROR);
if (bl->flags & P_BIGDATA &&
h->upper += nbytes;
/* Adjust the indices' offsets, shift the indices down. */
- offset = h->linp[index];
- for (cnt = index, ip = &h->linp[0]; cnt--; ++ip)
+ offset = h->linp[idx];
+ for (cnt = idx, ip = &h->linp[0]; cnt--; ++ip)
if (ip[0] < offset)
ip[0] += nbytes;
- for (cnt = NEXTINDEX(h) - index; --cnt; ++ip)
+ for (cnt = NEXTINDEX(h) - idx; --cnt; ++ip)
ip[0] = ip[1] < offset ? ip[1] + nbytes : ip[1];
h->lower -= sizeof(indx_t);
/* If the cursor is on this page, adjust it as necessary. */
if (F_ISSET(&t->bt_cursor, CURS_INIT) &&
!F_ISSET(&t->bt_cursor, CURS_ACQUIRE) &&
- t->bt_cursor.pg.pgno == h->pgno && t->bt_cursor.pg.index > index)
+ t->bt_cursor.pg.pgno == h->pgno && t->bt_cursor.pg.index > idx)
--t->bt_cursor.pg.index;
return (RET_SUCCESS);
* RET_SUCCESS, RET_ERROR.
*/
static int
-__bt_curdel(t, key, h, index)
+__bt_curdel(t, key, h, idx)
BTREE *t;
const DBT *key;
PAGE *h;
- u_int index;
+ u_int idx;
{
CURSOR *c;
EPG e;
*/
if (key == NULL) {
e.page = h;
- e.index = index;
+ e.index = idx;
if ((status = __bt_ret(t, &e,
&c->key, &c->key, NULL, NULL, 1)) != RET_SUCCESS)
return (status);
key = &c->key;
}
/* Check previous key, if not at the beginning of the page. */
- if (index > 0) {
+ if (idx > 0) {
e.page = h;
- e.index = index - 1;
+ e.index = idx - 1;
if (__bt_cmp(t, key, &e) == 0) {
F_SET(c, CURS_BEFORE);
goto dup2;
}
}
/* Check next key, if not at the end of the page. */
- if (index < NEXTINDEX(h) - 1) {
+ if (idx < NEXTINDEX(h) - 1) {
e.page = h;
- e.index = index + 1;
+ e.index = idx + 1;
if (__bt_cmp(t, key, &e) == 0) {
F_SET(c, CURS_AFTER);
goto dup2;
}
}
/* Check previous key if at the beginning of the page. */
- if (index == 0 && h->prevpg != P_INVALID) {
+ if (idx == 0 && h->prevpg != P_INVALID) {
if ((pg = mpool_get(t->bt_mp, h->prevpg, 0)) == NULL)
return (RET_ERROR);
e.page = pg;
mpool_put(t->bt_mp, pg, 0);
}
/* Check next key if at the end of the page. */
- if (index == NEXTINDEX(h) - 1 && h->nextpg != P_INVALID) {
+ if (idx == NEXTINDEX(h) - 1 && h->nextpg != P_INVALID) {
if ((pg = mpool_get(t->bt_mp, h->nextpg, 0)) == NULL)
return (RET_ERROR);
e.page = pg;
}
}
e.page = h;
- e.index = index;
+ e.index = idx;
if (curcopy || (status =
__bt_ret(t, &e, &c->key, &c->key, NULL, NULL, 1)) == RET_SUCCESS) {
F_SET(c, CURS_ACQUIRE);
DBT tkey, tdata;
EPG *e = 0;
PAGE *h;
- indx_t index, nxtindex;
+ indx_t idx, nxtindex;
pgno_t pg;
u_int32_t nbytes;
int dflags, exact, status;
if (flags == R_CURSOR) {
if ((h = mpool_get(t->bt_mp, t->bt_cursor.pg.pgno, 0)) == NULL)
return (RET_ERROR);
- index = t->bt_cursor.pg.index;
+ idx = t->bt_cursor.pg.index;
goto delete;
}
if ((e = __bt_search(t, key, &exact)) == NULL)
return (RET_ERROR);
h = e->page;
- index = e->index;
+ idx = e->index;
/*
* Add the key/data pair to the tree. If an identical key is already
* Note, the delete may empty the page, so we need to put a
* new entry into the page immediately.
*/
-delete: if (__bt_dleaf(t, key, h, index) == RET_ERROR) {
+delete: if (__bt_dleaf(t, key, h, idx) == RET_ERROR) {
mpool_put(t->bt_mp, h, 0);
return (RET_ERROR);
}
nbytes = NBLEAFDBT(key->size, data->size);
if ((u_int32_t) (h->upper - h->lower) < nbytes + sizeof(indx_t)) {
if ((status = __bt_split(t, h, key,
- data, dflags, nbytes, index)) != RET_SUCCESS)
+ data, dflags, nbytes, idx)) != RET_SUCCESS)
return (status);
goto success;
}
- if (index < (nxtindex = NEXTINDEX(h)))
- memmove(h->linp + index + 1, h->linp + index,
- (nxtindex - index) * sizeof(indx_t));
+ if (idx < (nxtindex = NEXTINDEX(h)))
+ memmove(h->linp + idx + 1, h->linp + idx,
+ (nxtindex - idx) * sizeof(indx_t));
h->lower += sizeof(indx_t);
- h->linp[index] = h->upper -= nbytes;
+ h->linp[idx] = h->upper -= nbytes;
dest = (char *)h + h->upper;
WR_BLEAF(dest, key, data, dflags);
/* If the cursor is on this page, adjust it as necessary. */
if (F_ISSET(&t->bt_cursor, CURS_INIT) &&
!F_ISSET(&t->bt_cursor, CURS_ACQUIRE) &&
- t->bt_cursor.pg.pgno == h->pgno && t->bt_cursor.pg.index >= index)
+ t->bt_cursor.pg.pgno == h->pgno && t->bt_cursor.pg.index >= idx)
++t->bt_cursor.pg.index;
if (t->bt_order == NOT) {
if (h->nextpg == P_INVALID) {
- if (index == NEXTINDEX(h) - 1) {
+ if (idx == NEXTINDEX(h) - 1) {
t->bt_order = FORWARD;
- t->bt_last.index = index;
+ t->bt_last.index = idx;
t->bt_last.pgno = h->pgno;
}
} else if (h->prevpg == P_INVALID) {
- if (index == 0) {
+ if (idx == 0) {
t->bt_order = BACK;
t->bt_last.index = 0;
t->bt_last.pgno = h->pgno;
* RET_SUCCESS, RET_ERROR.
*/
int
-__rec_dleaf(t, h, index)
+__rec_dleaf(t, h, idx)
BTREE *t;
PAGE *h;
- u_int32_t index;
+ u_int32_t idx;
{
RLEAF *rl;
indx_t *ip, cnt, offset;
* down, overwriting the deleted record and its index. If the record
* uses overflow pages, make them available for reuse.
*/
- to = rl = GETRLEAF(h, index);
+ to = rl = GETRLEAF(h, idx);
if (rl->flags & P_BIGDATA && __ovfl_delete(t, rl->bytes) == RET_ERROR)
return (RET_ERROR);
nbytes = NRLEAF(rl);
memmove(from + nbytes, from, (char *)to - from);
h->upper += nbytes;
- offset = h->linp[index];
- for (cnt = &h->linp[index] - (ip = &h->linp[0]); cnt--; ++ip)
+ offset = h->linp[idx];
+ for (cnt = &h->linp[idx] - (ip = &h->linp[0]); cnt--; ++ip)
if (ip[0] < offset)
ip[0] += nbytes;
for (cnt = &h->linp[NEXTINDEX(h)] - ip; --cnt; ++ip)
DBT tdata;
EPG *e;
PAGE *h;
- indx_t index, nxtindex;
+ indx_t idx, nxtindex;
pgno_t pg;
u_int32_t nbytes;
int dflags, status;
return (RET_ERROR);
h = e->page;
- index = e->index;
+ idx = e->index;
/*
* Add the specified key/data pair to the tree. The R_IAFTER and
*/
switch (flags) {
case R_IAFTER:
- ++index;
+ ++idx;
break;
case R_IBEFORE:
break;
default:
if (nrec < t->bt_nrecs &&
- __rec_dleaf(t, h, index) == RET_ERROR) {
+ __rec_dleaf(t, h, idx) == RET_ERROR) {
mpool_put(t->bt_mp, h, 0);
return (RET_ERROR);
}
*/
nbytes = NRLEAFDBT(data->size);
if ((u_int32_t) (h->upper - h->lower) < nbytes + sizeof(indx_t)) {
- status = __bt_split(t, h, NULL, data, dflags, nbytes, index);
+ status = __bt_split(t, h, NULL, data, dflags, nbytes, idx);
if (status == RET_SUCCESS)
++t->bt_nrecs;
return (status);
}
- if (index < (nxtindex = NEXTINDEX(h)))
- memmove(h->linp + index + 1, h->linp + index,
- (nxtindex - index) * sizeof(indx_t));
+ if (idx < (nxtindex = NEXTINDEX(h)))
+ memmove(h->linp + idx + 1, h->linp + idx,
+ (nxtindex - idx) * sizeof(indx_t));
h->lower += sizeof(indx_t);
- h->linp[index] = h->upper -= nbytes;
+ h->linp[idx] = h->upper -= nbytes;
dest = (char *)h + h->upper;
WR_RLEAF(dest, data, dflags);
ie_type != AST_EVENT_IE_END;
ie_type = va_arg(ap, enum ast_event_type))
{
- struct ast_event_ie_val *ie_val = alloca(sizeof(*ie_val));
- memset(ie_val, 0, sizeof(*ie_val));
- ie_val->ie_type = ie_type;
- ie_val->ie_pltype = va_arg(ap, enum ast_event_ie_pltype);
- if (ie_val->ie_pltype == AST_EVENT_IE_PLTYPE_UINT)
- ie_val->payload.uint = va_arg(ap, uint32_t);
- else if (ie_val->ie_pltype == AST_EVENT_IE_PLTYPE_STR)
- ie_val->payload.str = ast_strdupa(va_arg(ap, const char *));
- else if (ie_val->ie_pltype == AST_EVENT_IE_PLTYPE_RAW) {
+ struct ast_event_ie_val *ie_value = alloca(sizeof(*ie_value));
+ memset(ie_value, 0, sizeof(*ie_value));
+ ie_value->ie_type = ie_type;
+ ie_value->ie_pltype = va_arg(ap, enum ast_event_ie_pltype);
+ if (ie_value->ie_pltype == AST_EVENT_IE_PLTYPE_UINT)
+ ie_value->payload.uint = va_arg(ap, uint32_t);
+ else if (ie_value->ie_pltype == AST_EVENT_IE_PLTYPE_STR)
+ ie_value->payload.str = ast_strdupa(va_arg(ap, const char *));
+ else if (ie_value->ie_pltype == AST_EVENT_IE_PLTYPE_RAW) {
void *data = va_arg(ap, void *);
size_t datalen = va_arg(ap, size_t);
- ie_val->payload.raw = alloca(datalen);
- memcpy(ie_val->payload.raw, data, datalen);
- ie_val->raw_datalen = datalen;
+ ie_value->payload.raw = alloca(datalen);
+ memcpy(ie_value->payload.raw, data, datalen);
+ ie_value->raw_datalen = datalen;
}
- AST_LIST_INSERT_TAIL(&ie_vals, ie_val, entry);
+ AST_LIST_INSERT_TAIL(&ie_vals, ie_value, entry);
}
va_end(ap);
}
int ast_event_sub_append_ie_uint(struct ast_event_sub *sub,
- enum ast_event_ie_type ie_type, uint32_t uint)
+ enum ast_event_ie_type ie_type, uint32_t unsigned_int)
{
struct ast_event_ie_val *ie_val;
return -1;
ie_val->ie_type = ie_type;
- ie_val->payload.uint = uint;
+ ie_val->payload.uint = unsigned_int;
ie_val->ie_pltype = AST_EVENT_IE_PLTYPE_UINT;
AST_LIST_INSERT_TAIL(&sub->ie_vals, ie_val, entry);
break;
case AST_EVENT_IE_PLTYPE_UINT:
{
- uint32_t uint = va_arg(ap, uint32_t);
- ast_event_sub_append_ie_uint(sub, ie_type, uint);
+ uint32_t unsigned_int = va_arg(ap, uint32_t);
+ ast_event_sub_append_ie_uint(sub, ie_type, unsigned_int);
break;
}
case AST_EVENT_IE_PLTYPE_STR:
ie_type != AST_EVENT_IE_END;
ie_type = va_arg(ap, enum ast_event_type))
{
- struct ast_event_ie_val *ie_val = alloca(sizeof(*ie_val));
- memset(ie_val, 0, sizeof(*ie_val));
- ie_val->ie_type = ie_type;
- ie_val->ie_pltype = va_arg(ap, enum ast_event_ie_pltype);
- if (ie_val->ie_pltype == AST_EVENT_IE_PLTYPE_UINT)
- ie_val->payload.uint = va_arg(ap, uint32_t);
- else if (ie_val->ie_pltype == AST_EVENT_IE_PLTYPE_STR)
- ie_val->payload.str = ast_strdupa(va_arg(ap, const char *));
- else if (ie_val->ie_pltype == AST_EVENT_IE_PLTYPE_RAW) {
+ struct ast_event_ie_val *ie_value = alloca(sizeof(*ie_value));
+ memset(ie_value, 0, sizeof(*ie_value));
+ ie_value->ie_type = ie_type;
+ ie_value->ie_pltype = va_arg(ap, enum ast_event_ie_pltype);
+ if (ie_value->ie_pltype == AST_EVENT_IE_PLTYPE_UINT)
+ ie_value->payload.uint = va_arg(ap, uint32_t);
+ else if (ie_value->ie_pltype == AST_EVENT_IE_PLTYPE_STR)
+ ie_value->payload.str = ast_strdupa(va_arg(ap, const char *));
+ else if (ie_value->ie_pltype == AST_EVENT_IE_PLTYPE_RAW) {
void *data = va_arg(ap, void *);
size_t datalen = va_arg(ap, size_t);
- ie_val->payload.raw = alloca(datalen);
- memcpy(ie_val->payload.raw, data, datalen);
- ie_val->raw_datalen = datalen;
+ ie_value->payload.raw = alloca(datalen);
+ memcpy(ie_value->payload.raw, data, datalen);
+ ie_value->raw_datalen = datalen;
}
- AST_LIST_INSERT_TAIL(&ie_vals, ie_val, entry);
+ AST_LIST_INSERT_TAIL(&ie_vals, ie_value, entry);
}
va_end(ap);
rfds = nrfds;
efds = nefds;
{
- struct timeval tv = ast_samp2tv(ms, 1000);
+ struct timeval wait = ast_samp2tv(ms, 1000);
/* Wait for something to happen */
- ast_select(max + 1, &rfds, NULL, &efds, (ms > -1) ? &tv : NULL);
+ ast_select(max + 1, &rfds, NULL, &efds, (ms > -1) ? &wait : NULL);
}
pthread_testcancel();
}
* \brief the core of all waitstream() functions
*/
static int waitstream_core(struct ast_channel *c, const char *breakon,
- const char *forward, const char *rewind, int skip_ms,
+ const char *forward, const char *reverse, int skip_ms,
int audiofd, int cmdfd, const char *context)
{
const char *orig_chan_name = NULL;
breakon = "";
if (!forward)
forward = "";
- if (!rewind)
- rewind = "";
+ if (!reverse)
+ reverse = "";
/* Switch the channel to end DTMF frame only. waitstream_core doesn't care about the start of DTMF. */
ast_set_flag(c, AST_FLAG_END_DTMF_ONLY);
res = fr->subclass;
if (strchr(forward, res)) {
ast_stream_fastforward(c->stream, skip_ms);
- } else if (strchr(rewind, res)) {
+ } else if (strchr(reverse, res)) {
ast_stream_rewind(c->stream, skip_ms);
} else if (strchr(breakon, res)) {
ast_frfree(fr);
return (err || c->_softhangup) ? -1 : 0;
}
-int ast_waitstream_fr(struct ast_channel *c, const char *breakon, const char *forward, const char *rewind, int ms)
+int ast_waitstream_fr(struct ast_channel *c, const char *breakon, const char *forward, const char *reverse, int ms)
{
- return waitstream_core(c, breakon, forward, rewind, ms,
+ return waitstream_core(c, breakon, forward, reverse, ms,
-1 /* no audiofd */, -1 /* no cmdfd */, NULL /* no context */);
}
struct stat st;
int len;
int fd;
- struct timeval tv = ast_tvnow();
+ struct timeval now = ast_tvnow();
char buf[256];
struct ast_tm tm;
goto out403;
}
- ast_strftime(buf, sizeof(buf), "%a, %d %b %Y %H:%M:%S %Z", ast_localtime(&tv, &tm, "GMT"));
+ ast_strftime(buf, sizeof(buf), "%a, %d %b %Y %H:%M:%S %Z", ast_localtime(&now, &tm, "GMT"));
fprintf(ser->f, "HTTP/1.1 200 OK\r\n"
"Server: Asterisk/%s\r\n"
"Date: %s\r\n"
}
if (out) {
- struct timeval tv = ast_tvnow();
+ struct timeval now = ast_tvnow();
char timebuf[256];
struct ast_tm tm;
- ast_strftime(timebuf, sizeof(timebuf), "%a, %d %b %Y %H:%M:%S %Z", ast_localtime(&tv, &tm, "GMT"));
+ ast_strftime(timebuf, sizeof(timebuf), "%a, %d %b %Y %H:%M:%S %Z", ast_localtime(&now, &tm, "GMT"));
fprintf(ser->f,
"HTTP/1.1 %d %s\r\n"
"Server: Asterisk/%s\r\n"
static void history_get(jitterbuf *jb)
{
long max, min, jitter;
- int index;
+ int idx;
int count;
if (!jb->hist_maxbuf_valid)
/* count is how many items in history we're examining */
count = (jb->hist_ptr < JB_HISTORY_SZ) ? jb->hist_ptr : JB_HISTORY_SZ;
- /* index is the "n"ths highest/lowest that we'll look for */
- index = count * JB_HISTORY_DROPPCT / 100;
+ /* idx is the "n"ths highest/lowest that we'll look for */
+ idx = count * JB_HISTORY_DROPPCT / 100;
- /* sanity checks for index */
- if (index > (JB_HISTORY_MAXBUF_SZ - 1))
- index = JB_HISTORY_MAXBUF_SZ - 1;
+ /* sanity checks for idx */
+ if (idx > (JB_HISTORY_MAXBUF_SZ - 1))
+ idx = JB_HISTORY_MAXBUF_SZ - 1;
-
- if (index < 0) {
+ if (idx < 0) {
jb->info.min = 0;
jb->info.jitter = 0;
return;
}
- max = jb->hist_maxbuf[index];
- min = jb->hist_minbuf[index];
+ max = jb->hist_maxbuf[idx];
+ min = jb->hist_minbuf[idx];
jitter = max - min;
for (x = 0; x < m->hdrcount; x++) {
const char *h = m->headers[x];
if (!strncasecmp(var, h, l) && h[l] == ':' && h[l+1] == ' ') {
- const char *x = h + l + 2;
+ const char *value = h + l + 2;
/* found a potential candidate */
- if (mode & GET_HEADER_SKIP_EMPTY && ast_strlen_zero(x))
+ if (mode & GET_HEADER_SKIP_EMPTY && ast_strlen_zero(value))
continue; /* not interesting */
if (mode & GET_HEADER_LAST_MATCH)
- result = x; /* record the last match so far */
+ result = value; /* record the last match so far */
else
- return x;
+ return value;
}
}
struct ast_channel *c;
const char *name = astman_get_header(m, "Channel");
double timeout = atof(astman_get_header(m, "Timeout"));
- struct timeval tv = { timeout, 0 };
+ struct timeval when = { timeout, 0 };
if (ast_strlen_zero(name)) {
astman_send_error(s, m, "No channel specified");
return 0;
}
- tv.tv_usec = (timeout - tv.tv_sec) * 1000000.0;
- ast_channel_setwhentohangup_tv(c, tv);
+ when.tv_usec = (timeout - when.tv_sec) * 1000000.0;
+ ast_channel_setwhentohangup_tv(c, when);
ast_channel_unlock(c);
astman_send_ack(s, m, "Timeout Set");
return 0;
user->displayconnects = ast_true(user_displayconnects);
if (user_writetimeout) {
- int val = atoi(user_writetimeout);
- if (val < 100)
+ int value = atoi(user_writetimeout);
+ if (value < 100)
ast_log(LOG_WARNING, "Invalid writetimeout value '%s' at users.conf line %d\n", var->value, var->lineno);
else
- user->writetimeout = val;
+ user->writetimeout = value;
}
}
}
} else if (!strcasecmp(var->name, "displayconnects") ) {
user->displayconnects = ast_true(var->value);
} else if (!strcasecmp(var->name, "writetimeout")) {
- int val = atoi(var->value);
- if (val < 100)
+ int value = atoi(var->value);
+ if (value < 100)
ast_log(LOG_WARNING, "Invalid writetimeout value '%s' at line %d\n", var->value, var->lineno);
else
- user->writetimeout = val;
+ user->writetimeout = value;
} else
ast_debug(1, "%s is an unknown option.\n", var->name);
}
}
/*! \brief append an address to an STUN message */
-static void append_attr_address(struct stun_attr **attr, int attrval, struct sockaddr_in *sin, int *len, int *left)
+static void append_attr_address(struct stun_attr **attr, int attrval, struct sockaddr_in *sock_in, int *len, int *left)
{
int size = sizeof(**attr) + 8;
struct stun_addr *addr;
addr = (struct stun_addr *)((*attr)->value);
addr->unused = 0;
addr->family = 0x01;
- addr->port = sin->sin_port;
- addr->addr = sin->sin_addr.s_addr;
+ addr->port = sock_in->sin_port;
+ addr->addr = sock_in->sin_addr.s_addr;
(*attr) = (struct stun_attr *)((*attr)->value + 8);
*len += size;
*left -= size;
/*! \brief List of current sessions */
static AST_RWLIST_HEAD_STATIC(protos, ast_rtp_protocol);
-static void timeval2ntp(struct timeval tv, unsigned int *msw, unsigned int *lsw)
+static void timeval2ntp(struct timeval when, unsigned int *msw, unsigned int *lsw)
{
unsigned int sec, usec, frac;
- sec = tv.tv_sec + 2208988800u; /* Sec between 1900 and 1970 */
- usec = tv.tv_usec;
+ sec = when.tv_sec + 2208988800u; /* Sec between 1900 and 1970 */
+ usec = when.tv_usec;
frac = (usec << 12) + (usec << 8) - ((usec * 3650) >> 6);
*msw = sec;
*lsw = frac;
socklen_t len;
int position, i, packetwords;
int res;
- struct sockaddr_in sin;
+ struct sockaddr_in sock_in;
unsigned int rtcpdata[8192 + AST_FRIENDLY_OFFSET];
unsigned int *rtcpheader;
int pt;
if (!rtp || !rtp->rtcp)
return &ast_null_frame;
- len = sizeof(sin);
+ len = sizeof(sock_in);
res = recvfrom(rtp->rtcp->s, rtcpdata + AST_FRIENDLY_OFFSET, sizeof(rtcpdata) - sizeof(unsigned int) * AST_FRIENDLY_OFFSET,
- 0, (struct sockaddr *)&sin, &len);
+ 0, (struct sockaddr *)&sock_in, &len);
rtcpheader = (unsigned int *)(rtcpdata + AST_FRIENDLY_OFFSET);
if (res < 0) {
if (rtp->nat) {
/* Send to whoever sent to us */
- if ((rtp->rtcp->them.sin_addr.s_addr != sin.sin_addr.s_addr) ||
- (rtp->rtcp->them.sin_port != sin.sin_port)) {
- memcpy(&rtp->rtcp->them, &sin, sizeof(rtp->rtcp->them));
+ if ((rtp->rtcp->them.sin_addr.s_addr != sock_in.sin_addr.s_addr) ||
+ (rtp->rtcp->them.sin_port != sock_in.sin_port)) {
+ memcpy(&rtp->rtcp->them, &sock_in, sizeof(rtp->rtcp->them));
if (option_debug || rtpdebug)
ast_debug(0, "RTCP NAT: Got RTCP from other end. Now sending to address %s:%d\n", ast_inet_ntoa(rtp->rtcp->them.sin_addr), ntohs(rtp->rtcp->them.sin_port));
}
return &ast_null_frame;
}
- if (rtcp_debug_test_addr(&sin)) {
- ast_verbose("\n\nGot RTCP from %s:%d\n", ast_inet_ntoa(sin.sin_addr), ntohs(sin.sin_port));
+ if (rtcp_debug_test_addr(&sock_in)) {
+ ast_verbose("\n\nGot RTCP from %s:%d\n", ast_inet_ntoa(sock_in.sin_addr), ntohs(sock_in.sin_port));
ast_verbose("PT: %d(%s)\n", pt, (pt == 200) ? "Sender Report" : (pt == 201) ? "Receiver Report" : (pt == 192) ? "H.261 FUR" : "Unknown");
ast_verbose("Reception reports: %d\n", rc);
ast_verbose("SSRC of sender: %u\n", rtcpheader[i + 1]);
rtp->rtcp->soc = ntohl(rtcpheader[i + 4]);
rtp->rtcp->themrxlsr = ((ntohl(rtcpheader[i]) & 0x0000ffff) << 16) | ((ntohl(rtcpheader[i + 1]) & 0xffff0000) >> 16); /* Going to LSR in RR*/
- if (rtcp_debug_test_addr(&sin)) {
+ if (rtcp_debug_test_addr(&sock_in)) {
ast_verbose("NTP timestamp: %lu.%010lu\n", (unsigned long) ntohl(rtcpheader[i]), (unsigned long) ntohl(rtcpheader[i + 1]) * 4096);
ast_verbose("RTP timestamp: %lu\n", (unsigned long) ntohl(rtcpheader[i + 2]));
ast_verbose("SPC: %lu\tSOC: %lu\n", (unsigned long) ntohl(rtcpheader[i + 3]), (unsigned long) ntohl(rtcpheader[i + 4]));
rtp->rtcp->normdevrtt = normdevrtt_current;
rtp->rtcp->rtt_count++;
- } else if (rtcp_debug_test_addr(&sin)) {
+ } else if (rtcp_debug_test_addr(&sock_in)) {
ast_verbose("Internal RTCP NTP clock skew detected: "
"lsr=%u, now=%u, dlsr=%u (%d:%03dms), "
"diff=%d\n",
rtp->rtcp->reported_jitter_count++;
- if (rtcp_debug_test_addr(&sin)) {
+ if (rtcp_debug_test_addr(&sock_in)) {
ast_verbose(" Fraction lost: %ld\n", (((long) ntohl(rtcpheader[i + 1]) & 0xff000000) >> 24));
ast_verbose(" Packets lost so far: %d\n", rtp->rtcp->reported_lost);
ast_verbose(" Highest sequence number: %ld\n", (long) (ntohl(rtcpheader[i + 2]) & 0xffff));
"LastSR: %lu.%010lu\r\n"
"DLSR: %4.4f(sec)\r\n"
"RTT: %llu(sec)\r\n",
- ast_inet_ntoa(sin.sin_addr), ntohs(sin.sin_port),
+ ast_inet_ntoa(sock_in.sin_addr), ntohs(sock_in.sin_port),
pt, (pt == 200) ? "Sender Report" : (pt == 201) ? "Receiver Report" : (pt == 192) ? "H.261 FUR" : "Unknown",
rc,
rtcpheader[i + 1],
"IAJitter: %u\r\n"
"LastSR: %lu.%010lu\r\n"
"DLSR: %4.4f(sec)\r\n",
- ast_inet_ntoa(sin.sin_addr), ntohs(sin.sin_port),
+ ast_inet_ntoa(sock_in.sin_addr), ntohs(sock_in.sin_port),
pt, (pt == 200) ? "Sender Report" : (pt == 201) ? "Receiver Report" : (pt == 192) ? "H.261 FUR" : "Unknown",
rc,
rtcpheader[i + 1],
}
break;
case RTCP_PT_FUR:
- if (rtcp_debug_test_addr(&sin))
+ if (rtcp_debug_test_addr(&sock_in))
ast_verbose("Received an RTCP Fast Update Request\n");
rtp->f.frametype = AST_FRAME_CONTROL;
rtp->f.subclass = AST_CONTROL_VIDUPDATE;
f = &rtp->f;
break;
case RTCP_PT_SDES:
- if (rtcp_debug_test_addr(&sin))
+ if (rtcp_debug_test_addr(&sock_in))
ast_verbose("Received an SDES from %s:%d\n", ast_inet_ntoa(rtp->rtcp->them.sin_addr), ntohs(rtp->rtcp->them.sin_port));
break;
case RTCP_PT_BYE:
- if (rtcp_debug_test_addr(&sin))
+ if (rtcp_debug_test_addr(&sock_in))
ast_verbose("Received a BYE from %s:%d\n", ast_inet_ntoa(rtp->rtcp->them.sin_addr), ntohs(rtp->rtcp->them.sin_port));
break;
default:
return f;
}
-static void calc_rxstamp(struct timeval *tv, struct ast_rtp *rtp, unsigned int timestamp, int mark)
+static void calc_rxstamp(struct timeval *when, struct ast_rtp *rtp, unsigned int timestamp, int mark)
{
struct timeval now;
double transit;
gettimeofday(&now,NULL);
/* rxcore is the mapping between the RTP timestamp and _our_ real time from gettimeofday() */
- tv->tv_sec = rtp->rxcore.tv_sec + timestamp / 8000;
- tv->tv_usec = rtp->rxcore.tv_usec + (timestamp % 8000) * 125;
- if (tv->tv_usec >= 1000000) {
- tv->tv_usec -= 1000000;
- tv->tv_sec += 1;
+ when->tv_sec = rtp->rxcore.tv_sec + timestamp / 8000;
+ when->tv_usec = rtp->rxcore.tv_usec + (timestamp % 8000) * 125;
+ if (when->tv_usec >= 1000000) {
+ when->tv_usec -= 1000000;
+ when->tv_sec += 1;
}
prog = (double)((timestamp-rtp->seedrxts)/8000.);
dtv = (double)rtp->drxcore + (double)(prog);
struct ast_frame *ast_rtp_read(struct ast_rtp *rtp)
{
int res;
- struct sockaddr_in sin;
+ struct sockaddr_in sock_in;
socklen_t len;
unsigned int seqno;
int version;
if (rtp->sending_digit)
ast_rtp_senddigit_continuation(rtp);
- len = sizeof(sin);
+ len = sizeof(sock_in);
/* Cache where the header will go */
res = recvfrom(rtp->s, rtp->rawdata + AST_FRIENDLY_OFFSET, sizeof(rtp->rawdata) - AST_FRIENDLY_OFFSET,
- 0, (struct sockaddr *)&sin, &len);
+ 0, (struct sockaddr *)&sock_in, &len);
/* If strict RTP protection is enabled see if we need to learn this address or if the packet should be dropped */
if (rtp->strict_rtp_state == STRICT_RTP_LEARN) {
/* Copy over address that this packet was received on */
- memcpy(&rtp->strict_rtp_address, &sin, sizeof(rtp->strict_rtp_address));
+ memcpy(&rtp->strict_rtp_address, &sock_in, sizeof(rtp->strict_rtp_address));
/* Now move over to actually protecting the RTP port */
rtp->strict_rtp_state = STRICT_RTP_CLOSED;
ast_debug(1, "Learned remote address is %s:%d for strict RTP purposes, now protecting the port.\n", ast_inet_ntoa(rtp->strict_rtp_address.sin_addr), ntohs(rtp->strict_rtp_address.sin_port));
} else if (rtp->strict_rtp_state == STRICT_RTP_CLOSED) {
/* If the address we previously learned doesn't match the address this packet came in on simply drop it */
- if ((rtp->strict_rtp_address.sin_addr.s_addr != sin.sin_addr.s_addr) || (rtp->strict_rtp_address.sin_port != sin.sin_port)) {
- ast_debug(1, "Received RTP packet from %s:%d, dropping due to strict RTP protection. Expected it to be from %s:%d\n", ast_inet_ntoa(sin.sin_addr), ntohs(sin.sin_port), ast_inet_ntoa(rtp->strict_rtp_address.sin_addr), ntohs(rtp->strict_rtp_address.sin_port));
+ if ((rtp->strict_rtp_address.sin_addr.s_addr != sock_in.sin_addr.s_addr) || (rtp->strict_rtp_address.sin_port != sock_in.sin_port)) {
+ ast_debug(1, "Received RTP packet from %s:%d, dropping due to strict RTP protection. Expected it to be from %s:%d\n", ast_inet_ntoa(sock_in.sin_addr), ntohs(sock_in.sin_port), ast_inet_ntoa(rtp->strict_rtp_address.sin_addr), ntohs(rtp->strict_rtp_address.sin_port));
return &ast_null_frame;
}
}
* answers to requests, and it returns STUN_ACCEPT
* if the request is valid.
*/
- if ((stun_handle_packet(rtp->s, &sin, rtp->rawdata + AST_FRIENDLY_OFFSET, res, NULL, NULL) == STUN_ACCEPT) &&
+ if ((stun_handle_packet(rtp->s, &sock_in, rtp->rawdata + AST_FRIENDLY_OFFSET, res, NULL, NULL) == STUN_ACCEPT) &&
(!rtp->them.sin_port && !rtp->them.sin_addr.s_addr)) {
- memcpy(&rtp->them, &sin, sizeof(rtp->them));
+ memcpy(&rtp->them, &sock_in, sizeof(rtp->them));
}
return &ast_null_frame;
}
/* Send to whoever send to us if NAT is turned on */
if (rtp->nat) {
- if ((rtp->them.sin_addr.s_addr != sin.sin_addr.s_addr) ||
- (rtp->them.sin_port != sin.sin_port)) {
- rtp->them = sin;
+ if ((rtp->them.sin_addr.s_addr != sock_in.sin_addr.s_addr) ||
+ (rtp->them.sin_port != sock_in.sin_port)) {
+ rtp->them = sock_in;
if (rtp->rtcp) {
- memcpy(&rtp->rtcp->them, &sin, sizeof(rtp->rtcp->them));
+ memcpy(&rtp->rtcp->them, &sock_in, sizeof(rtp->rtcp->them));
rtp->rtcp->them.sin_port = htons(ntohs(rtp->them.sin_port)+1);
}
rtp->rxseqno = 0;
if (!rtp->themssrc)
rtp->themssrc = ntohl(rtpheader[2]); /* Record their SSRC to put in future RR */
- if (rtp_debug_test_addr(&sin))
+ if (rtp_debug_test_addr(&sock_in))
ast_verbose("Got RTP packet from %s:%u (type %-2.2d, seq %-6.6u, ts %-6.6u, len %-6.6u)\n",
- ast_inet_ntoa(sin.sin_addr), ntohs(sin.sin_port), payloadtype, seqno, timestamp,res - hdrlen);
+ ast_inet_ntoa(sock_in.sin_addr), ntohs(sock_in.sin_port), payloadtype, seqno, timestamp,res - hdrlen);
rtpPT = ast_rtp_lookup_pt(rtp, payloadtype);
if (!rtpPT.isAstFormat) {
/* This is special in-band data that's not one of our codecs */
if (rtpPT.code == AST_RTP_DTMF) {
/* It's special -- rfc2833 process it */
- if (rtp_debug_test_addr(&sin)) {
+ if (rtp_debug_test_addr(&sock_in)) {
unsigned char *data;
unsigned int event;
unsigned int event_end;
event_end >>= 24;
duration = ntohl(*((unsigned int *)(data)));
duration &= 0xFFFF;
- ast_verbose("Got RTP RFC2833 from %s:%u (type %-2.2d, seq %-6.6u, ts %-6.6u, len %-6.6u, mark %d, event %08x, end %d, duration %-5.5d) \n", ast_inet_ntoa(sin.sin_addr), ntohs(sin.sin_port), payloadtype, seqno, timestamp, res - hdrlen, (mark?1:0), event, ((event_end & 0x80)?1:0), duration);
+ ast_verbose("Got RTP RFC2833 from %s:%u (type %-2.2d, seq %-6.6u, ts %-6.6u, len %-6.6u, mark %d, event %08x, end %d, duration %-5.5d) \n", ast_inet_ntoa(sock_in.sin_addr), ntohs(sock_in.sin_port), payloadtype, seqno, timestamp, res - hdrlen, (mark?1:0), event, ((event_end & 0x80)?1:0), duration);
}
f = process_rfc2833(rtp, rtp->rawdata + AST_FRIENDLY_OFFSET + hdrlen, res - hdrlen, seqno, timestamp);
} else if (rtpPT.code == AST_RTP_CISCO_DTMF) {
unsigned char *header_end;
int num_generations;
int header_length;
- int len;
+ int length;
int diff =(int)seqno - (prev_seqno+1); /* if diff = 0, no drop*/
int x;
header_length = header_end - data;
num_generations = header_length / 4;
- len = header_length;
+ length = header_length;
if (!diff) {
for (x = 0; x < num_generations; x++)
- len += data[x * 4 + 3];
+ length += data[x * 4 + 3];
- if (!(rtp->f.datalen - len))
+ if (!(rtp->f.datalen - length))
return &ast_null_frame;
- rtp->f.data.ptr += len;
- rtp->f.datalen -= len;
+ rtp->f.data.ptr += length;
+ rtp->f.datalen -= length;
} else if (diff > num_generations && diff < 10) {
- len -= 3;
- rtp->f.data.ptr += len;
- rtp->f.datalen -= len;
+ length -= 3;
+ rtp->f.data.ptr += length;
+ rtp->f.datalen -= length;
data = rtp->f.data.ptr;
*data++ = 0xEF;
*data = 0xBD;
} else {
for ( x = 0; x < num_generations - diff; x++)
- len += data[x * 4 + 3];
+ length += data[x * 4 + 3];
- rtp->f.data.ptr += len;
- rtp->f.datalen -= len;
+ rtp->f.data.ptr += length;
+ rtp->f.datalen -= length;
}
}
return ast_rtp_new_with_bindaddr(sched, io, rtcpenable, callbackmode, ia);
}
-int ast_rtp_setqos(struct ast_rtp *rtp, int tos, int cos, char *desc)
+int ast_rtp_setqos(struct ast_rtp *rtp, int type_of_service, int class_of_service, char *desc)
{
- return ast_netsock_set_qos(rtp->s, tos, cos, desc);
+ return ast_netsock_set_qos(rtp->s, type_of_service, class_of_service, desc);
}
void ast_rtp_new_source(struct ast_rtp *rtp)
rtp->them.sin_port = them->sin_port;
rtp->them.sin_addr = them->sin_addr;
if (rtp->rtcp) {
- rtp->rtcp->them.sin_port = htons(ntohs(them->sin_port) + 1);
+ int h = ntohs(them->sin_port);
+ rtp->rtcp->them.sin_port = htons(h + 1);
rtp->rtcp->them.sin_addr = them->sin_addr;
}
rtp->rxseqno = 0;
} while(0)
#define PUT_AUDIO_SAMPLE(y) do { \
- int index = (short)(rint(8192.0 * (y))); \
- *(buf++) = AST_LIN2MU(index); \
+ int __pas_idx = (short)(rint(8192.0 * (y))); \
+ *(buf++) = AST_LIN2MU(__pas_idx); \
bytes++; \
} while(0)