Browse code

core: kemi - functions to test http methods

Daniel-Constantin Mierla authored on 19/05/2020 12:23:01
Showing 1 changed files
... ...
@@ -1076,6 +1076,38 @@ static int sr_kemi_core_is_method_kdmq(sip_msg_t *msg)
1076 1076
 }
1077 1077
 
1078 1078
 
1079
+/**
1080
+ *
1081
+ */
1082
+static int sr_kemi_core_is_method_get(sip_msg_t *msg)
1083
+{
1084
+	return sr_kemi_core_is_method_type(msg, METHOD_GET);
1085
+}
1086
+
1087
+/**
1088
+ *
1089
+ */
1090
+static int sr_kemi_core_is_method_post(sip_msg_t *msg)
1091
+{
1092
+	return sr_kemi_core_is_method_type(msg, METHOD_POST);
1093
+}
1094
+
1095
+/**
1096
+ *
1097
+ */
1098
+static int sr_kemi_core_is_method_put(sip_msg_t *msg)
1099
+{
1100
+	return sr_kemi_core_is_method_type(msg, METHOD_PUT);
1101
+}
1102
+
1103
+/**
1104
+ *
1105
+ */
1106
+static int sr_kemi_core_is_method_delete(sip_msg_t *msg)
1107
+{
1108
+	return sr_kemi_core_is_method_type(msg, METHOD_DELETE);
1109
+}
1110
+
1079 1111
 /**
1080 1112
  *
1081 1113
  */
... ...
@@ -1769,6 +1801,26 @@ static sr_kemi_t _sr_kemi_core[] = {
1769 1801
 		{ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
1770 1802
 			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
1771 1803
 	},
1804
+	{ str_init(""), str_init("is_GET"),
1805
+		SR_KEMIP_BOOL, sr_kemi_core_is_method_get,
1806
+		{ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
1807
+			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
1808
+	},
1809
+	{ str_init(""), str_init("is_POST"),
1810
+		SR_KEMIP_BOOL, sr_kemi_core_is_method_post,
1811
+		{ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
1812
+			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
1813
+	},
1814
+	{ str_init(""), str_init("is_PUT"),
1815
+		SR_KEMIP_BOOL, sr_kemi_core_is_method_put,
1816
+		{ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
1817
+			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
1818
+	},
1819
+	{ str_init(""), str_init("is_DELETE"),
1820
+		SR_KEMIP_BOOL, sr_kemi_core_is_method_delete,
1821
+		{ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
1822
+			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
1823
+	},
1772 1824
 	{ str_init(""), str_init("is_UDP"),
1773 1825
 		SR_KEMIP_BOOL, sr_kemi_core_is_proto_udp,
1774 1826
 		{ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,