[asterisk-commits] mmichelson: branch mmichelson/queue_refcount r81451 - in /team/mmichelson/que...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Sep 4 14:50:44 CDT 2007
Author: mmichelson
Date: Tue Sep 4 14:50:43 2007
New Revision: 81451
URL: http://svn.digium.com/view/asterisk?view=rev&rev=81451
Log:
Changed ao2_iterator and ao2_container to be
struct ao2_iterator and struct ao2_container
Modified:
team/mmichelson/queue_refcount/ (props changed)
team/mmichelson/queue_refcount/apps/app_dial.c
team/mmichelson/queue_refcount/apps/app_queue.c
team/mmichelson/queue_refcount/channels/chan_gtalk.c
team/mmichelson/queue_refcount/channels/chan_iax2.c
team/mmichelson/queue_refcount/channels/chan_sip.c
team/mmichelson/queue_refcount/funcs/func_logic.c
team/mmichelson/queue_refcount/include/asterisk/astobj2.h
team/mmichelson/queue_refcount/main/astobj2.c
team/mmichelson/queue_refcount/main/channel.c
team/mmichelson/queue_refcount/main/dns.c
Propchange: team/mmichelson/queue_refcount/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue Sep 4 14:50:43 2007
@@ -1,1 +1,1 @@
-/branches/1.4:1-81409
+/branches/1.4:1-81450
Modified: team/mmichelson/queue_refcount/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/queue_refcount/apps/app_dial.c?view=diff&rev=81451&r1=81450&r2=81451
==============================================================================
--- team/mmichelson/queue_refcount/apps/app_dial.c (original)
+++ team/mmichelson/queue_refcount/apps/app_dial.c Tue Sep 4 14:50:43 2007
@@ -124,6 +124,10 @@
" i - Asterisk will ignore any forwarding requests it may receive on this\n"
" dial attempt.\n"
" j - Jump to priority n+101 if all of the requested channels were busy.\n"
+" k - Allow the called party to enable parking of the call by sending\n"
+" the DTMF sequence defined for call parking in features.conf.\n"
+" K - Allow the calling party to enable parking of the call by sending\n"
+" the DTMF sequence defined for call parking in features.conf.\n"
" L(x[:y][:z]) - Limit the call to 'x' ms. Play a warning when 'y' ms are\n"
" left. Repeat the warning every 'z' ms. The following special\n"
" variables can be used with this option:\n"
@@ -190,11 +194,7 @@
" w - Allow the called party to enable recording of the call by sending\n"
" the DTMF sequence defined for one-touch recording in features.conf.\n"
" W - Allow the calling party to enable recording of the call by sending\n"
-" the DTMF sequence defined for one-touch recording in features.conf.\n"
-" k - Allow the called party to enable parking of the call by sending\n"
-" the DTMF sequence defined for call parking in features.conf.\n"
-" K - Allow the calling party to enable parking of the call by sending\n"
-" the DTMF sequence defined for call parking in features.conf.\n";
+" the DTMF sequence defined for one-touch recording in features.conf.\n";
/* RetryDial App by Anthony Minessale II <anthmct at yahoo.com> Jan/2005 */
static char *rapp = "RetryDial";
@@ -272,13 +272,15 @@
AST_APP_OPTION('H', OPT_CALLER_HANGUP),
AST_APP_OPTION('i', OPT_IGNORE_FORWARDING),
AST_APP_OPTION('j', OPT_PRIORITY_JUMP),
+ AST_APP_OPTION('k', OPT_CALLEE_PARK),
+ AST_APP_OPTION('K', OPT_CALLER_PARK),
AST_APP_OPTION_ARG('L', OPT_DURATION_LIMIT, OPT_ARG_DURATION_LIMIT),
AST_APP_OPTION_ARG('m', OPT_MUSICBACK, OPT_ARG_MUSICBACK),
AST_APP_OPTION_ARG('M', OPT_CALLEE_MACRO, OPT_ARG_CALLEE_MACRO),
AST_APP_OPTION('n', OPT_SCREEN_NOINTRO),
AST_APP_OPTION('N', OPT_SCREEN_NOCLID),
+ AST_APP_OPTION('o', OPT_ORIGINAL_CLID),
AST_APP_OPTION_ARG('O', OPT_OPERMODE,OPT_ARG_OPERMODE),
- AST_APP_OPTION('o', OPT_ORIGINAL_CLID),
AST_APP_OPTION('p', OPT_SCREENING),
AST_APP_OPTION_ARG('P', OPT_PRIVACY, OPT_ARG_PRIVACY),
AST_APP_OPTION('r', OPT_RINGBACK),
@@ -287,8 +289,6 @@
AST_APP_OPTION('T', OPT_CALLER_TRANSFER),
AST_APP_OPTION('w', OPT_CALLEE_MONITOR),
AST_APP_OPTION('W', OPT_CALLER_MONITOR),
- AST_APP_OPTION('k', OPT_CALLEE_PARK),
- AST_APP_OPTION('K', OPT_CALLER_PARK),
});
/* We define a custom "local user" structure because we
Modified: team/mmichelson/queue_refcount/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/queue_refcount/apps/app_queue.c?view=diff&rev=81451&r1=81450&r2=81451
==============================================================================
--- team/mmichelson/queue_refcount/apps/app_queue.c (original)
+++ team/mmichelson/queue_refcount/apps/app_queue.c Tue Sep 4 14:50:43 2007
@@ -399,12 +399,12 @@
int memberdelay; /*!< Seconds to delay connecting member to caller */
int autofill; /*!< Ignore the head call status and ring an available agent */
- ao2_container members; /*!< The list of members in the queue */
+ struct ao2_container members; /*!< The list of members in the queue */
int membercount; /*!< Number of members in queue */
struct queue_ent *head; /*!< Head of the list of callers */
};
-static ao2_container *queues;
+static struct ao2_container *queues;
static int set_member_paused(const char *queuename, const char *interface, int paused);
@@ -509,7 +509,7 @@
{
struct member *member;
enum queue_member_status result = QUEUE_NO_MEMBERS;
- ao2_iterator i;
+ struct ao2_iterator i;
ast_mutex_lock(&q->lock);
i = ao2_iterator_init(q->members, 0);
@@ -557,7 +557,7 @@
struct member_interface *curint;
char *loc;
char *technology;
- ao2_iterator queue_iter, member_iter;
+ struct ao2_iterator queue_iter, member_iter;
technology = ast_strdupa(sc->dev);
loc = strchr(technology, '/');
@@ -758,7 +758,7 @@
struct call_queue *q;
struct member *mem;
int ret = 0;
- ao2_iterator queue_iter;
+ struct ao2_iterator queue_iter;
queue_iter = ao2_iterator_init(queues, 0);
while((q = ao2_iterator_next(&queue_iter))) {
@@ -1005,7 +1005,7 @@
{
/* Free non-dynamic members */
struct member *curm, *next, *prev = NULL;
- ao2_iterator mem_iter;
+ struct ao2_iterator mem_iter;
mem_iter = ao2_iterator_init(q->members, 0);
while ((curm = ao2_iterator_next(&mem_iter))) {
@@ -1050,7 +1050,7 @@
char *interface = NULL;
char *tmp, *tmp_name;
char tmpbuf[64]; /* Must be longer than the longest queue param name. */
- ao2_iterator mem_iter;
+ struct ao2_iterator mem_iter;
ast_copy_string(tmpq.name, queuename, sizeof(tmpq.name));
@@ -1188,7 +1188,7 @@
struct ast_config *member_config = NULL;
struct member *m, *prev_m, *next_m;
char *interface = NULL;
- ao2_iterator mem_iter;
+ struct ao2_iterator mem_iter;
member_config = ast_load_realtime_multientry("queue_members", "interface LIKE", "%", "queue_name", q->name , NULL);
if (!member_config) {
@@ -1614,7 +1614,7 @@
struct call_queue *q;
struct member *mem;
int found = 0;
- ao2_iterator queue_iter;
+ struct ao2_iterator queue_iter;
/* &qlock and &rq->lock already set by try_calling()
* to solve deadlock */
@@ -2202,7 +2202,7 @@
int avl = 0;
int idx = 0;
int res;
- ao2_iterator mem_iter;
+ struct ao2_iterator mem_iter;
if (!qe->parent->autofill) {
/* Atomically read the parent head -- does not need a lock */
@@ -2981,7 +2981,7 @@
int found = 0;
struct call_queue *q;
struct member *mem;
- ao2_iterator i;
+ struct ao2_iterator i;
/* Special event for when all queues are paused - individual events still generated */
/* XXX In all other cases, we use the membername, but since this affects all queues, we cannot */
@@ -3811,7 +3811,7 @@
char *interface;
char *membername;
int penalty;
- ao2_iterator i;
+ struct ao2_iterator i;
AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(interface);
AST_APP_ARG(penalty);
@@ -3823,10 +3823,11 @@
return 0;
}
use_weight=0;
- /* Mark all queues as dead for the moment */
i = ao2_iterator_init(queues, 0);
+ /*Mark all non-realtime queues dead for now*/
while((q = ao2_iterator_next(&i))) {
- q->dead = 1;
+ if(!q->realtime)
+ q->dead = 1;
queue_unref(q);
}
@@ -4062,7 +4063,7 @@
struct call_queue *q;
int queue_show;
char *term = manager ? "\r\n" : "\n";
- ao2_iterator i;
+ struct ao2_iterator i;
if (argc == 2)
queue_show = 0;
@@ -4119,7 +4120,7 @@
char *ret = NULL;
int which = 0;
int wordlen = strlen(word);
- ao2_iterator i;
+ struct ao2_iterator i;
i = ao2_iterator_init(queues, 0);
while((q = ao2_iterator_next(&i))) {
@@ -4167,7 +4168,7 @@
struct queue_ent *qe;
float sl = 0;
struct member *mem;
- ao2_iterator i;
+ struct ao2_iterator i;
astman_send_ack(s, m, "Queue status will follow");
time(&now);
@@ -4476,7 +4477,7 @@
int which = 0;
struct call_queue *q;
struct member *m;
- ao2_iterator i;
+ struct ao2_iterator i;
/* 0 - queue; 1 - remove; 2 - member; 3 - <member>; 4 - from; 5 - <queue> */
if (pos > 5 || pos < 3)
Modified: team/mmichelson/queue_refcount/channels/chan_gtalk.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/queue_refcount/channels/chan_gtalk.c?view=diff&rev=81451&r1=81450&r2=81451
==============================================================================
--- team/mmichelson/queue_refcount/channels/chan_gtalk.c (original)
+++ team/mmichelson/queue_refcount/channels/chan_gtalk.c Tue Sep 4 14:50:43 2007
@@ -1563,13 +1563,54 @@
/*! \brief CLI command "gtalk show channels" */
static int gtalk_show_channels(int fd, int argc, char **argv)
{
+#define FORMAT "%-30.30s %-30.30s %-15.15s %-5.5s %-5.5s \n"
+ struct gtalk_pvt *p;
+ struct ast_channel *chan;
+ int numchans = 0;
+ char them[100];
+ char *jid = NULL;
+ char *resource = NULL;
+
if (argc != 3)
return RESULT_SHOWUSAGE;
+
ast_mutex_lock(>alklock);
-// if (!gtalk_list->p)
- ast_cli(fd, "No gtalk channels in use\n");
+ ast_cli(fd, FORMAT, "Channel", "Jabber ID", "Resource", "Read", "Write");
+ ASTOBJ_CONTAINER_TRAVERSE(>alk_list, 1, {
+ ASTOBJ_WRLOCK(iterator);
+ p = iterator->p;
+ while(p) {
+ chan = p->owner;
+ ast_copy_string(them, p->them, sizeof(them));
+ jid = them;
+ resource = strchr(them, '/');
+ if (!resource)
+ resource = "None";
+ else {
+ *resource = '\0';
+ resource ++;
+ }
+ if (chan)
+ ast_cli(fd, FORMAT,
+ chan->name,
+ jid,
+ resource,
+ ast_getformatname(chan->readformat),
+ ast_getformatname(chan->writeformat)
+ );
+ else
+ ast_log(LOG_WARNING, "No available channel\n");
+ numchans ++;
+ p = p->next;
+ }
+ ASTOBJ_UNLOCK(iterator);
+ });
+
ast_mutex_unlock(>alklock);
+
+ ast_cli(fd, "%d active gtalk channel%s\n", numchans, (numchans != 1) ? "s" : "");
return RESULT_SUCCESS;
+#undef FORMAT
}
/*! \brief CLI command "gtalk show channels" */
Modified: team/mmichelson/queue_refcount/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/queue_refcount/channels/chan_iax2.c?view=diff&rev=81451&r1=81450&r2=81451
==============================================================================
--- team/mmichelson/queue_refcount/channels/chan_iax2.c (original)
+++ team/mmichelson/queue_refcount/channels/chan_iax2.c Tue Sep 4 14:50:43 2007
@@ -645,10 +645,10 @@
#define MAX_PEER_BUCKETS 1
/* #define MAX_PEER_BUCKETS 563 */
#endif
-static ao2_container *peers;
+static struct ao2_container *peers;
#define MAX_USER_BUCKETS MAX_PEER_BUCKETS
-static ao2_container *users;
+static struct ao2_container *users;
static struct ast_firmware_list {
struct iax_firmware *wares;
@@ -1152,7 +1152,7 @@
{
struct iax2_peer *peer = NULL;
int res = 0;
- ao2_iterator i;
+ struct ao2_iterator i;
i = ao2_iterator_init(peers, 0);
while ((peer = ao2_iterator_next(&i))) {
@@ -1731,7 +1731,7 @@
}
-static void reload_firmware(void)
+static void reload_firmware(int unload)
{
struct iax_firmware *cur, *curl, *curp;
DIR *fwd;
@@ -1745,22 +1745,25 @@
cur->dead = 1;
cur = cur->next;
}
+
/* Now that we've freed them, load the new ones */
- snprintf(dir, sizeof(dir), "%s/firmware/iax", (char *)ast_config_AST_DATA_DIR);
- fwd = opendir(dir);
- if (fwd) {
- while((de = readdir(fwd))) {
- if (de->d_name[0] != '.') {
- snprintf(fn, sizeof(fn), "%s/%s", dir, de->d_name);
- if (!try_firmware(fn)) {
- if (option_verbose > 1)
- ast_verbose(VERBOSE_PREFIX_2 "Loaded firmware '%s'\n", de->d_name);
+ if (!unload) {
+ snprintf(dir, sizeof(dir), "%s/firmware/iax", (char *)ast_config_AST_DATA_DIR);
+ fwd = opendir(dir);
+ if (fwd) {
+ while((de = readdir(fwd))) {
+ if (de->d_name[0] != '.') {
+ snprintf(fn, sizeof(fn), "%s/%s", dir, de->d_name);
+ if (!try_firmware(fn)) {
+ if (option_verbose > 1)
+ ast_verbose(VERBOSE_PREFIX_2 "Loaded firmware '%s'\n", de->d_name);
+ }
}
}
- }
- closedir(fwd);
- } else
- ast_log(LOG_WARNING, "Error opening firmware directory '%s': %s\n", dir, strerror(errno));
+ closedir(fwd);
+ } else
+ ast_log(LOG_WARNING, "Error opening firmware directory '%s': %s\n", dir, strerror(errno));
+ }
/* Clean up leftovers */
cur = waresl.wares;
@@ -2280,7 +2283,7 @@
struct iax2_peer *peer;
char *res = NULL;
int wordlen = strlen(word);
- ao2_iterator i;
+ struct ao2_iterator i;
/* 0 - iax2; 1 - show; 2 - peer; 3 - <peername> */
if (pos != 3)
@@ -3486,7 +3489,7 @@
{
struct iax2_peer *peer;
int res = 0;
- ao2_iterator i;
+ struct ao2_iterator i;
i = ao2_iterator_init(peers, 0);
while ((peer = ao2_iterator_next(&i))) {
@@ -4215,7 +4218,7 @@
struct iax2_user *user = NULL;
char auth[90];
char *pstr = "";
- ao2_iterator i;
+ struct ao2_iterator i;
switch (argc) {
case 5:
@@ -4273,7 +4276,7 @@
int online_peers = 0;
int offline_peers = 0;
int unmonitored_peers = 0;
- ao2_iterator i;
+ struct ao2_iterator i;
#define FORMAT2 "%-15.15s %-15.15s %s %-15.15s %-8s %s %-10s%s"
#define FORMAT "%-15.15s %-15.15s %s %-15.15s %-5d%s %s %-10s%s"
@@ -4838,7 +4841,7 @@
int bestscore = 0;
int gotcapability = 0;
struct ast_variable *v = NULL, *tmpvar = NULL;
- ao2_iterator i;
+ struct ao2_iterator i;
if (!iaxs[callno])
return res;
@@ -5429,7 +5432,7 @@
/* Normal password authentication */
res = authenticate(p->challenge, override, okey, authmethods, &ied, sin, &p->ecx, &p->dcx);
} else {
- ao2_iterator i = ao2_iterator_init(peers, 0);
+ struct ao2_iterator i = ao2_iterator_init(peers, 0);
while ((peer = ao2_iterator_next(&i))) {
if ((ast_strlen_zero(p->peer) || !strcmp(p->peer, peer->name))
/* No peer specified at our end, or this is the peer */
@@ -9026,20 +9029,16 @@
ast_sched_del(sched, peer->expire);
peer->expire = -1;
ast_clear_flag(peer, IAX_DYNAMIC);
- if (ast_dnsmgr_lookup(v->value, &peer->addr.sin_addr, &peer->dnsmgr)) {
- ast_string_field_free_pools(peer);
+ if (ast_dnsmgr_lookup(v->value, &peer->addr.sin_addr, &peer->dnsmgr))
return peer_unref(peer);
- }
if (!peer->addr.sin_port)
peer->addr.sin_port = htons(IAX_DEFAULT_PORTNO);
}
if (!maskfound)
inet_aton("255.255.255.255", &peer->mask);
} else if (!strcasecmp(v->name, "defaultip")) {
- if (ast_get_ip(&peer->defaddr, v->value)) {
- ast_string_field_free_pools(peer);
+ if (ast_get_ip(&peer->defaddr, v->value))
return peer_unref(peer);
- }
} else if (!strcasecmp(v->name, "sourceaddress")) {
peer_set_srcaddr(peer, v->value);
} else if (!strcasecmp(v->name, "permit") ||
@@ -9419,7 +9418,7 @@
static void prune_users(void)
{
struct iax2_user *user;
- ao2_iterator i;
+ struct ao2_iterator i;
i = ao2_iterator_init(users, 0);
while ((user = ao2_iterator_next(&i))) {
@@ -9433,7 +9432,7 @@
static void prune_peers(void)
{
struct iax2_peer *peer;
- ao2_iterator i;
+ struct ao2_iterator i;
i = ao2_iterator_init(peers, 0);
while ((peer = ao2_iterator_next(&i))) {
@@ -9838,7 +9837,7 @@
AST_LIST_UNLOCK(®istrations);
/* Qualify hosts, too */
ao2_callback(peers, 0, iax2_poke_peer_cb, NULL);
- reload_firmware();
+ reload_firmware(0);
iax_provision_reload();
return 0;
@@ -10620,6 +10619,7 @@
delete_users();
iax_provision_unload();
sched_context_destroy(sched);
+ reload_firmware(1);
ast_mutex_destroy(&waresl.lock);
@@ -10751,7 +10751,7 @@
ao2_callback(peers, 0, peer_set_sock_cb, NULL);
ao2_callback(peers, 0, iax2_poke_peer_cb, NULL);
- reload_firmware();
+ reload_firmware(0);
iax_provision_reload();
return res;
}
Modified: team/mmichelson/queue_refcount/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/queue_refcount/channels/chan_sip.c?view=diff&rev=81451&r1=81450&r2=81451
==============================================================================
--- team/mmichelson/queue_refcount/channels/chan_sip.c (original)
+++ team/mmichelson/queue_refcount/channels/chan_sip.c Tue Sep 4 14:50:43 2007
@@ -8328,11 +8328,11 @@
}
/* Ok, we have a bad username/secret pair */
- /* Challenge again, and again, and again */
- transmit_response_with_auth(p, response, req, p->randdata, reliable, respheader, 0);
- sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);
-
- return AUTH_CHALLENGE_SENT;
+ /* Tell the UAS not to re-send this authentication data, because
+ it will continue to fail
+ */
+
+ return AUTH_SECRET_FAILED;
}
/*! \brief Change onhold state of a peer using a pvt structure */
Modified: team/mmichelson/queue_refcount/funcs/func_logic.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/queue_refcount/funcs/func_logic.c?view=diff&rev=81451&r1=81450&r2=81451
==============================================================================
--- team/mmichelson/queue_refcount/funcs/func_logic.c (original)
+++ team/mmichelson/queue_refcount/funcs/func_logic.c Tue Sep 4 14:50:43 2007
@@ -91,27 +91,30 @@
static int acf_if(struct ast_channel *chan, char *cmd, char *data, char *buf,
size_t len)
{
- char *expr;
- char *iftrue;
- char *iffalse;
-
- data = ast_strip_quoted(data, "\"", "\"");
- expr = strsep(&data, "?");
- iftrue = strsep(&data, ":");
- iffalse = data;
-
- if (ast_strlen_zero(expr) || !(iftrue || iffalse)) {
+ AST_DECLARE_APP_ARGS(args1,
+ AST_APP_ARG(expr);
+ AST_APP_ARG(remainder);
+ );
+ AST_DECLARE_APP_ARGS(args2,
+ AST_APP_ARG(iftrue);
+ AST_APP_ARG(iffalse);
+ );
+
+ AST_NONSTANDARD_APP_ARGS(args1, data, '?');
+ AST_NONSTANDARD_APP_ARGS(args2, args1.remainder, ':');
+
+ if (ast_strlen_zero(args1.expr) || !(args2.iftrue || args2.iffalse)) {
ast_log(LOG_WARNING, "Syntax IF(<expr>?[<true>][:<false>])\n");
return -1;
}
- expr = ast_strip(expr);
- if (iftrue)
- iftrue = ast_strip_quoted(iftrue, "\"", "\"");
- if (iffalse)
- iffalse = ast_strip_quoted(iffalse, "\"", "\"");
-
- ast_copy_string(buf, pbx_checkcondition(expr) ? (S_OR(iftrue, "")) : (S_OR(iffalse, "")), len);
+ args1.expr = ast_strip(args1.expr);
+ if (args2.iftrue)
+ args2.iftrue = ast_strip(args2.iftrue);
+ if (args2.iffalse)
+ args2.iffalse = ast_strip(args2.iffalse);
+
+ ast_copy_string(buf, pbx_checkcondition(args1.expr) ? (S_OR(args2.iftrue, "")) : (S_OR(args2.iffalse, "")), len);
return 0;
}
Modified: team/mmichelson/queue_refcount/include/asterisk/astobj2.h
URL: http://svn.digium.com/view/asterisk/team/mmichelson/queue_refcount/include/asterisk/astobj2.h?view=diff&rev=81451&r1=81450&r2=81451
==============================================================================
--- team/mmichelson/queue_refcount/include/asterisk/astobj2.h (original)
+++ team/mmichelson/queue_refcount/include/asterisk/astobj2.h Tue Sep 4 14:50:43 2007
@@ -87,9 +87,9 @@
<b>Sample Usage:</b>
\code
- ao2_container *c;
-
- c = ao2_container_alloc(MAX_BUCKETS, my_hash_fn, my_cmp_fn, my_dump_fn);
+ struct ao2_container *c;
+
+ c = ao2_container_alloc(MAX_BUCKETS, my_hash_fn, my_cmp_fn);
where
- MAX_BUCKETS is the number of buckets in the hash table,
@@ -98,7 +98,6 @@
by the container's code);
- my_cmp_fn() is the default comparison function used when doing
searches on the container,
-- my_dump_fn() is a helper function used only for debugging.
A container knows little or nothing about the object itself,
other than the fact that it has been created by ao2_alloc()
@@ -240,8 +239,8 @@
iterate on a container
this is done with the following sequence
- ao2_container *c = ... // our container
- ao2_iterator i;
+ struct ao2_container *c = ... // our container
+ struct ao2_iterator i;
void *o;
i = ao2_iterator_init(c, flags);
@@ -321,14 +320,7 @@
/*!
* Here start declarations of containers.
*/
-
-/*!
- * This structure contains the total number of buckets
- * and variable size array of object pointers.
- * It is opaque, defined in astobj2.c, so we only need
- * a type declaration.
- */
-typedef struct __ao2_container ao2_container;
+struct ao2_container;
/*!
* Allocate and initialize a container
@@ -344,13 +336,13 @@
*
* destructor is set implicitly.
*/
-ao2_container *ao2_container_alloc(const uint n_buckets,
+struct ao2_container *ao2_container_alloc(const uint n_buckets,
ao2_hash_fn hash_fn, ao2_callback_fn cmp_fn);
/*!
* Returns the number of elements in a container.
*/
-int ao2_container_count(ao2_container *c);
+int ao2_container_count(struct ao2_container *c);
/*
* Here we have functions to manage objects.
@@ -376,8 +368,8 @@
* matching behavior doesn't change.
*/
#define ao2_link(c, o) __ao2_link(c, o, 0)
-void *__ao2_link(ao2_container *c, void *newobj, int iax2_hack);
-void *ao2_unlink(ao2_container *c, void *newobj);
+void *__ao2_link(struct ao2_container *c, void *newobj, int iax2_hack);
+void *ao2_unlink(struct ao2_container *c, void *newobj);
/*! \struct Used as return value if the flag OBJ_MULTIPLE is set */
struct ao2_list {
@@ -433,11 +425,12 @@
* be used to free the additional reference possibly created by this function.
*/
/* XXX order of arguments to find */
-void *ao2_find(ao2_container *c, void *arg, enum search_flags flags);
-void *ao2_callback(ao2_container *c,
+void *ao2_find(struct ao2_container *c, void *arg, enum search_flags flags);
+void *ao2_callback(struct ao2_container *c,
enum search_flags flags,
ao2_callback_fn cb_fn, void *arg);
+int ao2_match_by_addr(void *user_data, void *arg, int flags);
/*!
*
*
@@ -472,8 +465,8 @@
*
* \code
*
- * ao2_container *c = ... // the container we want to iterate on
- * ao2_iterator i;
+ * struct ao2_container *c = ... // the container we want to iterate on
+ * struct ao2_iterator i;
* struct my_obj *o;
*
* i = ao2_iterator_init(c, flags);
@@ -510,9 +503,9 @@
* A freshly-initialized iterator has bucket=0, version = 0.
*/
-struct __ao2_iterator {
+struct ao2_iterator {
/*! the container */
- ao2_container *c;
+ struct ao2_container *c;
/*! operation flags */
int flags;
#define F_AO2I_DONTLOCK 1 /*!< don't lock when iterating */
@@ -524,11 +517,10 @@
void *obj;
/*! container version when the object was created */
uint version;
-};
-typedef struct __ao2_iterator ao2_iterator;
-
-ao2_iterator ao2_iterator_init(ao2_container *c, int flags);
-
-void *ao2_iterator_next(ao2_iterator *a);
+};
+
+struct ao2_iterator ao2_iterator_init(struct ao2_container *c, int flags);
+
+void *ao2_iterator_next(struct ao2_iterator *a);
#endif /* _ASTERISK_ASTOBJ2_H */
Modified: team/mmichelson/queue_refcount/main/astobj2.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/queue_refcount/main/astobj2.c?view=diff&rev=81451&r1=81450&r2=81451
==============================================================================
--- team/mmichelson/queue_refcount/main/astobj2.c (original)
+++ team/mmichelson/queue_refcount/main/astobj2.c Tue Sep 4 14:50:43 2007
@@ -243,7 +243,7 @@
* This will be more efficient as we can do the freelist management while
* we hold the lock (that we need anyways).
*/
-struct __ao2_container {
+struct ao2_container {
ao2_hash_fn hash_fn;
ao2_callback_fn cmp_fn;
int n_buckets;
@@ -272,15 +272,15 @@
/*
* A container is just an object, after all!
*/
-ao2_container *
+struct ao2_container *
ao2_container_alloc(const uint n_buckets, ao2_hash_fn hash_fn,
ao2_callback_fn cmp_fn)
{
/* XXX maybe consistency check on arguments ? */
/* compute the container size */
- size_t container_size = sizeof(ao2_container) + n_buckets * sizeof(struct bucket);
-
- ao2_container *c = ao2_alloc(container_size, container_destruct);
+ size_t container_size = sizeof(struct ao2_container) + n_buckets * sizeof(struct bucket);
+
+ struct ao2_container *c = ao2_alloc(container_size, container_destruct);
if (!c)
return NULL;
@@ -297,7 +297,7 @@
/*!
* return the number of elements in the container
*/
-int ao2_container_count(ao2_container *c)
+int ao2_container_count(struct ao2_container *c)
{
return c->elements;
}
@@ -316,7 +316,7 @@
/*
* link an object to a container
*/
-void *__ao2_link(ao2_container *c, void *user_data, int iax2_hack)
+void *__ao2_link(struct ao2_container *c, void *user_data, int iax2_hack)
{
int i;
/* create a new list entry */
@@ -352,7 +352,7 @@
/*!
* \brief another convenience function is a callback that matches on address
*/
-static int match_by_addr(void *user_data, void *arg, int flags)
+int ao2_match_by_addr(void *user_data, void *arg, int flags)
{
return (user_data == arg) ? (CMP_MATCH | CMP_STOP) : 0;
}
@@ -361,12 +361,12 @@
* Unlink an object from the container
* and destroy the associated * ao2_bucket_list structure.
*/
-void *ao2_unlink(ao2_container *c, void *user_data)
+void *ao2_unlink(struct ao2_container *c, void *user_data)
{
if (INTERNAL_OBJ(user_data) == NULL) /* safety check on the argument */
return NULL;
- ao2_callback(c, OBJ_UNLINK | OBJ_POINTER | OBJ_NODATA, match_by_addr, user_data);
+ ao2_callback(c, OBJ_UNLINK | OBJ_POINTER | OBJ_NODATA, ao2_match_by_addr, user_data);
return NULL;
}
@@ -384,7 +384,7 @@
* \return Is a pointer to an object or to a list of object if OBJ_MULTIPLE is
* specified.
*/
-void *ao2_callback(ao2_container *c,
+void *ao2_callback(struct ao2_container *c,
const enum search_flags flags,
ao2_callback_fn cb_fn, void *arg)
{
@@ -488,7 +488,7 @@
/*!
* the find function just invokes the default callback with some reasonable flags.
*/
-void *ao2_find(ao2_container *c, void *arg, enum search_flags flags)
+void *ao2_find(struct ao2_container *c, void *arg, enum search_flags flags)
{
return ao2_callback(c, flags, c->cmp_fn, arg);
}
@@ -496,9 +496,9 @@
/*!
* initialize an iterator so we start from the first object
*/
-ao2_iterator ao2_iterator_init(ao2_container *c, int flags)
-{
- ao2_iterator a = {
+struct ao2_iterator ao2_iterator_init(struct ao2_container *c, int flags)
+{
+ struct ao2_iterator a = {
.c = c,
.flags = flags
};
@@ -509,7 +509,7 @@
/*
* move to the next element in the container.
*/
-void * ao2_iterator_next(ao2_iterator *a)
+void * ao2_iterator_next(struct ao2_iterator *a)
{
int lim;
struct bucket_list *p = NULL;
@@ -574,7 +574,7 @@
static void container_destruct(void *_c)
{
- ao2_container *c = _c;
+ struct ao2_container *c = _c;
ao2_callback(c, OBJ_UNLINK, cd_cb, NULL);
ast_atomic_fetchadd_int(&ao2.total_containers, -1);
@@ -607,7 +607,7 @@
*/
static int handle_astobj2_test(int fd, int argc, char *argv[])
{
- ao2_container *c1;
+ struct ao2_container *c1;
int i, lim;
char *obj;
static int prof_id = -1;
@@ -645,7 +645,7 @@
ast_cli(fd, "testing iterators, remove every second object\n");
{
- ao2_iterator ai;
+ struct ao2_iterator ai;
int x = 0;
ai = ao2_iterator_init(c1, 0);
Modified: team/mmichelson/queue_refcount/main/channel.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/queue_refcount/main/channel.c?view=diff&rev=81451&r1=81450&r2=81451
==============================================================================
--- team/mmichelson/queue_refcount/main/channel.c (original)
+++ team/mmichelson/queue_refcount/main/channel.c Tue Sep 4 14:50:43 2007
@@ -2080,11 +2080,13 @@
int ast_waitfordigit_full(struct ast_channel *c, int ms, int audiofd, int cmdfd)
{
- int begin_digit = 0;
-
/* Stop if we're a zombie or need a soft hangup */
if (ast_test_flag(c, AST_FLAG_ZOMBIE) || ast_check_hangup(c))
return -1;
+
+ /* Only look for the end of DTMF, don't bother with the beginning and don't emulate things */
+ ast_set_flag(c, AST_FLAG_END_DTMF_ONLY);
+
/* Wait for a digit, no more than ms milliseconds total. */
while (ms) {
struct ast_channel *rchan;
@@ -2096,9 +2098,11 @@
if (errno == 0 || errno == EINTR)
continue;
ast_log(LOG_WARNING, "Wait failed (%s)\n", strerror(errno));
+ ast_clear_flag(c, AST_FLAG_END_DTMF_ONLY);
return -1;
} else if (outfd > -1) {
/* The FD we were watching has something waiting */
+ ast_clear_flag(c, AST_FLAG_END_DTMF_ONLY);
return 1;
} else if (rchan) {
int res;
@@ -2108,18 +2112,17 @@
switch(f->frametype) {
case AST_FRAME_DTMF_BEGIN:
- begin_digit = f->subclass;
break;
case AST_FRAME_DTMF_END:
- if (begin_digit != f->subclass)
- break;
res = f->subclass;
ast_frfree(f);
+ ast_clear_flag(c, AST_FLAG_END_DTMF_ONLY);
return res;
case AST_FRAME_CONTROL:
switch(f->subclass) {
case AST_CONTROL_HANGUP:
ast_frfree(f);
+ ast_clear_flag(c, AST_FLAG_END_DTMF_ONLY);
return -1;
case AST_CONTROL_RINGING:
case AST_CONTROL_ANSWER:
@@ -2141,6 +2144,9 @@
ast_frfree(f);
}
}
+
+ ast_clear_flag(c, AST_FLAG_END_DTMF_ONLY);
+
return 0; /* Time is up */
}
Modified: team/mmichelson/queue_refcount/main/dns.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/queue_refcount/main/dns.c?view=diff&rev=81451&r1=81450&r2=81451
==============================================================================
--- team/mmichelson/queue_refcount/main/dns.c (original)
+++ team/mmichelson/queue_refcount/main/dns.c Tue Sep 4 14:50:43 2007
@@ -267,7 +267,7 @@
ast_log(LOG_WARNING, "DNS Parse error for %s\n", dname);
ret = -1;
}
- else if (ret == 0) {
+ else if (res == 0) {
ast_log(LOG_DEBUG, "No matches found in DNS for %s\n", dname);
ret = 0;
}
More information about the asterisk-commits
mailing list