Skip to content

Commit

Permalink
dispatcher: reworked ds_print_mi_list flags parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
ionel-cerghit committed Jan 11, 2016
1 parent f471785 commit 829bd47
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion modules/dispatcher/dispatch.c
Expand Up @@ -2124,7 +2124,7 @@ int ds_print_mi_list(struct mi_node* rpl, ds_partition_t *partition, int flags)
goto error;
}

if (flags & 1) {
if (flags & MI_FULL_LISTING) {
p = int2str(list->dlist[j].weight, &len);
node1= add_mi_node_child(node, MI_DUP_VALUE, "weight", 6,
p, len);
Expand Down
3 changes: 3 additions & 0 deletions modules/dispatcher/dispatch.h
Expand Up @@ -69,6 +69,9 @@
#define DS_PARTITION_DELIM ':'
#define DS_DEFAULT_PARTITION_NAME "default"

#define MI_FULL_LISTING (1<<0)


extern int ds_persistent_state;

typedef struct _ds_dest
Expand Down
6 changes: 3 additions & 3 deletions modules/dispatcher/dispatcher.c
Expand Up @@ -1356,11 +1356,11 @@ static struct mi_root* ds_mi_list(struct mi_root* cmd_tree, void* param)
{
struct mi_root* rpl_tree;
struct mi_node* part_node;
int explicit = 0;
int flags = 0;

if (cmd_tree->node.kids){
if(cmd_tree->node.kids->value.len == 4 && memcmp(cmd_tree->node.kids->value.s,"full",4)==0)
explicit = 1;
flags |= MI_FULL_LISTING;
else
return init_mi_tree(400, MI_SSTR(MI_BAD_PARM_S));

Expand All @@ -1377,7 +1377,7 @@ static struct mi_root* ds_mi_list(struct mi_root* cmd_tree, void* param)
9, part_it->name.s, part_it->name.len);

if (part_node == NULL
|| ds_print_mi_list(part_node, part_it, explicit) < 0) {
|| ds_print_mi_list(part_node, part_it, flags) < 0) {
LM_ERR("failed to add node\n");
free_mi_tree(rpl_tree);
return 0;
Expand Down

0 comments on commit 829bd47

Please sign in to comment.