Browse code

kemix: exported functions to get dst-uri variants

Daniel-Constantin Mierla authored on 28/01/2020 13:35:13
Showing 1 changed files
... ...
@@ -670,6 +670,46 @@ static sr_kemi_xval_t* ki_kx_getw_body(sip_msg_t *msg)
670 670
 	return ki_kx_get_body_mode(msg, SR_KEMI_XVAL_NULL_PRINT);
671 671
 }
672 672
 
673
+/**
674
+ *
675
+ */
676
+static sr_kemi_xval_t* ki_kx_get_duri_mode(sip_msg_t *msg, int xmode)
677
+{
678
+	memset(&_sr_kemi_kx_xval, 0, sizeof(sr_kemi_xval_t));
679
+	if(msg->dst_uri.s==NULL || msg->dst_uri.len<=0) {
680
+		sr_kemi_xval_null(&_sr_kemi_kx_xval, xmode);
681
+		return &_sr_kemi_kx_xval;
682
+	}
683
+
684
+	_sr_kemi_kx_xval.vtype = SR_KEMIP_STR;
685
+	_sr_kemi_kx_xval.v.s = msg->dst_uri;
686
+	return &_sr_kemi_kx_xval;
687
+}
688
+
689
+/**
690
+ *
691
+ */
692
+static sr_kemi_xval_t* ki_kx_get_duri(sip_msg_t *msg)
693
+{
694
+	return ki_kx_get_duri_mode(msg, SR_KEMI_XVAL_NULL_NONE);
695
+}
696
+
697
+/**
698
+ *
699
+ */
700
+static sr_kemi_xval_t* ki_kx_getw_duri(sip_msg_t *msg)
701
+{
702
+	return ki_kx_get_duri_mode(msg, SR_KEMI_XVAL_NULL_PRINT);
703
+}
704
+
705
+/**
706
+ *
707
+ */
708
+static sr_kemi_xval_t* ki_kx_gete_duri(sip_msg_t *msg)
709
+{
710
+	return ki_kx_get_duri_mode(msg, SR_KEMI_XVAL_NULL_EMPTY);
711
+}
712
+
673 713
 /**
674 714
  *
675 715
  */
... ...
@@ -755,6 +795,22 @@ static sr_kemi_t sr_kemi_kx_exports[] = {
755 795
 		{ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
756 796
 			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
757 797
 	},
798
+	{ str_init("kx"), str_init("get_duri"),
799
+		SR_KEMIP_XVAL, ki_kx_get_duri,
800
+		{ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
801
+			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
802
+	},
803
+	{ str_init("kx"), str_init("gete_duri"),
804
+		SR_KEMIP_XVAL, ki_kx_gete_duri,
805
+		{ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
806
+			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
807
+	},
808
+	{ str_init("kx"), str_init("getw_duri"),
809
+		SR_KEMIP_XVAL, ki_kx_getw_duri,
810
+		{ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
811
+			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
812
+	},
813
+
758 814
 	{ str_init("kx"), str_init("get_ua"),
759 815
 		SR_KEMIP_XVAL, ki_kx_get_ua,
760 816
 		{ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,