Browse code

pv: exported kemi functions to set root xavp values

Daniel-Constantin Mierla authored on 07/06/2019 07:14:43
Showing 1 changed files
... ...
@@ -902,6 +902,40 @@ static int w_xavp_params_implode(sip_msg_t *msg, char *pxname, char *pvname)
902 902
 /**
903 903
  *
904 904
  */
905
+static int ki_xavp_seti(sip_msg_t *msg, str *rname, int ival)
906
+{
907
+	sr_xavp_t *xavp = NULL;
908
+	sr_xval_t xval;
909
+
910
+	memset(&xval, 0, sizeof(sr_xval_t));
911
+	xval.type = SR_XTYPE_INT;
912
+	xval.v.i = ival;
913
+
914
+	xavp = xavp_add_value(rname, &xval, NULL);
915
+
916
+	return (xavp!=NULL)?1:-1;
917
+}
918
+
919
+/**
920
+ *
921
+ */
922
+static int ki_xavp_sets(sip_msg_t *msg, str *rname, str *sval)
923
+{
924
+	sr_xavp_t *xavp = NULL;
925
+	sr_xval_t xval;
926
+
927
+	memset(&xval, 0, sizeof(sr_xval_t));
928
+	xval.type = SR_XTYPE_STR;
929
+	xval.v.s = *sval;
930
+
931
+	xavp = xavp_add_value(rname, &xval, NULL);
932
+
933
+	return (xavp!=NULL)?1:-1;
934
+}
935
+
936
+/**
937
+ *
938
+ */
905 939
 static int ki_xavp_child_seti(sip_msg_t *msg, str *rname, str *cname,
906 940
 		int ival)
907 941
 {
... ...
@@ -1634,6 +1668,16 @@ static sr_kemi_t sr_kemi_pvx_exports[] = {
1634 1634
 		{ SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_NONE,
1635 1635
 			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
1636 1636
 	},
1637
+	{ str_init("pvx"), str_init("xavp_seti"),
1638
+		SR_KEMIP_INT, ki_xavp_seti,
1639
+		{ SR_KEMIP_STR, SR_KEMIP_INT, SR_KEMIP_NONE,
1640
+			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
1641
+	},
1642
+	{ str_init("pvx"), str_init("xavp_sets"),
1643
+		SR_KEMIP_INT, ki_xavp_sets,
1644
+		{ SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_NONE,
1645
+			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
1646
+	},
1637 1647
 	{ str_init("pvx"), str_init("xavp_get"),
1638 1648
 		SR_KEMIP_XVAL, ki_xavp_get,
1639 1649
 		{ SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE,