Ejemplo n.º 1
0
static int w_ds_is_in_list(struct sip_msg *msg,char *ip,char *port,char *set,
															char *active_only)
{
	ds_partition_t *partition = default_partition;
	int i_set = -1;

	if (set != NULL) {
		ds_param_t *setparam = (ds_param_t*)set;
		if (fixup_get_partition(msg, &setparam->partition, &partition) != 0)
			goto wrong_set_arg;

		if (setparam->sets == NULL)
			i_set = -1;
		else
			if (setparam->sets->type == GPARAM_TYPE_INT) {
				if (setparam->sets->next == NULL)
					i_set = setparam->sets->v.ival;
				else {
					LM_ERR("Only one set is allowed\n");
					return -1;
				}
			}
			else {
				int_list_t *tmp_lst =
					set_list_from_pvs(msg, setparam->sets->v.pvs, NULL);
				if (tmp_lst == NULL){
					LM_ERR("Wrong set var value\n");
					return -1;
				}
				if (tmp_lst->next != NULL) {
					LM_ERR("Only one set is allowd\n");
					return -1;
				}
				i_set = tmp_lst->v.ival;
				free_int_list(tmp_lst, NULL);
			}
	}
	if (partition == NULL) {
		LM_ERR ("unknown partition\n");
		return -1;
	}

	return ds_is_in_list(msg, (gparam_t *)ip, (gparam_t *)port, i_set,
			(int)(long)active_only, partition);

wrong_set_arg:
		LM_ERR("wrong format for set argument\n");
		return -1;
}
Ejemplo n.º 2
0
static int w_ds_is_in_list3(struct sip_msg *msg,char *ip,char *port,char *set)
{
	return ds_is_in_list(msg,(pv_spec_t*)ip,(pv_spec_t*)port,(int)(long)set,0);
}
Ejemplo n.º 3
0
static int w_ds_is_in_list4(struct sip_msg *msg,char *ip,char *port,char *set,
															char *active_only)
{
	return ds_is_in_list(msg,(pv_spec_t*)ip,(pv_spec_t*)port,
		(int)(long)set, (int)(long)active_only);
}
Ejemplo n.º 4
0
static int w_ds_is_in_list2(struct sip_msg *msg, char *ip, char *port)
{
	return ds_is_in_list(msg, (pv_spec_t*)ip, (pv_spec_t*)port, -1, 0);
}