Example #1
0
static int w_ds_mark_dst1(struct sip_msg *msg, char *str1, char *str2)
{
	if(str1 && (str1[0]=='i' || str1[0]=='I' || str1[0]=='0'))
		return ds_mark_dst(msg, 0);
	else if(str1 && (str1[0]=='p' || str1[0]=='P' || str1[0]=='2'))
		return ds_mark_dst(msg, 2);
	else
		return ds_mark_dst(msg, 1);
}
Example #2
0
static int w_ds_mark_dst(struct sip_msg *msg, char *str1, char *str2)
{
	str arg = {NULL, 0};
	ds_partition_t *partition = default_partition;

	if (str2 != NULL) {
		/* We have two args */
		if (str1 != NULL)
			GET_AND_CHECK_PARTITION(str1, partition);

		if (fixup_get_svalue(msg, (gparam_p)str2, &arg) != 0)
			goto error;
	}
	else {
		if (str1 != NULL && fixup_get_svalue(msg, (gparam_p)str1, &arg) != 0)
				goto error;
	}

	if (arg.len > 1) {
		LM_ERR ("unknown option %.*s\n", arg.len, arg.s);
		return -1;
	}

	if (partition == NULL) {
		LM_ERR ("unknown partition\n");
		return -1;
	}

	if((arg.s == NULL || arg.s[0]=='i' || arg.s[0]=='I' || arg.s[0]=='0'))
		return ds_mark_dst(msg, 0, partition);
	else if(arg.s && (arg.s[0]=='p' || arg.s[0]=='P' || arg.s[0]=='2'))
		return ds_mark_dst(msg, 2, partition);
	else if(arg.s && (arg.s[0]=='a' || arg.s[0]=='A' || arg.s[0]=='1'))
		return ds_mark_dst(msg, 1, partition);
	else {
		LM_ERR ("unknown option %.*s\n", arg.len, arg.s);
		return -1;
	}

error:
	LM_ERR("wrong arguments\n");
	return -1;
}
Example #3
0
static int w_ds_mark_dst0(struct sip_msg *msg, char *str1, char *str2)
{
	int state;

	state = DS_INACTIVE_DST;
	if (ds_probing_mode==DS_PROBE_ALL)
		state |= DS_PROBING_DST;

	return ds_mark_dst(msg, state);
}
Example #4
0
static int w_ds_mark_dst1(struct sip_msg *msg, char *str1, char *str2)
{
	int state;

	if(str1 == NULL)
		return w_ds_mark_dst0(msg, NULL, NULL);

	state = ds_parse_flags(str1, strlen(str1));

	if(state < 0) {
		LM_WARN("Failed to parse flag: %s", str1);
		return -1;
	}

	return ds_mark_dst(msg, state);
}
Example #5
0
static int w_ds_mark_dst1(struct sip_msg *msg, char *str1, char *str2)
{
	int state;
	int len;

	if(str1==NULL)
		return w_ds_mark_dst0(msg, NULL, NULL);

	len = strlen(str1);
	state = 0;
	if (len>1 && (str1[1]=='p' || str1[1]=='P'))
		state |= DS_PROBING_DST;

	if(str1[0]=='i' || str1[0]=='I')
		state |= DS_INACTIVE_DST;
	else if(str1[0]=='t' || str1[0]=='T')
		state |= DS_TRYING_DST;
	else if(str1[0]=='d' || str1[0]=='D')
		state = DS_DISABLED_DST;
	else if(str1[0]=='p' || str1[0]=='P')
		state =  DS_INACTIVE_DST|DS_PROBING_DST;
	return ds_mark_dst(msg, state);
}
Example #6
0
static int w_ds_mark_dst0(struct sip_msg *msg, char *str1, char *str2)
{
	return ds_mark_dst(msg, 0);
}