[asterisk-commits] nadi: branch group/trunk-cm-csel-hash r47358 - in
/team/group/trunk-cm-csel-h...
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Thu Nov 9 05:11:19 MST 2006
Author: nadi
Date: Thu Nov 9 06:11:18 2006
New Revision: 47358
URL: http://svn.digium.com/view/asterisk?view=rev&rev=47358
Log:
res_csel: renaming method -> strategy
Modified:
team/group/trunk-cm-csel-hash/channels/chan_misdn.c
team/group/trunk-cm-csel-hash/include/asterisk/csel.h
team/group/trunk-cm-csel-hash/res/res_csel.c
Modified: team/group/trunk-cm-csel-hash/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/team/group/trunk-cm-csel-hash/channels/chan_misdn.c?view=diff&rev=47358&r1=47357&r2=47358
==============================================================================
--- team/group/trunk-cm-csel-hash/channels/chan_misdn.c (original)
+++ team/group/trunk-cm-csel-hash/channels/chan_misdn.c Thu Nov 9 06:11:18 2006
@@ -331,8 +331,8 @@
"Sets the musiconhold class." },
{ "callerid", "",
"Sets the caller ID." },
- CM_CSEL_METHOD,
- CM_CSEL_METHOD_PARMS,
+ CM_CSEL_STRATEGY,
+ CM_CSEL_STRATEGY_PARMS,
{ "dialplan", "0",
"Dialplan means Type Of Number in ISDN Terms (for outgoing calls)\n"
"\n"
@@ -503,8 +503,8 @@
MCFG_LANGUAGE,
MCFG_MUSICCLASS,
MCFG_CALLERID,
- MCFG_METHOD,
- MCFG_METHOD_PARMS,
+ MCFG_STRATEGY,
+ MCFG_STRATEGY_PARMS,
MCFG_DIALPLAN,
MCFG_LOCALDIALPLAN,
MCFG_CPNDIALPLAN,
@@ -952,7 +952,7 @@
i,
*prev = NULL;
char buf[BUFFERSIZE],
- method[BUFFERSIZE],
+ strategy[BUFFERSIZE],
params[BUFFERSIZE];
struct csel *cs = NULL;
struct misdn_csel_item *item;
@@ -965,9 +965,9 @@
if (!num_chans)
continue;
if (AST_HASH_LOOKUP(&group_csel_hash, buf, cs)) {
- cm_get(misdn_cm, method, sizeof(method), PORT, MCFG_METHOD, port);
- cm_get(misdn_cm, params, sizeof(params), PORT, MCFG_METHOD_PARMS, port);
- cs = csel_create(method, params, misdn_occupy, free);
+ cm_get(misdn_cm, strategy, sizeof(strategy), PORT, MCFG_STRATEGY, port);
+ cm_get(misdn_cm, params, sizeof(params), PORT, MCFG_STRATEGY_PARMS, port);
+ cs = csel_create(strategy, params, misdn_occupy, free);
if (!cs)
continue;
AST_HASH_INSERT(&group_csel_hash, strdup(buf), cs);
Modified: team/group/trunk-cm-csel-hash/include/asterisk/csel.h
URL: http://svn.digium.com/view/asterisk/team/group/trunk-cm-csel-hash/include/asterisk/csel.h?view=diff&rev=47358&r1=47357&r2=47358
==============================================================================
--- team/group/trunk-cm-csel-hash/include/asterisk/csel.h (original)
+++ team/group/trunk-cm-csel-hash/include/asterisk/csel.h Thu Nov 9 06:11:18 2006
@@ -24,19 +24,19 @@
#ifndef _ASTERISK_CSEL_H
#define _ASTERISK_CSEL_H
-/* !\brief Entry for Configman: method
+/* !\brief Entry for Configman: strategy
*/
-#define CM_CSEL_METHOD \
-{ "method", "standard", \
- "Sets the method to use for channel selection.\n" \
- "\tEnter 'csel list methods' to list the possible values." }
+#define CM_CSEL_STRATEGY \
+{ "strategy", "standard", \
+ "Sets the strategy to use for channel selection.\n" \
+ "\tEnter 'csel list strategies' to list the possible values." }
-/* !\brief Entry for Configman: method_parms
+/* !\brief Entry for Configman: strategy_parms
*/
-#define CM_CSEL_METHOD_PARMS \
-{ "method_parms", "", \
+#define CM_CSEL_STRATEGY_PARMS \
+{ "strategy_parms", "", \
"Optional parameters passed to the channel selection algorithm.\n" \
- "\tEnter 'csel list methods' to see which methods take which\n" \
+ "\tEnter 'csel list strategies' to see which strategies take which\n" \
"\tparameters." }
/* !\brief Private csel structure
@@ -60,15 +60,15 @@
/* !\brief Create a channel selection structure
- * \param method Name of the method to be used, usually configured in the channel drivers config file
- * \param params Parameters passed to the init function of the method
+ * \param strategy Name of the strategy to be used, usually configured in the channel drivers config file
+ * \param params Parameters passed to the init function of the strategy
* \param occupy Function pointer to the channel drivers occupy function
* \param free Function used by csel_destroy on the added priv's. NULL if you don't want that to happen
* Allocates and initializes a csel structure.
*
* Returns NULL on error.
*/
-struct csel * csel_create (const char *method,
+struct csel * csel_create (const char *strategy,
const char *params,
occupy_func occupy,
free_func free);
@@ -101,7 +101,7 @@
* \param cs The channel selection structure
* \param priv Private pointer to a structure representing a channel
* \param uid Unique identifier for that call
- * Registers a starting call, may be useful for some methods.
+ * Registers a starting call, may be useful for some strategies.
*/
void csel_call (struct csel *cs,
void *priv,
@@ -111,7 +111,7 @@
* \param cs The channel selection structure
* \param priv Private pointer to a structure representing a channel
* \param uid Unique identifier for that call
- * Registers a hangup, may be useful for some methods.
+ * Registers a hangup, may be useful for some strategies.
*/
void csel_hangup (struct csel *cs,
void *priv,
Modified: team/group/trunk-cm-csel-hash/res/res_csel.c
URL: http://svn.digium.com/view/asterisk/team/group/trunk-cm-csel-hash/res/res_csel.c?view=diff&rev=47358&r1=47357&r2=47358
==============================================================================
--- team/group/trunk-cm-csel-hash/res/res_csel.c (original)
+++ team/group/trunk-cm-csel-hash/res/res_csel.c Thu Nov 9 06:11:18 2006
@@ -44,11 +44,11 @@
occupy_func occupy;
free_func free;
- struct method * m;
+ struct strategy * m;
void * data;
};
-struct method {
+struct strategy {
char * name;
char * desc;
char * desc_params;
@@ -235,7 +235,7 @@
}
/* ROUND ROBIN: end */
-static struct method methods[] = {
+static struct strategy strategies[] = {
{ "standard", "Select the first free channel. This is the default.", 0,
standard_init, standard_destroy, standard_add, standard_get_next, 0, 0 },
{ "random", "Select a random free channel.", 0,
@@ -244,7 +244,7 @@
rr_init, rr_destroy, rr_add, rr_get_next, 0, 0 },
};
-struct csel * csel_create (const char *method,
+struct csel * csel_create (const char *strategy,
const char *params,
occupy_func occupy,
free_func free)
@@ -252,13 +252,13 @@
struct csel *cs;
int i = 0;
- if (method && *method) {
- for (; i < (sizeof(methods) / sizeof(struct method)); ++i) {
- if (!strcasecmp(methods[i].name, method))
+ if (strategy && *strategy) {
+ for (; i < (sizeof(strategies) / sizeof(struct strategy)); ++i) {
+ if (!strcasecmp(strategies[i].name, strategy))
break;
}
- if (i == (sizeof(methods) / sizeof(struct method))) {
- ast_log(LOG_WARNING, "csel: unknown method: %s, falling back to: %s\n", method, methods[0].name);
+ if (i == (sizeof(strategies) / sizeof(struct strategy))) {
+ ast_log(LOG_WARNING, "csel: unknown strategy: %s, falling back to: %s\n", strategy, strategies[0].name);
i = 0;
}
}
@@ -266,7 +266,7 @@
cs = calloc(1, sizeof(struct csel));
cs->occupy = occupy;
- cs->m = &methods[i];
+ cs->m = &strategies[i];
if (cs->m->init(cs, params)) {
free(cs);
@@ -332,29 +332,29 @@
UNLOCK(cs);
}
-static int csel_list_methods (int fd, int argc, char *argv[])
-{
- int i = 0;
- char method[128],
+static int csel_list_strategies (int fd, int argc, char *argv[])
+{
+ int i = 0;
+ char strategy[128],
desc[128],
params[128];
- term_color(method, "Method", COLOR_YELLOW, 0, sizeof(method));
+ term_color(strategy, "Strategy", COLOR_YELLOW, 0, sizeof(strategy));
term_color(desc, "Description", COLOR_BRWHITE, 0, sizeof(desc));
term_color(params, "Parameters", COLOR_BRWHITE, 0, sizeof(params));
- for (; i < (sizeof(methods) / sizeof(struct method)); ++i)
- ast_cli(fd, "%s: %s\n%s: %s\n%s: %s\n%s", method, methods[i].name,
- desc, methods[i].desc, params, methods[i].desc_params ? methods[i].desc_params : "(none)",
- (i + 1) < (sizeof(methods) / sizeof(struct method)) ? "\n" : "");
+ for (; i < (sizeof(strategies) / sizeof(struct strategy)); ++i)
+ ast_cli(fd, "%s: %s\n%s: %s\n%s: %s\n%s", strategy, strategies[i].name,
+ desc, strategies[i].desc, params, strategies[i].desc_params ? strategies[i].desc_params : "(none)",
+ (i + 1) < (sizeof(strategies) / sizeof(struct strategy)) ? "\n" : "");
return 0;
}
static struct ast_cli_entry csel_clis[] = {
- { { "csel", "list", "methods", NULL }, csel_list_methods,
- "List channel selection methods",
- "Usage: csel list methods\n" },
+ { { "csel", "list", "strategies", NULL }, csel_list_strategies,
+ "List channel selection strategies",
+ "Usage: csel list strategies\n" },
};
static int load_module (void)
More information about the asterisk-commits
mailing list