Browse code

app_lua: removed old Lua sr module exports

- exporting only KSR via KEMI framework
- Lua sr module is relocated to app_lua_sr kamailio module, to be
obsoleted and removed over the time
- export KSR.pv submodule using implementation from core

Daniel-Constantin Mierla authored on 29/05/2019 09:18:20
Showing 8 changed files
... ...
@@ -32,13 +32,30 @@
32 32
 #include "../../core/data_lump.h"
33 33
 #include "../../core/data_lump_rpl.h"
34 34
 #include "../../core/strutils.h"
35
+#include "../../core/rpc.h"
36
+#include "../../core/rpc_lookup.h"
35 37
 
36 38
 #include "app_lua_api.h"
37
-#include "app_lua_sr.h"
38
-#include "app_lua_exp.h"
39
+#include "app_lua_kemi_export.h"
39 40
 
41
+#define KSRVERSION "2.0"
40 42
 
41
-#define SRVERSION "1.0"
43
+#define KSR_APP_LUA_LOG_EXPORTS (1<<0)
44
+
45
+extern int _ksr_app_lua_log_mode;
46
+
47
+void lua_sr_kemi_register_libs(lua_State *L);
48
+
49
+static app_lua_openlibs_f app_lua_openlibs_cb = NULL;
50
+
51
+/**
52
+ *
53
+ */
54
+int app_lua_openlibs_register(app_lua_openlibs_f rfunc)
55
+{
56
+	app_lua_openlibs_cb = rfunc;
57
+	return 0;
58
+}
42 59
 
43 60
 /**
44 61
  * reload enabled param
... ...
@@ -151,17 +168,6 @@ int sr_lua_load_script(char *script)
151 168
 	return 0;
152 169
 }
153 170
 
154
-
155
-/**
156
- *
157
- */
158
-int sr_lua_register_module(char *mname)
159
-{
160
-	if(lua_sr_exp_register_mod(mname)==0)
161
-		return 0;
162
-	return -1;
163
-}
164
-
165 171
 /**
166 172
  *
167 173
  */
... ...
@@ -183,8 +189,9 @@ int sr_lua_reload_module(unsigned int reload)
183 189
  */
184 190
 void lua_sr_openlibs(lua_State *L)
185 191
 {
186
-	lua_sr_core_openlibs(L);
187
-	lua_sr_exp_openlibs(L);
192
+	if(app_lua_openlibs_cb!=NULL) {
193
+		app_lua_openlibs_cb(L);
194
+	}
188 195
 	lua_sr_kemi_register_libs(L);
189 196
 }
190 197
 
... ...
@@ -194,15 +201,12 @@ void lua_sr_openlibs(lua_State *L)
194 201
 int lua_sr_init_mod(void)
195 202
 {
196 203
 	/* allocate shm */
197
-	if(lua_sr_alloc_script_ver()<0)
198
-	{
204
+	if(lua_sr_alloc_script_ver()<0) {
199 205
 		LM_CRIT("failed to alloc shm for version\n");
200 206
 		return -1;
201 207
 	}
202 208
 
203 209
 	memset(&_sr_L_env, 0, sizeof(sr_lua_env_t));
204
-	if(lua_sr_exp_init_mod()<0)
205
-		return -1;
206 210
 
207 211
 	return 0;
208 212
 
... ...
@@ -228,7 +232,7 @@ int lua_sr_init_probe(void)
228 232
 	lua_sr_openlibs(L);
229 233
 
230 234
 	/* force loading lua lib now */
231
-	if(luaL_dostring(L, "sr.probe()")!=0)
235
+	if(luaL_dostring(L, "KSR.x.probe()")!=0)
232 236
 	{
233 237
 		txt = (char*)lua_tostring(L, -1);
234 238
 		LM_ERR("error initializing Lua: %s\n", (txt)?txt:"unknown");
... ...
@@ -278,13 +282,13 @@ int lua_sr_init_child(void)
278 282
 	luaL_openlibs(_sr_L_env.L);
279 283
 	lua_sr_openlibs(_sr_L_env.L);
280 284
 
281
-	/* set SR lib version */
285
+	/* set KSR lib version */
282 286
 #if LUA_VERSION_NUM >= 502
283
-	lua_pushstring(_sr_L_env.L, SRVERSION);
284
-	lua_setglobal(_sr_L_env.L, "SRVERSION");
287
+	lua_pushstring(_sr_L_env.L, KSRVERSION);
288
+	lua_setglobal(_sr_L_env.L, "KSRVERSION");
285 289
 #else
286
-	lua_pushstring(_sr_L_env.L, "SRVERSION");
287
-	lua_pushstring(_sr_L_env.L, SRVERSION);
290
+	lua_pushstring(_sr_L_env.L, "KSRVERSION");
291
+	lua_pushstring(_sr_L_env.L, KSRVERSION);
288 292
 	lua_settable(_sr_L_env.L, LUA_GLOBALSINDEX);
289 293
 #endif
290 294
 	if(_sr_lua_load_list != NULL)
... ...
@@ -300,15 +304,15 @@ int lua_sr_init_child(void)
300 304
 
301 305
 		/* set SR lib version */
302 306
 #if LUA_VERSION_NUM >= 502
303
-		lua_pushstring(_sr_L_env.LL, SRVERSION);
304
-		lua_setglobal(_sr_L_env.LL, "SRVERSION");
307
+		lua_pushstring(_sr_L_env.LL, KSRVERSION);
308
+		lua_setglobal(_sr_L_env.LL, "KSRVERSION");
305 309
 #else
306
-		lua_pushstring(_sr_L_env.LL, "SRVERSION");
307
-		lua_pushstring(_sr_L_env.LL, SRVERSION);
310
+		lua_pushstring(_sr_L_env.LL, "KSRVERSION");
311
+		lua_pushstring(_sr_L_env.LL, KSRVERSION);
308 312
 		lua_settable(_sr_L_env.LL, LUA_GLOBALSINDEX);
309 313
 #endif
310 314
 		/* force loading lua lib now */
311
-		if(luaL_dostring(_sr_L_env.LL, "sr.probe()")!=0)
315
+		if(luaL_dostring(_sr_L_env.LL, "KSR.x.probe()")!=0)
312 316
 		{
313 317
 			txt = (char*)lua_tostring(_sr_L_env.LL, -1);
314 318
 			LM_ERR("error initializing Lua: %s\n", (txt)?txt:"unknown");
... ...
@@ -786,3 +790,1229 @@ void app_lua_dump_stack(lua_State *L)
786 790
 		}
787 791
 	}
788 792
 }
793
+
794
+/**
795
+ *
796
+ */
797
+int sr_kemi_lua_return_int(lua_State* L, sr_kemi_t *ket, int rc)
798
+{
799
+	if(ket->rtype==SR_KEMIP_INT) {
800
+		lua_pushinteger(L, rc);
801
+		return 1;
802
+	}
803
+	if(ket->rtype==SR_KEMIP_BOOL && rc!=SR_KEMI_FALSE) {
804
+		return app_lua_return_true(L);
805
+	}
806
+	return app_lua_return_false(L);
807
+}
808
+
809
+
810
+/**
811
+ *
812
+ */
813
+int sr_kemi_lua_return_xval(lua_State* L, sr_kemi_t *ket, sr_kemi_xval_t *rx)
814
+{
815
+	switch(rx->vtype) {
816
+		case SR_KEMIP_NONE:
817
+			return 0;
818
+		case SR_KEMIP_INT:
819
+			lua_pushinteger(L, rx->v.n);
820
+			return 1;
821
+		case SR_KEMIP_STR:
822
+			lua_pushlstring(L, rx->v.s.s, rx->v.s.len);
823
+			return 1;
824
+		case SR_KEMIP_BOOL:
825
+			if(rx->v.n!=SR_KEMI_FALSE) {
826
+				lua_pushboolean(L, SRLUA_TRUE);
827
+			} else {
828
+				lua_pushboolean(L, SRLUA_FALSE);
829
+			}
830
+			return 1;
831
+		case SR_KEMIP_XVAL:
832
+			/* unknown content - return false */
833
+			lua_pushboolean(L, SRLUA_FALSE);
834
+			return 1;
835
+		case SR_KEMIP_NULL:
836
+			lua_pushnil(L);
837
+			return 1;
838
+		default:
839
+			/* unknown type - return false */
840
+			lua_pushboolean(L, SRLUA_FALSE);
841
+			return 1;
842
+	}
843
+}
844
+
845
+/**
846
+ *
847
+ */
848
+int sr_kemi_lua_exec_func_ex(lua_State* L, sr_kemi_t *ket, int pdelta)
849
+{
850
+	int i;
851
+	int argc;
852
+	int ret;
853
+	str *fname;
854
+	str *mname;
855
+	sr_kemi_val_t vps[SR_KEMI_PARAMS_MAX];
856
+	sr_lua_env_t *env_L;
857
+	sr_kemi_xval_t *xret;
858
+
859
+	env_L = sr_lua_env_get();
860
+
861
+	if(env_L==NULL || env_L->msg==NULL || ket==NULL) {
862
+		LM_ERR("invalid Lua environment attributes or parameters\n");
863
+		return app_lua_return_false(L);
864
+	}
865
+
866
+	fname = &ket->fname;
867
+	mname = &ket->mname;
868
+
869
+	argc = lua_gettop(L);
870
+	if(argc==pdelta && ket->ptypes[0]==SR_KEMIP_NONE) {
871
+		if(ket->rtype==SR_KEMIP_XVAL) {
872
+			xret = ((sr_kemi_xfm_f)(ket->func))(env_L->msg);
873
+			return sr_kemi_lua_return_xval(L, ket, xret);
874
+		} else {
875
+			ret = ((sr_kemi_fm_f)(ket->func))(env_L->msg);
876
+			return sr_kemi_lua_return_int(L, ket, ret);
877
+		}
878
+	}
879
+	if(argc==pdelta && ket->ptypes[0]!=SR_KEMIP_NONE) {
880
+		LM_ERR("invalid number of parameters for: %.*s.%.*s\n",
881
+				mname->len, mname->s, fname->len, fname->s);
882
+		return app_lua_return_false(L);
883
+	}
884
+
885
+	if(argc>=SR_KEMI_PARAMS_MAX+pdelta) {
886
+		LM_ERR("too many parameters for: %.*s.%.*s\n",
887
+				mname->len, mname->s, fname->len, fname->s);
888
+		return app_lua_return_false(L);
889
+	}
890
+
891
+	memset(vps, 0, SR_KEMI_PARAMS_MAX*sizeof(sr_kemi_val_t));
892
+	for(i=0; i<SR_KEMI_PARAMS_MAX; i++) {
893
+		if(ket->ptypes[i]==SR_KEMIP_NONE) {
894
+			break;
895
+		}
896
+		if(argc<i+pdelta+1) {
897
+			LM_ERR("not enough parameters for: %.*s.%.*s\n",
898
+					mname->len, mname->s, fname->len, fname->s);
899
+			return app_lua_return_false(L);
900
+		}
901
+		if(ket->ptypes[i]==SR_KEMIP_STR) {
902
+			vps[i].s.s = (char*)lua_tostring(L, i+pdelta+1);
903
+			if(vps[i].s.s!=NULL) {
904
+				if(lua_isstring(L, i+pdelta+1)) {
905
+#if LUA_VERSION_NUM > 501
906
+					vps[i].s.len = lua_rawlen(L, i+pdelta+1);
907
+#else
908
+					vps[i].s.len = lua_strlen(L, i+pdelta+1);
909
+#endif
910
+				} else {
911
+					vps[i].s.len = strlen(vps[i].s.s);
912
+				}
913
+			} else {
914
+				vps[i].s.len = 0;
915
+			}
916
+			LM_DBG("param[%d] for: %.*s is str: %.*s\n", i,
917
+				fname->len, fname->s, vps[i].s.len, vps[i].s.s);
918
+		} else if(ket->ptypes[i]==SR_KEMIP_INT) {
919
+			vps[i].n = lua_tointeger(L, i+pdelta+1);
920
+			LM_DBG("param[%d] for: %.*s is int: %d\n", i,
921
+				fname->len, fname->s, vps[i].n);
922
+		} else {
923
+			LM_ERR("unknown parameter type %d (%d)\n", ket->ptypes[i], i);
924
+			return app_lua_return_false(L);
925
+		}
926
+	}
927
+
928
+	switch(i) {
929
+		case 1:
930
+			if(ket->ptypes[0]==SR_KEMIP_INT) {
931
+				if(ket->rtype==SR_KEMIP_XVAL) {
932
+					xret = ((sr_kemi_xfmn_f)(ket->func))(env_L->msg, vps[0].n);
933
+					return sr_kemi_lua_return_xval(L, ket, xret);
934
+				} else {
935
+					ret = ((sr_kemi_fmn_f)(ket->func))(env_L->msg, vps[0].n);
936
+					return sr_kemi_lua_return_int(L, ket, ret);
937
+				}
938
+			} else if(ket->ptypes[0]==SR_KEMIP_STR) {
939
+				if(ket->rtype==SR_KEMIP_XVAL) {
940
+					xret = ((sr_kemi_xfms_f)(ket->func))(env_L->msg, &vps[0].s);
941
+					return sr_kemi_lua_return_xval(L, ket, xret);
942
+				} else {
943
+					ret = ((sr_kemi_fms_f)(ket->func))(env_L->msg, &vps[0].s);
944
+					return sr_kemi_lua_return_int(L, ket, ret);
945
+				}
946
+			} else {
947
+				LM_ERR("invalid parameters for: %.*s\n",
948
+						fname->len, fname->s);
949
+				return app_lua_return_false(L);
950
+			}
951
+		break;
952
+		case 2:
953
+			if(ket->ptypes[0]==SR_KEMIP_INT) {
954
+				if(ket->ptypes[1]==SR_KEMIP_INT) {
955
+					if(ket->rtype==SR_KEMIP_XVAL) {
956
+						xret = ((sr_kemi_xfmnn_f)(ket->func))(env_L->msg, vps[0].n, vps[1].n);
957
+						return sr_kemi_lua_return_xval(L, ket, xret);
958
+					} else {
959
+						ret = ((sr_kemi_fmnn_f)(ket->func))(env_L->msg, vps[0].n, vps[1].n);
960
+						return sr_kemi_lua_return_int(L, ket, ret);
961
+					}
962
+				} else if(ket->ptypes[1]==SR_KEMIP_STR) {
963
+					if(ket->rtype==SR_KEMIP_XVAL) {
964
+						xret = ((sr_kemi_xfmns_f)(ket->func))(env_L->msg, vps[0].n, &vps[1].s);
965
+						return sr_kemi_lua_return_xval(L, ket, xret);
966
+					} else {
967
+						ret = ((sr_kemi_fmns_f)(ket->func))(env_L->msg, vps[0].n, &vps[1].s);
968
+						return sr_kemi_lua_return_int(L, ket, ret);
969
+					}
970
+				} else {
971
+					LM_ERR("invalid parameters for: %.*s\n",
972
+							fname->len, fname->s);
973
+					return app_lua_return_false(L);
974
+				}
975
+			} else if(ket->ptypes[0]==SR_KEMIP_STR) {
976
+				if(ket->ptypes[1]==SR_KEMIP_INT) {
977
+					if(ket->rtype==SR_KEMIP_XVAL) {
978
+						xret = ((sr_kemi_xfmsn_f)(ket->func))(env_L->msg, &vps[0].s, vps[1].n);
979
+						return sr_kemi_lua_return_xval(L, ket, xret);
980
+					} else {
981
+						ret = ((sr_kemi_fmsn_f)(ket->func))(env_L->msg, &vps[0].s, vps[1].n);
982
+						return sr_kemi_lua_return_int(L, ket, ret);
983
+					}
984
+				} else if(ket->ptypes[1]==SR_KEMIP_STR) {
985
+					if(ket->rtype==SR_KEMIP_XVAL) {
986
+						xret = ((sr_kemi_xfmss_f)(ket->func))(env_L->msg, &vps[0].s, &vps[1].s);
987
+						return sr_kemi_lua_return_xval(L, ket, xret);
988
+					} else {
989
+						ret = ((sr_kemi_fmss_f)(ket->func))(env_L->msg, &vps[0].s, &vps[1].s);
990
+						return sr_kemi_lua_return_int(L, ket, ret);
991
+					}
992
+				} else {
993
+					LM_ERR("invalid parameters for: %.*s\n",
994
+							fname->len, fname->s);
995
+					return app_lua_return_false(L);
996
+				}
997
+			} else {
998
+				LM_ERR("invalid parameters for: %.*s\n",
999
+						fname->len, fname->s);
1000
+				return app_lua_return_false(L);
1001
+			}
1002
+		break;
1003
+		case 3:
1004
+			if(ket->ptypes[0]==SR_KEMIP_INT) {
1005
+				if(ket->ptypes[1]==SR_KEMIP_INT) {
1006
+					if(ket->ptypes[2]==SR_KEMIP_INT) {
1007
+						ret = ((sr_kemi_fmnnn_f)(ket->func))(env_L->msg,
1008
+								vps[0].n, vps[1].n, vps[2].n);
1009
+						return sr_kemi_lua_return_int(L, ket, ret);
1010
+					} else if(ket->ptypes[2]==SR_KEMIP_STR) {
1011
+						ret = ((sr_kemi_fmnns_f)(ket->func))(env_L->msg,
1012
+								vps[0].n, vps[1].n, &vps[2].s);
1013
+						return sr_kemi_lua_return_int(L, ket, ret);
1014
+					} else {
1015
+						LM_ERR("invalid parameters for: %.*s\n",
1016
+								fname->len, fname->s);
1017
+						return app_lua_return_false(L);
1018
+					}
1019
+				} else if(ket->ptypes[1]==SR_KEMIP_STR) {
1020
+					if(ket->ptypes[2]==SR_KEMIP_INT) {
1021
+						ret = ((sr_kemi_fmnsn_f)(ket->func))(env_L->msg,
1022
+								vps[0].n, &vps[1].s, vps[2].n);
1023
+						return sr_kemi_lua_return_int(L, ket, ret);
1024
+					} else if(ket->ptypes[2]==SR_KEMIP_STR) {
1025
+						ret = ((sr_kemi_fmnss_f)(ket->func))(env_L->msg,
1026
+								vps[0].n, &vps[1].s, &vps[2].s);
1027
+						return sr_kemi_lua_return_int(L, ket, ret);
1028
+					} else {
1029
+						LM_ERR("invalid parameters for: %.*s\n",
1030
+								fname->len, fname->s);
1031
+						return app_lua_return_false(L);
1032
+					}
1033
+				} else {
1034
+					LM_ERR("invalid parameters for: %.*s\n",
1035
+							fname->len, fname->s);
1036
+					return app_lua_return_false(L);
1037
+				}
1038
+			} else if(ket->ptypes[0]==SR_KEMIP_STR) {
1039
+				if(ket->ptypes[1]==SR_KEMIP_INT) {
1040
+					if(ket->ptypes[2]==SR_KEMIP_INT) {
1041
+						ret = ((sr_kemi_fmsnn_f)(ket->func))(env_L->msg,
1042
+								&vps[0].s, vps[1].n, vps[2].n);
1043
+						return sr_kemi_lua_return_int(L, ket, ret);
1044
+					} else if(ket->ptypes[2]==SR_KEMIP_STR) {
1045
+						ret = ((sr_kemi_fmsns_f)(ket->func))(env_L->msg,
1046
+								&vps[0].s, vps[1].n, &vps[2].s);
1047
+						return sr_kemi_lua_return_int(L, ket, ret);
1048
+					} else {
1049
+						LM_ERR("invalid parameters for: %.*s\n",
1050
+								fname->len, fname->s);
1051
+						return app_lua_return_false(L);
1052
+					}
1053
+				} else if(ket->ptypes[1]==SR_KEMIP_STR) {
1054
+					if(ket->ptypes[2]==SR_KEMIP_INT) {
1055
+						ret = ((sr_kemi_fmssn_f)(ket->func))(env_L->msg,
1056
+								&vps[0].s, &vps[1].s, vps[2].n);
1057
+						return sr_kemi_lua_return_int(L, ket, ret);
1058
+					} else if(ket->ptypes[2]==SR_KEMIP_STR) {
1059
+						ret = ((sr_kemi_fmsss_f)(ket->func))(env_L->msg,
1060
+								&vps[0].s, &vps[1].s, &vps[2].s);
1061
+						return sr_kemi_lua_return_int(L, ket, ret);
1062
+					} else {
1063
+						LM_ERR("invalid parameters for: %.*s\n",
1064
+								fname->len, fname->s);
1065
+						return app_lua_return_false(L);
1066
+					}
1067
+				} else {
1068
+					LM_ERR("invalid parameters for: %.*s\n",
1069
+							fname->len, fname->s);
1070
+					return app_lua_return_false(L);
1071
+				}
1072
+			} else {
1073
+				LM_ERR("invalid parameters for: %.*s\n",
1074
+						fname->len, fname->s);
1075
+				return app_lua_return_false(L);
1076
+			}
1077
+		break;
1078
+		case 4:
1079
+			if(ket->ptypes[0]==SR_KEMIP_STR
1080
+					&& ket->ptypes[1]==SR_KEMIP_STR
1081
+					&& ket->ptypes[2]==SR_KEMIP_STR
1082
+					&& ket->ptypes[3]==SR_KEMIP_STR) {
1083
+				ret = ((sr_kemi_fmssss_f)(ket->func))(env_L->msg,
1084
+						&vps[0].s, &vps[1].s, &vps[2].s, &vps[3].s);
1085
+				return sr_kemi_lua_return_int(L, ket, ret);
1086
+			} else if(ket->ptypes[0]==SR_KEMIP_STR
1087
+					&& ket->ptypes[1]==SR_KEMIP_STR
1088
+					&& ket->ptypes[2]==SR_KEMIP_STR
1089
+					&& ket->ptypes[3]==SR_KEMIP_INT) {
1090
+				ret = ((sr_kemi_fmsssn_f)(ket->func))(env_L->msg,
1091
+						&vps[0].s, &vps[1].s, &vps[2].s, vps[3].n);
1092
+				return sr_kemi_lua_return_int(L, ket, ret);
1093
+			} else if(ket->ptypes[0]==SR_KEMIP_STR
1094
+					&& ket->ptypes[1]==SR_KEMIP_STR
1095
+					&& ket->ptypes[2]==SR_KEMIP_INT
1096
+					&& ket->ptypes[3]==SR_KEMIP_STR) {
1097
+				ret = ((sr_kemi_fmssns_f)(ket->func))(env_L->msg,
1098
+						&vps[0].s, &vps[1].s, vps[2].n, &vps[3].s);
1099
+				return sr_kemi_lua_return_int(L, ket, ret);
1100
+			} else if(ket->ptypes[0]==SR_KEMIP_STR
1101
+					&& ket->ptypes[1]==SR_KEMIP_STR
1102
+					&& ket->ptypes[2]==SR_KEMIP_INT
1103
+					&& ket->ptypes[3]==SR_KEMIP_INT) {
1104
+				ret = ((sr_kemi_fmssnn_f)(ket->func))(env_L->msg,
1105
+						&vps[0].s, &vps[1].s, vps[2].n, vps[3].n);
1106
+				return sr_kemi_lua_return_int(L, ket, ret);
1107
+			} else if(ket->ptypes[0]==SR_KEMIP_STR
1108
+					&& ket->ptypes[1]==SR_KEMIP_INT
1109
+					&& ket->ptypes[2]==SR_KEMIP_STR
1110
+					&& ket->ptypes[3]==SR_KEMIP_STR) {
1111
+				ret = ((sr_kemi_fmsnss_f)(ket->func))(env_L->msg,
1112
+						&vps[0].s, vps[1].n, &vps[2].s, &vps[3].s);
1113
+				return sr_kemi_lua_return_int(L, ket, ret);
1114
+			} else if(ket->ptypes[0]==SR_KEMIP_STR
1115
+					&& ket->ptypes[1]==SR_KEMIP_INT
1116
+					&& ket->ptypes[2]==SR_KEMIP_STR
1117
+					&& ket->ptypes[3]==SR_KEMIP_INT) {
1118
+				ret = ((sr_kemi_fmsnsn_f)(ket->func))(env_L->msg,
1119
+						&vps[0].s, vps[1].n, &vps[2].s, vps[3].n);
1120
+				return sr_kemi_lua_return_int(L, ket, ret);
1121
+			} else if(ket->ptypes[0]==SR_KEMIP_STR
1122
+					&& ket->ptypes[1]==SR_KEMIP_INT
1123
+					&& ket->ptypes[2]==SR_KEMIP_INT
1124
+					&& ket->ptypes[3]==SR_KEMIP_STR) {
1125
+				ret = ((sr_kemi_fmsnns_f)(ket->func))(env_L->msg,
1126
+						&vps[0].s, vps[1].n, vps[2].n, &vps[3].s);
1127
+				return sr_kemi_lua_return_int(L, ket, ret);
1128
+			} else if(ket->ptypes[0]==SR_KEMIP_STR
1129
+					&& ket->ptypes[1]==SR_KEMIP_INT
1130
+					&& ket->ptypes[2]==SR_KEMIP_INT
1131
+					&& ket->ptypes[3]==SR_KEMIP_INT) {
1132
+				ret = ((sr_kemi_fmsnnn_f)(ket->func))(env_L->msg,
1133
+						&vps[0].s, vps[1].n, vps[2].n, vps[3].n);
1134
+				return sr_kemi_lua_return_int(L, ket, ret);
1135
+			} else if(ket->ptypes[0]==SR_KEMIP_INT
1136
+					&& ket->ptypes[1]==SR_KEMIP_STR
1137
+					&& ket->ptypes[2]==SR_KEMIP_STR
1138
+					&& ket->ptypes[3]==SR_KEMIP_STR) {
1139
+				ret = ((sr_kemi_fmnsss_f)(ket->func))(env_L->msg,
1140
+						vps[0].n, &vps[1].s, &vps[2].s, &vps[3].s);
1141
+				return sr_kemi_lua_return_int(L, ket, ret);
1142
+			} else if(ket->ptypes[0]==SR_KEMIP_INT
1143
+					&& ket->ptypes[1]==SR_KEMIP_STR
1144
+					&& ket->ptypes[2]==SR_KEMIP_STR
1145
+					&& ket->ptypes[3]==SR_KEMIP_INT) {
1146
+				ret = ((sr_kemi_fmnssn_f)(ket->func))(env_L->msg,
1147
+						vps[0].n, &vps[1].s, &vps[2].s, vps[3].n);
1148
+				return sr_kemi_lua_return_int(L, ket, ret);
1149
+			} else if(ket->ptypes[0]==SR_KEMIP_INT
1150
+					&& ket->ptypes[1]==SR_KEMIP_STR
1151
+					&& ket->ptypes[2]==SR_KEMIP_INT
1152
+					&& ket->ptypes[3]==SR_KEMIP_STR) {
1153
+				ret = ((sr_kemi_fmnsns_f)(ket->func))(env_L->msg,
1154
+						vps[0].n, &vps[1].s, vps[2].n, &vps[3].s);
1155
+				return sr_kemi_lua_return_int(L, ket, ret);
1156
+			} else if(ket->ptypes[0]==SR_KEMIP_INT
1157
+					&& ket->ptypes[1]==SR_KEMIP_STR
1158
+					&& ket->ptypes[2]==SR_KEMIP_INT
1159
+					&& ket->ptypes[3]==SR_KEMIP_INT) {
1160
+				ret = ((sr_kemi_fmnsnn_f)(ket->func))(env_L->msg,
1161
+						vps[0].n, &vps[1].s, vps[2].n, vps[3].n);
1162
+				return sr_kemi_lua_return_int(L, ket, ret);
1163
+			} else if(ket->ptypes[0]==SR_KEMIP_INT
1164
+					&& ket->ptypes[1]==SR_KEMIP_INT
1165
+					&& ket->ptypes[2]==SR_KEMIP_STR
1166
+					&& ket->ptypes[3]==SR_KEMIP_STR) {
1167
+				ret = ((sr_kemi_fmnnss_f)(ket->func))(env_L->msg,
1168
+						vps[0].n, vps[1].n, &vps[2].s, &vps[3].s);
1169
+				return sr_kemi_lua_return_int(L, ket, ret);
1170
+			} else if(ket->ptypes[0]==SR_KEMIP_INT
1171
+					&& ket->ptypes[1]==SR_KEMIP_INT
1172
+					&& ket->ptypes[2]==SR_KEMIP_STR
1173
+					&& ket->ptypes[3]==SR_KEMIP_INT) {
1174
+				ret = ((sr_kemi_fmnnsn_f)(ket->func))(env_L->msg,
1175
+						vps[0].n, vps[1].n, &vps[2].s, vps[3].n);
1176
+				return sr_kemi_lua_return_int(L, ket, ret);
1177
+			} else if(ket->ptypes[0]==SR_KEMIP_INT
1178
+					&& ket->ptypes[1]==SR_KEMIP_INT
1179
+					&& ket->ptypes[2]==SR_KEMIP_INT
1180
+					&& ket->ptypes[3]==SR_KEMIP_STR) {
1181
+				ret = ((sr_kemi_fmnnns_f)(ket->func))(env_L->msg,
1182
+						vps[0].n, vps[1].n, vps[2].n, &vps[3].s);
1183
+				return sr_kemi_lua_return_int(L, ket, ret);
1184
+			} else if(ket->ptypes[0]==SR_KEMIP_INT
1185
+					&& ket->ptypes[1]==SR_KEMIP_INT
1186
+					&& ket->ptypes[2]==SR_KEMIP_INT
1187
+					&& ket->ptypes[3]==SR_KEMIP_INT) {
1188
+				ret = ((sr_kemi_fmnnnn_f)(ket->func))(env_L->msg,
1189
+						vps[0].n, vps[1].n, vps[2].n, vps[3].n);
1190
+				return sr_kemi_lua_return_int(L, ket, ret);
1191
+			} else {
1192
+				LM_ERR("invalid parameters for: %.*s\n", fname->len, fname->s);
1193
+				return app_lua_return_false(L);
1194
+			}
1195
+		break;
1196
+		case 5:
1197
+			if(ket->ptypes[0]==SR_KEMIP_STR
1198
+					&& ket->ptypes[1]==SR_KEMIP_STR
1199
+					&& ket->ptypes[2]==SR_KEMIP_STR
1200
+					&& ket->ptypes[3]==SR_KEMIP_STR
1201
+					&& ket->ptypes[4]==SR_KEMIP_STR) {
1202
+				ret = ((sr_kemi_fmsssss_f)(ket->func))(env_L->msg,
1203
+						&vps[0].s, &vps[1].s, &vps[2].s, &vps[3].s, &vps[4].s);
1204
+				return sr_kemi_lua_return_int(L, ket, ret);
1205
+			} else if(ket->ptypes[0]==SR_KEMIP_STR
1206
+					&& ket->ptypes[1]==SR_KEMIP_STR
1207
+					&& ket->ptypes[2]==SR_KEMIP_STR
1208
+					&& ket->ptypes[3]==SR_KEMIP_STR
1209
+					&& ket->ptypes[4]==SR_KEMIP_INT) {
1210
+				ret = ((sr_kemi_fmssssn_f)(ket->func))(env_L->msg,
1211
+						&vps[0].s, &vps[1].s, &vps[2].s, &vps[3].s, vps[4].n);
1212
+				return sr_kemi_lua_return_int(L, ket, ret);
1213
+			} else if(ket->ptypes[0]==SR_KEMIP_STR
1214
+					&& ket->ptypes[1]==SR_KEMIP_STR
1215
+					&& ket->ptypes[2]==SR_KEMIP_STR
1216
+					&& ket->ptypes[3]==SR_KEMIP_INT
1217
+					&& ket->ptypes[4]==SR_KEMIP_STR) {
1218
+				ret = ((sr_kemi_fmsssns_f)(ket->func))(env_L->msg,
1219
+						&vps[0].s, &vps[1].s, &vps[2].s, vps[3].n, &vps[4].s);
1220
+				return sr_kemi_lua_return_int(L, ket, ret);
1221
+			} else if(ket->ptypes[0]==SR_KEMIP_STR
1222
+					&& ket->ptypes[1]==SR_KEMIP_STR
1223
+					&& ket->ptypes[2]==SR_KEMIP_STR
1224
+					&& ket->ptypes[3]==SR_KEMIP_INT
1225
+					&& ket->ptypes[4]==SR_KEMIP_INT) {
1226
+				ret = ((sr_kemi_fmsssnn_f)(ket->func))(env_L->msg,
1227
+						&vps[0].s, &vps[1].s, &vps[2].s, vps[3].n, vps[4].n);
1228
+				return sr_kemi_lua_return_int(L, ket, ret);
1229
+			} else if(ket->ptypes[0]==SR_KEMIP_STR
1230
+					&& ket->ptypes[1]==SR_KEMIP_STR
1231
+					&& ket->ptypes[2]==SR_KEMIP_INT
1232
+					&& ket->ptypes[3]==SR_KEMIP_STR
1233
+					&& ket->ptypes[4]==SR_KEMIP_STR) {
1234
+				ret = ((sr_kemi_fmssnss_f)(ket->func))(env_L->msg,
1235
+						&vps[0].s, &vps[1].s, vps[2].n, &vps[3].s, &vps[4].s);
1236
+				return sr_kemi_lua_return_int(L, ket, ret);
1237
+			} else if(ket->ptypes[0]==SR_KEMIP_STR
1238
+					&& ket->ptypes[1]==SR_KEMIP_STR
1239
+					&& ket->ptypes[2]==SR_KEMIP_INT
1240
+					&& ket->ptypes[3]==SR_KEMIP_STR
1241
+					&& ket->ptypes[4]==SR_KEMIP_INT) {
1242
+				ret = ((sr_kemi_fmssnsn_f)(ket->func))(env_L->msg,
1243
+						&vps[0].s, &vps[1].s, vps[2].n, &vps[3].s, vps[4].n);
1244
+				return sr_kemi_lua_return_int(L, ket, ret);
1245
+			} else if(ket->ptypes[0]==SR_KEMIP_STR
1246
+					&& ket->ptypes[1]==SR_KEMIP_STR
1247
+					&& ket->ptypes[2]==SR_KEMIP_INT
1248
+					&& ket->ptypes[3]==SR_KEMIP_INT
1249
+					&& ket->ptypes[4]==SR_KEMIP_STR) {
1250
+				ret = ((sr_kemi_fmssnns_f)(ket->func))(env_L->msg,
1251
+						&vps[0].s, &vps[1].s, vps[2].n, vps[3].n, &vps[4].s);
1252
+				return sr_kemi_lua_return_int(L, ket, ret);
1253
+			} else if(ket->ptypes[0]==SR_KEMIP_STR
1254
+					&& ket->ptypes[1]==SR_KEMIP_STR
1255
+					&& ket->ptypes[2]==SR_KEMIP_INT
1256
+					&& ket->ptypes[3]==SR_KEMIP_INT
1257
+					&& ket->ptypes[4]==SR_KEMIP_INT) {
1258
+				ret = ((sr_kemi_fmssnnn_f)(ket->func))(env_L->msg,
1259
+						&vps[0].s, &vps[1].s, vps[2].n, vps[3].n, vps[4].n);
1260
+				return sr_kemi_lua_return_int(L, ket, ret);
1261
+			} else if(ket->ptypes[0]==SR_KEMIP_STR
1262
+					&& ket->ptypes[1]==SR_KEMIP_INT
1263
+					&& ket->ptypes[2]==SR_KEMIP_STR
1264
+					&& ket->ptypes[3]==SR_KEMIP_STR
1265
+					&& ket->ptypes[4]==SR_KEMIP_STR) {
1266
+				ret = ((sr_kemi_fmsnsss_f)(ket->func))(env_L->msg,
1267
+						&vps[0].s, vps[1].n, &vps[2].s, &vps[3].s, &vps[4].s);
1268
+				return sr_kemi_lua_return_int(L, ket, ret);
1269
+			} else if(ket->ptypes[0]==SR_KEMIP_STR
1270
+					&& ket->ptypes[1]==SR_KEMIP_INT
1271
+					&& ket->ptypes[2]==SR_KEMIP_STR
1272
+					&& ket->ptypes[3]==SR_KEMIP_STR
1273
+					&& ket->ptypes[4]==SR_KEMIP_INT) {
1274
+				ret = ((sr_kemi_fmsnssn_f)(ket->func))(env_L->msg,
1275
+						&vps[0].s, vps[1].n, &vps[2].s, &vps[3].s, vps[4].n);
1276
+				return sr_kemi_lua_return_int(L, ket, ret);
1277
+			} else if(ket->ptypes[0]==SR_KEMIP_STR
1278
+					&& ket->ptypes[1]==SR_KEMIP_INT
1279
+					&& ket->ptypes[2]==SR_KEMIP_STR
1280
+					&& ket->ptypes[3]==SR_KEMIP_INT
1281
+					&& ket->ptypes[4]==SR_KEMIP_STR) {
1282
+				ret = ((sr_kemi_fmsnsns_f)(ket->func))(env_L->msg,
1283
+						&vps[0].s, vps[1].n, &vps[2].s, vps[3].n, &vps[4].s);
1284
+				return sr_kemi_lua_return_int(L, ket, ret);
1285
+			} else if(ket->ptypes[0]==SR_KEMIP_STR
1286
+					&& ket->ptypes[1]==SR_KEMIP_INT
1287
+					&& ket->ptypes[2]==SR_KEMIP_STR
1288
+					&& ket->ptypes[3]==SR_KEMIP_INT
1289
+					&& ket->ptypes[4]==SR_KEMIP_INT) {
1290
+				ret = ((sr_kemi_fmsnsnn_f)(ket->func))(env_L->msg,
1291
+						&vps[0].s, vps[1].n, &vps[2].s, vps[3].n, vps[4].n);
1292
+				return sr_kemi_lua_return_int(L, ket, ret);
1293
+			} else if(ket->ptypes[0]==SR_KEMIP_STR
1294
+					&& ket->ptypes[1]==SR_KEMIP_INT
1295
+					&& ket->ptypes[2]==SR_KEMIP_INT
1296
+					&& ket->ptypes[3]==SR_KEMIP_STR
1297
+					&& ket->ptypes[4]==SR_KEMIP_STR) {
1298
+				ret = ((sr_kemi_fmsnnss_f)(ket->func))(env_L->msg,
1299
+						&vps[0].s, vps[1].n, vps[2].n, &vps[3].s, &vps[4].s);
1300
+				return sr_kemi_lua_return_int(L, ket, ret);
1301
+			} else if(ket->ptypes[0]==SR_KEMIP_STR
1302
+					&& ket->ptypes[1]==SR_KEMIP_INT
1303
+					&& ket->ptypes[2]==SR_KEMIP_INT
1304
+					&& ket->ptypes[3]==SR_KEMIP_STR
1305
+					&& ket->ptypes[4]==SR_KEMIP_INT) {
1306
+				ret = ((sr_kemi_fmsnnsn_f)(ket->func))(env_L->msg,
1307
+						&vps[0].s, vps[1].n, vps[2].n, &vps[3].s, vps[4].n);
1308
+				return sr_kemi_lua_return_int(L, ket, ret);
1309
+			} else if(ket->ptypes[0]==SR_KEMIP_STR
1310
+					&& ket->ptypes[1]==SR_KEMIP_INT
1311
+					&& ket->ptypes[2]==SR_KEMIP_INT
1312
+					&& ket->ptypes[3]==SR_KEMIP_INT
1313
+					&& ket->ptypes[4]==SR_KEMIP_STR) {
1314
+				ret = ((sr_kemi_fmsnnns_f)(ket->func))(env_L->msg,
1315
+						&vps[0].s, vps[1].n, vps[2].n, vps[3].n, &vps[4].s);
1316
+				return sr_kemi_lua_return_int(L, ket, ret);
1317
+			} else if(ket->ptypes[0]==SR_KEMIP_STR
1318
+					&& ket->ptypes[1]==SR_KEMIP_INT
1319
+					&& ket->ptypes[2]==SR_KEMIP_INT
1320
+					&& ket->ptypes[3]==SR_KEMIP_INT
1321
+					&& ket->ptypes[4]==SR_KEMIP_INT) {
1322
+				ret = ((sr_kemi_fmsnnnn_f)(ket->func))(env_L->msg,
1323
+						&vps[0].s, vps[1].n, vps[2].n, vps[3].n, vps[4].n);
1324
+				return sr_kemi_lua_return_int(L, ket, ret);
1325
+			} else if(ket->ptypes[0]==SR_KEMIP_INT
1326
+					&& ket->ptypes[1]==SR_KEMIP_STR
1327
+					&& ket->ptypes[2]==SR_KEMIP_STR
1328
+					&& ket->ptypes[3]==SR_KEMIP_STR
1329
+					&& ket->ptypes[4]==SR_KEMIP_STR) {
1330
+				ret = ((sr_kemi_fmnssss_f)(ket->func))(env_L->msg,
1331
+						vps[0].n, &vps[1].s, &vps[2].s, &vps[3].s, &vps[4].s);
1332
+				return sr_kemi_lua_return_int(L, ket, ret);
1333
+			} else if(ket->ptypes[0]==SR_KEMIP_INT
1334
+					&& ket->ptypes[1]==SR_KEMIP_STR
1335
+					&& ket->ptypes[2]==SR_KEMIP_STR
1336
+					&& ket->ptypes[3]==SR_KEMIP_STR
1337
+					&& ket->ptypes[4]==SR_KEMIP_INT) {
1338
+				ret = ((sr_kemi_fmnsssn_f)(ket->func))(env_L->msg,
1339
+						vps[0].n, &vps[1].s, &vps[2].s, &vps[3].s, vps[4].n);
1340
+				return sr_kemi_lua_return_int(L, ket, ret);
1341
+			} else if(ket->ptypes[0]==SR_KEMIP_INT
1342
+					&& ket->ptypes[1]==SR_KEMIP_STR
1343
+					&& ket->ptypes[2]==SR_KEMIP_STR
1344
+					&& ket->ptypes[3]==SR_KEMIP_INT
1345
+					&& ket->ptypes[4]==SR_KEMIP_STR) {
1346
+				ret = ((sr_kemi_fmnssns_f)(ket->func))(env_L->msg,
1347
+						vps[0].n, &vps[1].s, &vps[2].s, vps[3].n, &vps[4].s);
1348
+				return sr_kemi_lua_return_int(L, ket, ret);
1349
+			} else if(ket->ptypes[0]==SR_KEMIP_INT
1350
+					&& ket->ptypes[1]==SR_KEMIP_STR
1351
+					&& ket->ptypes[2]==SR_KEMIP_STR
1352
+					&& ket->ptypes[3]==SR_KEMIP_INT
1353
+					&& ket->ptypes[4]==SR_KEMIP_INT) {
1354
+				ret = ((sr_kemi_fmnssnn_f)(ket->func))(env_L->msg,
1355
+						vps[0].n, &vps[1].s, &vps[2].s, vps[3].n, vps[4].n);
1356
+				return sr_kemi_lua_return_int(L, ket, ret);
1357
+			} else if(ket->ptypes[0]==SR_KEMIP_INT
1358
+					&& ket->ptypes[1]==SR_KEMIP_STR
1359
+					&& ket->ptypes[2]==SR_KEMIP_INT
1360
+					&& ket->ptypes[3]==SR_KEMIP_STR
1361
+					&& ket->ptypes[4]==SR_KEMIP_STR) {
1362
+				ret = ((sr_kemi_fmnsnss_f)(ket->func))(env_L->msg,
1363
+						vps[0].n, &vps[1].s, vps[2].n, &vps[3].s, &vps[4].s);
1364
+				return sr_kemi_lua_return_int(L, ket, ret);
1365
+			} else if(ket->ptypes[0]==SR_KEMIP_INT
1366
+					&& ket->ptypes[1]==SR_KEMIP_STR
1367
+					&& ket->ptypes[2]==SR_KEMIP_INT
1368
+					&& ket->ptypes[3]==SR_KEMIP_STR
1369
+					&& ket->ptypes[4]==SR_KEMIP_INT) {
1370
+				ret = ((sr_kemi_fmnsnsn_f)(ket->func))(env_L->msg,
1371
+						vps[0].n, &vps[1].s, vps[2].n, &vps[3].s, vps[4].n);
1372
+				return sr_kemi_lua_return_int(L, ket, ret);
1373
+			} else if(ket->ptypes[0]==SR_KEMIP_INT
1374
+					&& ket->ptypes[1]==SR_KEMIP_STR
1375
+					&& ket->ptypes[2]==SR_KEMIP_INT
1376
+					&& ket->ptypes[3]==SR_KEMIP_INT
1377
+					&& ket->ptypes[4]==SR_KEMIP_STR) {
1378
+				ret = ((sr_kemi_fmnsnns_f)(ket->func))(env_L->msg,
1379
+						vps[0].n, &vps[1].s, vps[2].n, vps[3].n, &vps[4].s);
1380
+				return sr_kemi_lua_return_int(L, ket, ret);
1381
+			} else if(ket->ptypes[0]==SR_KEMIP_INT
1382
+					&& ket->ptypes[1]==SR_KEMIP_STR
1383
+					&& ket->ptypes[2]==SR_KEMIP_INT
1384
+					&& ket->ptypes[3]==SR_KEMIP_INT
1385
+					&& ket->ptypes[4]==SR_KEMIP_INT) {
1386
+				ret = ((sr_kemi_fmnsnnn_f)(ket->func))(env_L->msg,
1387
+						vps[0].n, &vps[1].s, vps[2].n, vps[3].n, vps[4].n);
1388
+				return sr_kemi_lua_return_int(L, ket, ret);
1389
+			} else if(ket->ptypes[0]==SR_KEMIP_INT
1390
+					&& ket->ptypes[1]==SR_KEMIP_INT
1391
+					&& ket->ptypes[2]==SR_KEMIP_STR
1392
+					&& ket->ptypes[3]==SR_KEMIP_STR
1393
+					&& ket->ptypes[4]==SR_KEMIP_STR) {
1394
+				ret = ((sr_kemi_fmnnsss_f)(ket->func))(env_L->msg,
1395
+						vps[0].n, vps[1].n, &vps[2].s, &vps[3].s, &vps[4].s);
1396
+				return sr_kemi_lua_return_int(L, ket, ret);
1397
+			} else if(ket->ptypes[0]==SR_KEMIP_INT
1398
+					&& ket->ptypes[1]==SR_KEMIP_INT
1399
+					&& ket->ptypes[2]==SR_KEMIP_STR
1400
+					&& ket->ptypes[3]==SR_KEMIP_STR
1401
+					&& ket->ptypes[4]==SR_KEMIP_INT) {
1402
+				ret = ((sr_kemi_fmnnssn_f)(ket->func))(env_L->msg,
1403
+						vps[0].n, vps[1].n, &vps[2].s, &vps[3].s, vps[4].n);
1404
+				return sr_kemi_lua_return_int(L, ket, ret);
1405
+			} else if(ket->ptypes[0]==SR_KEMIP_INT
1406
+					&& ket->ptypes[1]==SR_KEMIP_INT
1407
+					&& ket->ptypes[2]==SR_KEMIP_STR
1408
+					&& ket->ptypes[3]==SR_KEMIP_INT
1409
+					&& ket->ptypes[4]==SR_KEMIP_STR) {
1410
+				ret = ((sr_kemi_fmnnsns_f)(ket->func))(env_L->msg,
1411
+						vps[0].n, vps[1].n, &vps[2].s, vps[3].n, &vps[4].s);
1412
+				return sr_kemi_lua_return_int(L, ket, ret);
1413
+			} else if(ket->ptypes[0]==SR_KEMIP_INT
1414
+					&& ket->ptypes[1]==SR_KEMIP_INT
1415
+					&& ket->ptypes[2]==SR_KEMIP_STR
1416
+					&& ket->ptypes[3]==SR_KEMIP_INT
1417
+					&& ket->ptypes[4]==SR_KEMIP_INT) {
1418
+				ret = ((sr_kemi_fmnnsnn_f)(ket->func))(env_L->msg,
1419
+						vps[0].n, vps[1].n, &vps[2].s, vps[3].n, vps[4].n);
1420
+				return sr_kemi_lua_return_int(L, ket, ret);
1421
+			} else if(ket->ptypes[0]==SR_KEMIP_INT
1422
+					&& ket->ptypes[1]==SR_KEMIP_INT
1423
+					&& ket->ptypes[2]==SR_KEMIP_INT
1424
+					&& ket->ptypes[3]==SR_KEMIP_STR
1425
+					&& ket->ptypes[4]==SR_KEMIP_STR) {
1426
+				ret = ((sr_kemi_fmnnnss_f)(ket->func))(env_L->msg,
1427
+						vps[0].n, vps[1].n, vps[2].n, &vps[3].s, &vps[4].s);
1428
+				return sr_kemi_lua_return_int(L, ket, ret);
1429
+			} else if(ket->ptypes[0]==SR_KEMIP_INT
1430
+					&& ket->ptypes[1]==SR_KEMIP_INT
1431
+					&& ket->ptypes[2]==SR_KEMIP_INT
1432
+					&& ket->ptypes[3]==SR_KEMIP_STR
1433
+					&& ket->ptypes[4]==SR_KEMIP_INT) {
1434
+				ret = ((sr_kemi_fmnnnsn_f)(ket->func))(env_L->msg,
1435
+						vps[0].n, vps[1].n, vps[2].n, &vps[3].s, vps[4].n);
1436
+				return sr_kemi_lua_return_int(L, ket, ret);
1437
+			} else if(ket->ptypes[0]==SR_KEMIP_INT
1438
+					&& ket->ptypes[1]==SR_KEMIP_INT
1439
+					&& ket->ptypes[2]==SR_KEMIP_INT
1440
+					&& ket->ptypes[3]==SR_KEMIP_INT
1441
+					&& ket->ptypes[4]==SR_KEMIP_STR) {
1442
+				ret = ((sr_kemi_fmnnnns_f)(ket->func))(env_L->msg,
1443
+						vps[0].n, vps[1].n, vps[2].n, vps[3].n, &vps[4].s);
1444
+				return sr_kemi_lua_return_int(L, ket, ret);
1445
+			} else if(ket->ptypes[0]==SR_KEMIP_INT
1446
+					&& ket->ptypes[1]==SR_KEMIP_INT
1447
+					&& ket->ptypes[2]==SR_KEMIP_INT
1448
+					&& ket->ptypes[3]==SR_KEMIP_INT
1449
+					&& ket->ptypes[4]==SR_KEMIP_INT) {
1450
+				ret = ((sr_kemi_fmnnnnn_f)(ket->func))(env_L->msg,
1451
+						vps[0].n, vps[1].n, vps[2].n, vps[3].n, vps[4].n);
1452
+				return sr_kemi_lua_return_int(L, ket, ret);
1453
+			} else {
1454
+				LM_ERR("invalid parameters for: %.*s\n", fname->len, fname->s);
1455
+				return app_lua_return_false(L);
1456
+			}
1457
+		break;
1458
+		case 6:
1459
+			if(ket->ptypes[0]==SR_KEMIP_STR
1460
+					&& ket->ptypes[1]==SR_KEMIP_STR
1461
+					&& ket->ptypes[2]==SR_KEMIP_STR
1462
+					&& ket->ptypes[3]==SR_KEMIP_STR
1463
+					&& ket->ptypes[4]==SR_KEMIP_STR
1464
+					&& ket->ptypes[5]==SR_KEMIP_STR) {
1465
+				ret = ((sr_kemi_fmssssss_f)(ket->func))(env_L->msg,
1466
+						&vps[0].s, &vps[1].s, &vps[2].s, &vps[3].s,
1467
+						&vps[4].s, &vps[5].s);
1468
+				return sr_kemi_lua_return_int(L, ket, ret);
1469
+			} else {
1470
+				LM_ERR("invalid parameters for: %.*s\n",
1471
+						fname->len, fname->s);
1472
+				return app_lua_return_false(L);
1473
+			}
1474
+		break;
1475
+		default:
1476
+			LM_ERR("invalid parameters for: %.*s\n",
1477
+					fname->len, fname->s);
1478
+			return app_lua_return_false(L);
1479
+	}
1480
+}
1481
+
1482
+/**
1483
+ *
1484
+ */
1485
+int sr_kemi_exec_func(lua_State* L, str *mname, int midx, str *fname)
1486
+{
1487
+	int pdelta;
1488
+	sr_kemi_t *ket = NULL;
1489
+	sr_lua_env_t *env_L;
1490
+
1491
+	env_L = sr_lua_env_get();
1492
+
1493
+	if(env_L==NULL || env_L->msg==NULL) {
1494
+		LM_ERR("invalid Lua environment attributes\n");
1495
+		return app_lua_return_false(L);
1496
+	}
1497
+
1498
+	ket = sr_kemi_lookup(mname, midx, fname);
1499
+	if(ket==NULL) {
1500
+		LM_ERR("cannot find function (%d): %.*s.%.*s\n", midx,
1501
+				(mname && mname->len>0)?mname->len:0,
1502
+				(mname && mname->len>0)?mname->s:"",
1503
+				fname->len, fname->s);
1504
+		return app_lua_return_false(L);
1505
+	}
1506
+	if(mname->len<=0) {
1507
+		pdelta = 1;
1508
+	} else {
1509
+		pdelta = 3;
1510
+	}
1511
+	return sr_kemi_lua_exec_func_ex(L, ket, pdelta);
1512
+}
1513
+
1514
+/**
1515
+ *
1516
+ */
1517
+int sr_kemi_lua_exec_func(lua_State* L, int eidx)
1518
+{
1519
+	sr_kemi_t *ket;
1520
+	int ret;
1521
+	struct timeval tvb, tve;
1522
+	struct timezone tz;
1523
+	unsigned int tdiff;
1524
+	lua_Debug dinfo;
1525
+
1526
+	ket = sr_kemi_lua_export_get(eidx);
1527
+	if(unlikely(cfg_get(core, core_cfg, latency_limit_action)>0)
1528
+			&& is_printable(cfg_get(core, core_cfg, latency_log))) {
1529
+		gettimeofday(&tvb, &tz);
1530
+	}
1531
+
1532
+	ret = sr_kemi_lua_exec_func_ex(L, ket, 0);
1533
+
1534
+	if(unlikely(cfg_get(core, core_cfg, latency_limit_action)>0)
1535
+			&& is_printable(cfg_get(core, core_cfg, latency_log))) {
1536
+		gettimeofday(&tve, &tz);
1537
+		tdiff = (tve.tv_sec - tvb.tv_sec) * 1000000
1538
+				   + (tve.tv_usec - tvb.tv_usec);
1539
+		if(tdiff >= cfg_get(core, core_cfg, latency_limit_action)) {
1540
+			memset(&dinfo, 0, sizeof(lua_Debug));
1541
+			if(lua_getstack(L, 1, &dinfo)>0
1542
+						&& lua_getinfo(L, "nSl", &dinfo)>0) {
1543
+				LOG(cfg_get(core, core_cfg, latency_log),
1544
+						"alert - action KSR.%s%s%s(...)"
1545
+						" took too long [%u us] (%s:%d - %s [%s])\n",
1546
+						(ket->mname.len>0)?ket->mname.s:"",
1547
+						(ket->mname.len>0)?".":"", ket->fname.s,
1548
+						tdiff,
1549
+						(dinfo.short_src[0])?dinfo.short_src:"<unknown>",
1550
+						dinfo.currentline,
1551
+						(dinfo.name)?dinfo.name:"<unknown>",
1552
+						(dinfo.what)?dinfo.what:"<unknown>");
1553
+			} else {
1554
+				LOG(cfg_get(core, core_cfg, latency_log),
1555
+						"alert - action KSR.%s%s%s(...)"
1556
+						" took too long [%u us]\n",
1557
+						(ket->mname.len>0)?ket->mname.s:"",
1558
+						(ket->mname.len>0)?".":"", ket->fname.s,
1559
+						tdiff);
1560
+			}
1561
+		}
1562
+	}
1563
+
1564
+	return ret;
1565
+}
1566
+
1567
+/**
1568
+ *
1569
+ */
1570
+static int sr_kemi_lua_modf (lua_State *L)
1571
+{
1572
+	int ret;
1573
+	char *luav[MAX_ACTIONS];
1574
+	char *argv[MAX_ACTIONS];
1575
+	int argc;
1576
+	int i;
1577
+	int mod_type;
1578
+	struct run_act_ctx ra_ctx;
1579
+	struct action *act;
1580
+	ksr_cmd_export_t* expf;
1581
+	sr_lua_env_t *env_L;
1582
+
1583
+	ret = 1;
1584
+	act = NULL;
1585
+	argc = 0;
1586
+	memset(luav, 0, MAX_ACTIONS*sizeof(char*));
1587
+	memset(argv, 0, MAX_ACTIONS*sizeof(char*));
1588
+	env_L = sr_lua_env_get();
1589
+	if(env_L->msg==NULL)
1590
+		goto error;
1591
+
1592
+#if 0
1593
+	app_lua_dump_stack(L);
1594
+#endif
1595
+	argc = lua_gettop(L);
1596
+	if(argc==0)
1597
+	{
1598
+		LM_ERR("name of module function not provided\n");
1599
+		goto error;
1600
+	}
1601
+	if(argc>=MAX_ACTIONS)
1602
+	{
1603
+		LM_ERR("too many parameters\n");
1604
+		goto error;
1605
+	}
1606
+	/* first is function name, then parameters */
1607
+	for(i=1; i<=argc; i++)
1608
+	{
1609
+		if (!lua_isstring(L, i))
1610
+		{
1611
+			LM_ERR("invalid parameter type (%d)\n", i);
1612
+			goto error;
1613
+		}
1614
+		luav[i-1] = (char*)lua_tostring(L, i);
1615
+	}
1616
+	/* pkg copy only parameters */
1617
+	for(i=1; i<MAX_ACTIONS; i++)
1618
+	{
1619
+		if(luav[i]!=NULL)
1620
+		{
1621
+			argv[i] = (char*)pkg_malloc(strlen(luav[i])+1);
1622
+			if(argv[i]==NULL)
1623
+			{
1624
+				PKG_MEM_ERROR;
1625
+				goto error;
1626
+			}
1627
+			strcpy(argv[i], luav[i]);
1628
+		}
1629
+	}
1630
+
1631
+	expf = find_export_record(luav[0], argc-1, 0);
1632
+	if (expf==NULL) {
1633
+		LM_ERR("function '%s' is not available\n", luav[0]);
1634
+		goto error;
1635
+	}
1636
+	/* check fixups */
1637
+	if (expf->fixup!=NULL && expf->free_fixup==NULL) {
1638
+		LM_ERR("function '%s' has fixup - cannot be used\n", luav[0]);
1639
+		goto error;
1640
+	}
1641
+	switch(expf->param_no) {
1642
+		case 0:
1643
+			mod_type = MODULE0_T;
1644
+			break;
1645
+		case 1:
1646
+			mod_type = MODULE1_T;
1647
+			break;
1648
+		case 2:
1649
+			mod_type = MODULE2_T;
1650
+			break;
1651
+		case 3:
1652
+			mod_type = MODULE3_T;
1653
+			break;
1654
+		case 4:
1655
+			mod_type = MODULE4_T;
1656
+			break;
1657
+		case 5:
1658
+			mod_type = MODULE5_T;
1659
+			break;
1660
+		case 6:
1661
+			mod_type = MODULE6_T;
1662
+			break;
1663
+		case VAR_PARAM_NO:
1664
+			mod_type = MODULEX_T;
1665
+			break;
1666
+		default:
1667
+			LM_ERR("unknown/bad definition for function '%s' (%d params)\n",
1668
+					luav[0], expf->param_no);
1669
+			goto error;
1670
+	}
1671
+
1672
+	act = mk_action(mod_type,  argc+1   /* number of (type, value) pairs */,
1673
+					MODEXP_ST, expf,    /* function */
1674
+					NUMBER_ST, argc-1,  /* parameter number */
1675
+					STRING_ST, argv[1], /* param. 1 */
1676
+					STRING_ST, argv[2], /* param. 2 */
1677
+					STRING_ST, argv[3], /* param. 3 */
1678
+					STRING_ST, argv[4], /* param. 4 */
1679
+					STRING_ST, argv[5], /* param. 5 */
1680
+					STRING_ST, argv[6]  /* param. 6 */
1681
+			);
1682
+
1683
+	if (act==NULL) {
1684
+		LM_ERR("action structure could not be created for '%s'\n", luav[0]);
1685
+		goto error;
1686
+	}
1687
+
1688
+	/* handle fixups */
1689
+	if (expf->fixup) {
1690
+		if(argc==1)
1691
+		{ /* no parameters */
1692
+			if(expf->fixup(0, 0)<0)
1693
+			{
1694
+				LM_ERR("Error in fixup (0) for '%s'\n", luav[0]);
1695
+				goto error;
1696
+			}
1697
+		} else {
1698
+			for(i=1; i<argc; i++)
1699
+			{
1700
+				if(expf->fixup(&(act->val[i+1].u.data), i)<0)
1701
+				{
1702
+					LM_ERR("Error in fixup (%d) for '%s'\n", i, luav[0]);
1703
+					goto error;
1704
+				}
1705
+				act->val[i+1].type = MODFIXUP_ST;
1706
+			}
1707
+		}
1708
+	}
1709
+	init_run_actions_ctx(&ra_ctx);
1710
+	ret = do_action(&ra_ctx, act, env_L->msg);
1711
+
1712
+	/* free fixups */
1713
+	if (expf->fixup) {
1714
+		for(i=1; i<argc; i++)
1715
+		{
1716
+			if ((act->val[i+1].type == MODFIXUP_ST) && (act->val[i+1].u.data))
1717
+			{
1718
+				expf->free_fixup(&(act->val[i+1].u.data), i);
1719
+			}
1720
+		}
1721
+	}
1722
+	pkg_free(act);
1723
+	for(i=0; i<MAX_ACTIONS; i++)
1724
+	{
1725
+		if(argv[i]!=NULL) pkg_free(argv[i]);
1726
+		argv[i] = 0;
1727
+	}
1728
+	lua_pushinteger(L, ret);
1729
+	return 1;
1730
+
1731
+error:
1732
+	if(act!=NULL)
1733
+		pkg_free(act);
1734
+	for(i=0; i<MAX_ACTIONS; i++)
1735
+	{
1736
+		if(argv[i]!=NULL) pkg_free(argv[i]);
1737
+		argv[i] = 0;
1738
+	}
1739
+	lua_pushinteger(L, -1);
1740
+	return 1;
1741
+}
1742
+
1743
+/**
1744
+ *
1745
+ */
1746
+static int sr_kemi_lua_exit (lua_State *L)
1747
+{
1748
+	str *s;
1749
+
1750
+	LM_DBG("script exit call\n");
1751
+	s = sr_kemi_lua_exit_string_get();
1752
+	lua_getglobal(L, "error");
1753
+	lua_pushstring(L, s->s);
1754
+	lua_call(L, 1, 0);
1755
+	return 0;
1756
+}
1757
+
1758
+/**
1759
+ *
1760
+ */
1761
+static int sr_kemi_lua_drop (lua_State *L)
1762
+{
1763
+	str *s;
1764
+
1765
+	LM_DBG("script drop call\n");
1766
+	sr_kemi_core_set_drop(NULL);
1767
+	s = sr_kemi_lua_exit_string_get();
1768
+	lua_getglobal(L, "error");
1769
+	lua_pushstring(L, s->s);
1770
+	lua_call(L, 1, 0);
1771
+	return 0;
1772
+}
1773
+
1774
+/**
1775
+ *
1776
+ */
1777
+static int sr_kemi_lua_probe (lua_State *L)
1778
+{
1779
+	LM_DBG("someone probing from lua\n");
1780
+	return 0;
1781
+}
1782
+
1783
+/**
1784
+ *
1785
+ */
1786
+static const luaL_Reg _sr_kemi_x_Map [] = {
1787
+	{"modf",      sr_kemi_lua_modf},
1788
+	{"exit",      sr_kemi_lua_exit},
1789
+	{"drop",      sr_kemi_lua_drop},
1790
+	{"probe",     sr_kemi_lua_probe},
1791
+	{NULL, NULL}
1792
+};
1793
+
1794
+
1795
+/**
1796
+ *
1797
+ */
1798
+luaL_Reg *_sr_KSRMethods = NULL;
1799
+
1800
+#define SR_LUA_KSR_MODULES_SIZE	256
1801
+#define SR_LUA_KSR_METHODS_SIZE	(SR_KEMI_LUA_EXPORT_SIZE + SR_LUA_KSR_MODULES_SIZE)
1802
+
1803
+/**
1804
+ *
1805
+ */
1806
+void lua_sr_kemi_register_libs(lua_State *L)
1807
+{
1808
+	luaL_Reg *_sr_crt_KSRMethods = NULL;
1809
+	sr_kemi_module_t *emods = NULL;
1810
+	int emods_size = 0;
1811
+	int i;
1812
+	int k;
1813
+	int n;
1814
+	char mname[128];
1815
+
1816
+#if 0
1817
+	/* dynamic lookup on function name */
1818
+	lua_sr_kemi_register_core(L);
1819
+	lua_sr_kemi_register_modules(L);
1820
+#endif
1821
+
1822
+	_sr_KSRMethods = malloc(SR_LUA_KSR_METHODS_SIZE * sizeof(luaL_Reg));
1823
+	if(_sr_KSRMethods==NULL) {
1824
+		LM_ERR("no more pkg memory\n");
1825
+		return;
1826
+	}
1827
+	memset(_sr_KSRMethods, 0, SR_LUA_KSR_METHODS_SIZE * sizeof(luaL_Reg));
1828
+
1829
+	emods_size = sr_kemi_modules_size_get();
1830
+	emods = sr_kemi_modules_get();
1831
+
1832
+	n = 0;
1833
+	_sr_crt_KSRMethods = _sr_KSRMethods;
1834
+	if(emods_size==0 || emods[0].kexp==NULL) {
1835
+		LM_ERR("no kemi exports registered\n");
1836
+		return;
1837
+	}
1838
+
1839
+	for(i=0; emods[0].kexp[i].func!=NULL; i++) {
1840
+		if(_ksr_app_lua_log_mode & KSR_APP_LUA_LOG_EXPORTS) {
1841
+			LM_DBG("exporting KSR.%s(...)\n", emods[0].kexp[i].fname.s);
1842
+		}
1843
+		_sr_crt_KSRMethods[i].name = emods[0].kexp[i].fname.s;
1844
+		_sr_crt_KSRMethods[i].func =
1845
+			sr_kemi_lua_export_associate(&emods[0].kexp[i]);
1846
+		if(_sr_crt_KSRMethods[i].func == NULL) {
1847
+			LM_ERR("failed to associate kemi function with lua export\n");
1848
+			free(_sr_KSRMethods);
1849
+			_sr_KSRMethods = NULL;
1850
+			return;
1851
+		}
1852
+		n++;
1853
+	}
1854
+
1855
+	luaL_openlib(L, "KSR", _sr_crt_KSRMethods, 0);
1856
+
1857
+	luaL_openlib(L, "KSR.x",  _sr_kemi_x_Map, 0);
1858
+
1859
+	/* registered kemi modules */
1860
+	if(emods_size>1) {
1861
+		for(k=1; k<emods_size; k++) {
1862
+			n++;
1863
+			_sr_crt_KSRMethods = _sr_KSRMethods + n;
1864
+			snprintf(mname, 128, "KSR.%s", emods[k].kexp[0].mname.s);
1865
+			for(i=0; emods[k].kexp[i].func!=NULL; i++) {
1866
+				if(_ksr_app_lua_log_mode & KSR_APP_LUA_LOG_EXPORTS) {
1867
+					LM_DBG("exporting %s.%s(...)\n", mname,
1868
+							emods[k].kexp[i].fname.s);
1869
+				}
1870
+				_sr_crt_KSRMethods[i].name = emods[k].kexp[i].fname.s;
1871
+				_sr_crt_KSRMethods[i].func =
1872
+					sr_kemi_lua_export_associate(&emods[k].kexp[i]);
1873
+				if(_sr_crt_KSRMethods[i].func == NULL) {
1874
+					LM_ERR("failed to associate kemi function with func export\n");
1875
+					free(_sr_KSRMethods);
1876
+					_sr_KSRMethods = NULL;
1877
+					return;
1878
+				}
1879
+				n++;
1880
+			}
1881
+			if(!lua_checkstack(L, i+8)) {
1882
+				LM_ERR("not enough Lua stack capacity\n");
1883
+				exit(-1);
1884
+			}
1885
+			luaL_openlib(L, mname, _sr_crt_KSRMethods, 0);
1886
+			if(_ksr_app_lua_log_mode & KSR_APP_LUA_LOG_EXPORTS) {
1887
+				LM_DBG("initializing kemi sub-module: %s (%s) (%d/%d/%d)\n",
1888
+						mname, emods[k].kexp[0].mname.s, i, k, n);
1889
+			}
1890
+		}
1891
+	}
1892
+	LM_DBG("module 'KSR' has been initialized (%d/%d)\n", emods_size, n);
1893
+}
1894
+
1895
+static const char* app_lua_rpc_api_list_doc[2] = {
1896
+	"list kemi exports to lua",
1897
+	0
1898
+};
1899
+
1900
+static void app_lua_rpc_api_list(rpc_t* rpc, void* ctx)
1901
+{
1902
+	int i;
1903
+	int n;
1904
+	sr_kemi_t *ket;
1905
+	void* th;
1906
+	void* sh;
1907
+	void* ih;
1908
+
1909
+	if (rpc->add(ctx, "{", &th) < 0) {
1910
+		rpc->fault(ctx, 500, "Internal error root reply");
1911
+		return;
1912
+	}
1913
+
1914
+	/* count the number of exported functions */
1915
+	n = 0;
1916
+	for(i=0; i<SR_KEMI_LUA_EXPORT_SIZE; i++) {
1917
+		ket = sr_kemi_lua_export_get(i);
1918
+		if(ket==NULL) continue;
1919
+		n++;
1920
+	}
1921
+
1922
+	if(rpc->struct_add(th, "d[",
1923
+				"msize", n,
1924
+				"methods",  &ih)<0)
1925
+	{
1926
+		rpc->fault(ctx, 500, "Internal error array structure");
1927
+		return;
1928
+	}
1929
+	for(i=0; i<SR_KEMI_LUA_EXPORT_SIZE; i++) {
1930
+		ket = sr_kemi_lua_export_get(i);
1931
+		if(ket==NULL) continue;
1932
+		if(rpc->struct_add(ih, "{", "func", &sh)<0) {
1933
+			rpc->fault(ctx, 500, "Internal error internal structure");
1934
+			return;
1935
+		}
1936
+		if(rpc->struct_add(sh, "SSSS",
1937
+				"ret", sr_kemi_param_map_get_name(ket->rtype),
1938
+				"module", &ket->mname,
1939
+				"name", &ket->fname,
1940
+				"params", sr_kemi_param_map_get_params(ket->ptypes))<0) {
1941
+			LM_ERR("failed to add the structure with attributes (%d)\n", i);
1942
+			rpc->fault(ctx, 500, "Internal error creating dest struct");
1943
+			return;
1944
+		}
1945
+	}
1946
+}
1947
+
1948
+/*** RPC implementation ***/
1949
+
1950
+static const char* app_lua_rpc_reload_doc[2] = {
1951
+	"Reload lua script",
1952
+	0
1953
+};
1954
+
1955
+static const char* app_lua_rpc_list_doc[2] = {
1956
+	"list lua scripts",
1957
+	0
1958
+};
1959
+
1960
+static void app_lua_rpc_reload(rpc_t* rpc, void* ctx)
1961
+{
1962
+	int pos = -1;
1963
+
1964
+	rpc->scan(ctx, "*d", &pos);
1965
+	LM_DBG("selected index: %d\n", pos);
1966
+	if(lua_sr_reload_script(pos)<0)
1967
+		rpc->fault(ctx, 500, "Reload Failed");
1968
+	return;
1969
+}
1970
+
1971
+static void app_lua_rpc_list(rpc_t* rpc, void* ctx)
1972
+{
1973
+	int i;
1974
+	sr_lua_load_t *list = NULL, *li;
1975
+	if(lua_sr_list_script(&list)<0)
1976
+	{
1977
+		LM_ERR("Can't get loaded scripts\n");
1978
+		return;
1979
+	}
1980
+	if(list)
1981
+	{
1982
+		li = list;
1983
+		i = 0;
1984
+		while(li)
1985
+		{
1986
+			rpc->rpl_printf(ctx, "%d: [%s]", i, li->script);
1987
+			li = li->next;
1988
+			i += 1;
1989
+		}
1990
+	}
1991
+	else {
1992
+		rpc->rpl_printf(ctx,"No scripts loaded");
1993
+	}
1994
+	return;
1995
+}
1996
+
1997
+rpc_export_t app_lua_rpc_cmds[] = {
1998
+	{"app_lua.reload", app_lua_rpc_reload,
1999
+		app_lua_rpc_reload_doc, 0},
2000
+	{"app_lua.list", app_lua_rpc_list,
2001
+		app_lua_rpc_list_doc, 0},
2002
+	{"app_lua.api_list", app_lua_rpc_api_list,
2003
+		app_lua_rpc_api_list_doc, 0},
2004
+	{0, 0, 0, 0}
2005
+};
2006
+
2007
+/**
2008
+ * register RPC commands
2009
+ */
2010
+int app_lua_init_rpc(void)
2011
+{
2012
+	if (rpc_register_array(app_lua_rpc_cmds)!=0)
2013
+	{
2014
+		LM_ERR("failed to register RPC commands\n");
2015
+		return -1;
2016
+	}
2017
+	return 0;
2018
+}
... ...
@@ -27,6 +27,7 @@
27 27
 #include <lualib.h>
28 28
 
29 29
 #include "../../core/parser/msg_parser.h"
30
+#include "../../core/kemi.h"
30 31
 
31 32
 /**
32 33
  * version variable stores a version counter for each script loaded.
... ...
@@ -54,6 +55,10 @@ typedef struct _sr_lua_load
54 55
 	struct _sr_lua_load *next;
55 56
 } sr_lua_load_t;
56 57
 
58
+typedef void (*app_lua_openlibs_f)(lua_State *L);
59
+
60
+int app_lua_openlibs_register(app_lua_openlibs_f rfunc);
61
+
57 62
 sr_lua_env_t *sr_lua_env_get(void);
58 63
 
59 64
 int lua_sr_initialized(void);
... ...
@@ -66,7 +71,6 @@ int lua_sr_list_script(sr_lua_load_t **list);
66 71
 
67 72
 int sr_lua_load_script(char *script);
68 73
 int sr_lua_reload_script(void);
69
-int sr_lua_register_module(char *mname);
70 74
 int sr_lua_reload_module(unsigned int reload);
71 75
 
72 76
 int app_lua_dostring(struct sip_msg *msg, char *script);
... ...
@@ -89,5 +93,9 @@ void app_lua_dump_stack(lua_State *L);
89 93
 
90 94
 str* sr_kemi_lua_exit_string_get(void);
91 95
 
96
+int sr_kemi_lua_exec_func(lua_State* L, int eidx);
97
+
98
+int app_lua_init_rpc(void);
99
+
92 100
 #endif
93 101
 
94 102
deleted file mode 100644
... ...
@@ -1,3730 +0,0 @@
1
-/**
2
- * Copyright (C) 2010-2016 Daniel-Constantin Mierla (asipto.com)
3
- *
4
- * This file is part of Kamailio, a free SIP server.