Browse code

pv: renamed xavp child management functions

- coherent pattern to reflect the operations

Daniel-Constantin Mierla authored on 06/06/2019 10:05:35
Showing 1 changed files
... ...
@@ -534,12 +534,12 @@ static int pv_typeof(sip_msg_t *msg, char *pv, char *t);
534 534
 static int pv_not_empty(sip_msg_t *msg, char *pv, char *s2);
535 535
 static int w_xavp_params_explode(sip_msg_t *msg, char *pparams, char *pxname);
536 536
 static int w_xavp_params_implode(sip_msg_t *msg, char *pxname, char *pvname);
537
-static int w_xavp_set_child_ival(sip_msg_t *msg, char *prname, char *pcname,
537
+static int w_xavp_child_seti(sip_msg_t *msg, char *prname, char *pcname,
538 538
 		char *pval);
539
-static int w_xavp_set_child_sval(sip_msg_t *msg, char *prname, char *pcname,
539
+static int w_xavp_child_sets(sip_msg_t *msg, char *prname, char *pcname,
540 540
 		char *pval);
541 541
 static int w_xavp_rm(sip_msg_t *msg, char *prname, char *p2);
542
-static int w_xavp_rm_child(sip_msg_t *msg, char *prname, char *pcname);
542
+static int w_xavp_child_rm(sip_msg_t *msg, char *prname, char *pcname);
543 543
 static int w_sbranch_set_ruri(sip_msg_t *msg, char p1, char *p2);
544 544
 static int w_sbranch_append(sip_msg_t *msg, char p1, char *p2);
545 545
 static int w_sbranch_reset(sip_msg_t *msg, char p1, char *p2);
... ...
@@ -549,8 +549,8 @@ static int w_xavp_to_var(sip_msg_t *msg, char *p1);
549 549
 int pv_evalx_fixup(void** param, int param_no);
550 550
 int w_pv_evalx(struct sip_msg *msg, char *dst, str *fmt);
551 551
 
552
-static int fixup_xavp_set_child_ival(void** param, int param_no);
553
-static int fixup_free_xavp_set_child_ival(void** param, int param_no);
552
+static int fixup_xavp_child_seti(void** param, int param_no);
553
+static int fixup_free_xavp_child_seti(void** param, int param_no);
554 554
 
555 555
 static int pv_init_rpc(void);
556 556
 int pv_register_api(pv_api_t*);
... ...
@@ -580,16 +580,16 @@ static cmd_export_t cmds[]={
580 580
 	{"xavp_params_implode", (cmd_function)w_xavp_params_implode,
581 581
 		2, fixup_spve_str, fixup_free_spve_str,
582 582
 		ANY_ROUTE},
583
-	{"xavp_set_child_ival", (cmd_function)w_xavp_set_child_ival,
584
-		3, fixup_xavp_set_child_ival, fixup_free_xavp_set_child_ival,
583
+	{"xavp_child_seti", (cmd_function)w_xavp_child_seti,
584
+		3, fixup_xavp_child_seti, fixup_free_xavp_child_seti,
585 585
 		ANY_ROUTE},
586
-	{"xavp_set_child_sval", (cmd_function)w_xavp_set_child_sval,
586
+	{"xavp_child_sets", (cmd_function)w_xavp_child_sets,
587 587
 		3, fixup_spve_all, fixup_free_spve_all,
588 588
 		ANY_ROUTE},
589 589
 	{"xavp_rm", (cmd_function)w_xavp_rm,
590 590
 		1, fixup_spve_null, fixup_free_spve_null,
591 591
 		ANY_ROUTE},
592
-	{"xavp_rm_child", (cmd_function)w_xavp_rm_child,
592
+	{"xavp_child_rm", (cmd_function)w_xavp_child_rm,
593 593
 		2, fixup_spve_spve, fixup_free_spve_spve,
594 594
 		ANY_ROUTE},
595 595
 	{"sbranch_set_ruri",  (cmd_function)w_sbranch_set_ruri,  0, 0, 0,
... ...
@@ -902,7 +902,7 @@ 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_set_child_ival(sip_msg_t *msg, str *rname, str *cname,
905
+static int ki_xavp_child_seti(sip_msg_t *msg, str *rname, str *cname,
906 906
 		int ival)
907 907
 {
908 908
 	int ret;
... ...
@@ -915,7 +915,7 @@ static int ki_xavp_set_child_ival(sip_msg_t *msg, str *rname, str *cname,
915 915
 /**
916 916
  *
917 917
  */
918
-static int w_xavp_set_child_ival(sip_msg_t *msg, char *prname, char *pcname,
918
+static int w_xavp_child_seti(sip_msg_t *msg, char *prname, char *pcname,
919 919
 		char *pval)
920 920
 {
921 921
 	str rname = STR_NULL;
... ...
@@ -935,13 +935,13 @@ static int w_xavp_set_child_ival(sip_msg_t *msg, char *prname, char *pcname,
935 935
 		return -1;
936 936
 	}
937 937
 
938
-	return ki_xavp_set_child_ival(msg, &rname, &cname, ival);
938
+	return ki_xavp_child_seti(msg, &rname, &cname, ival);
939 939
 }
940 940
 
941 941
 /**
942 942
  *
943 943
  */
944
-static int ki_xavp_set_child_sval(sip_msg_t *msg, str *rname, str *cname,
944
+static int ki_xavp_child_sets(sip_msg_t *msg, str *rname, str *cname,
945 945
 		str *sval)
946 946
 {
947 947
 	int ret;
... ...
@@ -954,7 +954,7 @@ static int ki_xavp_set_child_sval(sip_msg_t *msg, str *rname, str *cname,
954 954
 /**
955 955
  *
956 956
  */
957
-static int w_xavp_set_child_sval(sip_msg_t *msg, char *prname, char *pcname,
957
+static int w_xavp_child_sets(sip_msg_t *msg, char *prname, char *pcname,
958 958
 		char *pval)
959 959
 {
960 960
 	str rname;
... ...
@@ -974,13 +974,13 @@ static int w_xavp_set_child_sval(sip_msg_t *msg, char *prname, char *pcname,
974 974
 		return -1;
975 975
 	}
976 976
 
977
-	return ki_xavp_set_child_sval(msg, &rname, &cname, &sval);
977
+	return ki_xavp_child_sets(msg, &rname, &cname, &sval);
978 978
 }
979 979
 
980 980
 /**
981 981
  *
982 982
  */
983
-static int fixup_xavp_set_child_ival(void** param, int param_no)
983
+static int fixup_xavp_child_seti(void** param, int param_no)
984 984
 {
985 985
 	if(param_no==1 || param_no==2)
986 986
 		return fixup_spve_all(param, param_no);
... ...
@@ -992,7 +992,7 @@ static int fixup_xavp_set_child_ival(void** param, int param_no)
992 992
 /**
993 993
  *
994 994
  */
995
-static int fixup_free_xavp_set_child_ival(void** param, int param_no)
995
+static int fixup_free_xavp_child_seti(void** param, int param_no)
996 996
 {
997 997
 	if(param_no==1 || param_no==2)
998 998
 		return fixup_free_spve_all(param, param_no);
... ...
@@ -1032,7 +1032,7 @@ static int w_xavp_rm(sip_msg_t *msg, char *prname, char *p2)
1032 1032
 /**
1033 1033
  *
1034 1034
  */
1035
-static int ki_xavp_rm_child(sip_msg_t *msg, str *rname, str *cname)
1035
+static int ki_xavp_child_rm(sip_msg_t *msg, str *rname, str *cname)
1036 1036
 {
1037 1037
 	int ret;
1038 1038
 
... ...
@@ -1044,7 +1044,7 @@ static int ki_xavp_rm_child(sip_msg_t *msg, str *rname, str *cname)
1044 1044
 /**
1045 1045
  *
1046 1046
  */
1047
-static int w_xavp_rm_child(sip_msg_t *msg, char *prname, char *pcname)
1047
+static int w_xavp_child_rm(sip_msg_t *msg, char *prname, char *pcname)
1048 1048
 {
1049 1049
 	str rname;
1050 1050
 	str cname;
... ...
@@ -1058,7 +1058,7 @@ static int w_xavp_rm_child(sip_msg_t *msg, char *prname, char *pcname)
1058 1058
 		return -1;
1059 1059
 	}
1060 1060
 
1061
-	return ki_xavp_rm_child(msg, &rname, &cname);
1061
+	return ki_xavp_child_rm(msg, &rname, &cname);
1062 1062
 }
1063 1063
 
1064 1064
 /**
... ...
@@ -1215,7 +1215,7 @@ static int ki_xavp_child_is_null(sip_msg_t *msg, str *rname, str *cname)
1215 1215
 /**
1216 1216
  *
1217 1217
  */
1218
-static sr_kemi_xval_t* ki_xavp_get_child_mode(sip_msg_t *msg, str *rname,
1218
+static sr_kemi_xval_t* ki_xavp_child_get_mode(sip_msg_t *msg, str *rname,
1219 1219
 		str *cname, int rmode)
1220 1220
 {
1221 1221
 	sr_xavp_t *xavp=NULL;
... ...
@@ -1245,27 +1245,27 @@ static sr_kemi_xval_t* ki_xavp_get_child_mode(sip_msg_t *msg, str *rname,
1245 1245
 /**
1246 1246
  *
1247 1247
  */
1248
-static sr_kemi_xval_t* ki_xavp_get_child(sip_msg_t *msg, str *rname, str *cname)
1248
+static sr_kemi_xval_t* ki_xavp_child_get(sip_msg_t *msg, str *rname, str *cname)
1249 1249
 {
1250
-	return ki_xavp_get_child_mode(msg, rname, cname, SR_KEMI_XVAL_NULL_NONE);
1250
+	return ki_xavp_child_get_mode(msg, rname, cname, SR_KEMI_XVAL_NULL_NONE);
1251 1251
 }
1252 1252
 
1253 1253
 
1254 1254
 /**
1255 1255
  *
1256 1256
  */
1257
-static sr_kemi_xval_t* ki_xavp_gete_child(sip_msg_t *msg, str *rname, str *cname)
1257
+static sr_kemi_xval_t* ki_xavp_child_gete(sip_msg_t *msg, str *rname, str *cname)
1258 1258
 {
1259
-	return ki_xavp_get_child_mode(msg, rname, cname, SR_KEMI_XVAL_NULL_EMPTY);
1259
+	return ki_xavp_child_get_mode(msg, rname, cname, SR_KEMI_XVAL_NULL_EMPTY);
1260 1260
 }
1261 1261
 
1262 1262
 
1263 1263
 /**
1264 1264
  *
1265 1265
  */
1266
-static sr_kemi_xval_t* ki_xavp_getw_child(sip_msg_t *msg, str *rname, str *cname)
1266
+static sr_kemi_xval_t* ki_xavp_child_getw(sip_msg_t *msg, str *rname, str *cname)
1267 1267
 {
1268
-	return ki_xavp_get_child_mode(msg, rname, cname, SR_KEMI_XVAL_NULL_PRINT);
1268
+	return ki_xavp_child_get_mode(msg, rname, cname, SR_KEMI_XVAL_NULL_PRINT);
1269 1269
 }
1270 1270
 
1271 1271
 /**
... ...
@@ -1443,35 +1443,6 @@ error:
1443 1443
 /**
1444 1444
  *
1445 1445
  */
1446
-static const char* rpc_shv_set_doc[2] = {
1447
-	"Set a shared variable (args: name type value)",
1448
-	0
1449
-};
1450
-
1451
-static const char* rpc_shv_get_doc[2] = {
1452
-	"Get the value of a shared variable. If no argument, dumps all",
1453
-	0
1454
-};
1455
-
1456
-rpc_export_t pv_rpc[] = {
1457
-	{"pv.shvSet", rpc_shv_set, rpc_shv_set_doc, 0},
1458
-	{"pv.shvGet", rpc_shv_get, rpc_shv_get_doc, 0},
1459
-	{0, 0, 0, 0}
1460
-};
1461
-
1462
-static int pv_init_rpc(void)
1463
-{
1464
-	if (rpc_register_array(pv_rpc)!=0)
1465
-	{
1466
-		LM_ERR("failed to register RPC commands\n");
1467
-		return -1;
1468
-	}
1469
-	return 0;
1470
-}
1471
-
1472
-/**
1473
- *
1474
- */
1475 1446
 static int ki_avp_seti(sip_msg_t *msg, str *xname, int vn)
1476 1447
 {
1477 1448
 	unsigned short atype;
... ...
@@ -1663,14 +1634,19 @@ static sr_kemi_t sr_kemi_pvx_exports[] = {
1663 1663
 		{ SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_NONE,
1664 1664
 			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
1665 1665
 	},
1666
-	{ str_init("pvx"), str_init("xavp_set_child_ival"),
1667
-		SR_KEMIP_INT, ki_xavp_set_child_ival,
1668
-		{ SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_INT,
1666
+	{ str_init("pvx"), str_init("xavp_get"),
1667
+		SR_KEMIP_XVAL, ki_xavp_get,
1668
+		{ SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE,
1669 1669
 			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
1670 1670
 	},
1671
-	{ str_init("pvx"), str_init("xavp_set_child_sval"),
1672
-		SR_KEMIP_INT, ki_xavp_set_child_sval,
1673
-		{ SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_STR,
1671
+	{ str_init("pvx"), str_init("xavp_gete"),
1672
+		SR_KEMIP_XVAL, ki_xavp_gete,
1673
+		{ SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE,
1674
+			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
1675
+	},
1676
+	{ str_init("pvx"), str_init("xavp_getw"),
1677
+		SR_KEMIP_XVAL, ki_xavp_getw,
1678
+		{ SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE,
1674 1679
 			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
1675 1680
 	},
1676 1681
 	{ str_init("pvx"), str_init("xavp_rm"),
... ...
@@ -1683,43 +1659,38 @@ static sr_kemi_t sr_kemi_pvx_exports[] = {
1683 1683
 		{ SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE,
1684 1684
 			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
1685 1685
 	},
1686
-	{ str_init("pvx"), str_init("xavp_rm_child"),
1687
-		SR_KEMIP_INT, ki_xavp_rm_child,
1688
-		{ SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_NONE,
1689
-			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
1690
-	},
1691
-	{ str_init("pvx"), str_init("xavp_child_is_null"),
1692
-		SR_KEMIP_INT, ki_xavp_child_is_null,
1693
-		{ SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_NONE,
1686
+	{ str_init("pvx"), str_init("xavp_child_seti"),
1687
+		SR_KEMIP_INT, ki_xavp_child_seti,
1688
+		{ SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_INT,
1694 1689
 			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
1695 1690
 	},
1696
-	{ str_init("pvx"), str_init("xavp_get"),
1697
-		SR_KEMIP_XVAL, ki_xavp_get,
1698
-		{ SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE,
1691
+	{ str_init("pvx"), str_init("xavp_child_sets"),
1692
+		SR_KEMIP_INT, ki_xavp_child_sets,
1693
+		{ SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_STR,
1699 1694
 			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
1700 1695
 	},
1701
-	{ str_init("pvx"), str_init("xavp_gete"),
1702
-		SR_KEMIP_XVAL, ki_xavp_gete,
1703
-		{ SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE,
1696
+	{ str_init("pvx"), str_init("xavp_child_rm"),
1697
+		SR_KEMIP_INT, ki_xavp_child_rm,
1698
+		{ SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_NONE,
1704 1699
 			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
1705 1700
 	},
1706
-	{ str_init("pvx"), str_init("xavp_getw"),
1707
-		SR_KEMIP_XVAL, ki_xavp_getw,
1708
-		{ SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE,
1701
+	{ str_init("pvx"), str_init("xavp_child_is_null"),
1702
+		SR_KEMIP_INT, ki_xavp_child_is_null,
1703
+		{ SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_NONE,
1709 1704
 			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
1710 1705
 	},
1711
-	{ str_init("pvx"), str_init("xavp_get_child"),
1712
-		SR_KEMIP_XVAL, ki_xavp_get_child,
1706
+	{ str_init("pvx"), str_init("xavp_child_get"),
1707
+		SR_KEMIP_XVAL, ki_xavp_child_get,
1713 1708
 		{ SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_NONE,
1714 1709
 			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
1715 1710
 	},
1716
-	{ str_init("pvx"), str_init("xavp_gete_child"),
1717
-		SR_KEMIP_XVAL, ki_xavp_gete_child,
1711
+	{ str_init("pvx"), str_init("xavp_child_gete"),
1712
+		SR_KEMIP_XVAL, ki_xavp_child_gete,
1718 1713
 		{ SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_NONE,
1719 1714
 			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
1720 1715
 	},
1721
-	{ str_init("pvx"), str_init("xavp_getw_child"),
1722
-		SR_KEMIP_XVAL, ki_xavp_getw_child,
1716
+	{ str_init("pvx"), str_init("xavp_child_getw"),
1717
+		SR_KEMIP_XVAL, ki_xavp_child_getw,
1723 1718
 		{ SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_NONE,
1724 1719
 			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
1725 1720
 	},
... ...
@@ -1771,6 +1742,35 @@ static sr_kemi_t sr_kemi_pvx_exports[] = {
1771 1771
 /**
1772 1772
  *
1773 1773
  */
1774
+static const char* rpc_shv_set_doc[2] = {
1775
+	"Set a shared variable (args: name type value)",
1776
+	0
1777
+};
1778
+
1779
+static const char* rpc_shv_get_doc[2] = {
1780
+	"Get the value of a shared variable. If no argument, dumps all",
1781
+	0
1782
+};
1783
+
1784
+rpc_export_t pv_rpc[] = {
1785
+	{"pv.shvSet", rpc_shv_set, rpc_shv_set_doc, 0},
1786
+	{"pv.shvGet", rpc_shv_get, rpc_shv_get_doc, 0},
1787
+	{0, 0, 0, 0}
1788
+};
1789
+
1790
+static int pv_init_rpc(void)
1791
+{
1792
+	if (rpc_register_array(pv_rpc)!=0)
1793
+	{
1794
+		LM_ERR("failed to register RPC commands\n");
1795
+		return -1;
1796
+	}
1797
+	return 0;
1798
+}
1799
+
1800
+/**
1801
+ *
1802
+ */
1774 1803
 int mod_register(char *path, int *dlflags, void *p1, void *p2)
1775 1804
 {
1776 1805
 	sr_kemi_modules_add(sr_kemi_pvx_exports);