Browse code

app_ruby: initial import of embedded ruby interpreter module

- allow execution of ruby scripts using kemi exports

Daniel-Constantin Mierla authored on 30/05/2018 06:19:54
Showing 11 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,37 @@
1
+#
2
+# app_ruby module makefile
3
+#
4
+# WARNING: do not run this directly, it should be run by the master Makefile
5
+
6
+include ../../Makefile.defs
7
+auto_gen=
8
+NAME=app_ruby.so
9
+
10
+RUBYVER=ruby-2.5
11
+
12
+ifeq ($(CROSS_COMPILE),)
13
+	BUILDER = $(shell which pkg-config)
14
+ifneq ($(BUILDER),)
15
+	PKGLIBRUBY = $(shell $(BUILDER) --exists $(RUBYVER) > /dev/null 2>&1 ; echo $$? )
16
+ifneq ($(PKGLIBRUBY),0)
17
+	BUILDER =
18
+endif
19
+endif
20
+endif
21
+
22
+ifneq ($(BUILDER),)
23
+	DEFS += $(shell $(BUILDER) --cflags $(RUBYVER))
24
+	LIBS += $(shell $(BUILDER) --libs $(RUBYVER))
25
+else
26
+ifneq (,$(findstring darwin,$(OS)))
27
+	DEFS += -I/opt/local/include -I$(LOCALBASE)/include
28
+	LIBS += -L/opt/local/lib -L$(LOCALBASE)/lib -lev
29
+else
30
+	DEFS += -I$(LOCALBASE)/include -I$(SYSBASE)/include
31
+	LIBS += -L$(LOCALBASE)/lib -L$(SYSBASE)/lib -lruby -lpthread -ldl -lobjc
32
+endif
33
+endif
34
+
35
+DEFS+=-DKAMAILIO_MOD_INTERFACE
36
+
37
+include ../../Makefile.modules
0 38
new file mode 100644
... ...
@@ -0,0 +1,190 @@
1
+app_ruby Module
2
+
3
+Daniel-Constantin Mierla
4
+
5
+   asipto.com
6
+
7
+Edited by
8
+
9
+Daniel-Constantin Mierla
10
+
11
+   <miconda@gmail.com>
12
+
13
+   Copyright � 2018 Daniel-Constantin Mierla (asipto.com)
14
+     __________________________________________________________________
15
+
16
+   Table of Contents
17
+
18
+   1. Admin Guide
19
+
20
+        1. Overview
21
+        2. Dependencies
22
+
23
+              2.1. Kamailio Modules
24
+              2.2. External Libraries or Applications
25
+
26
+        3. Parameters
27
+
28
+              3.1. load (str)
29
+
30
+        4. Functions
31
+
32
+              4.1. ruby_run(function, params)
33
+
34
+        5. RPC Commands
35
+
36
+              5.1. app_ruby.reload
37
+              5.2. ruby_jsdt.api_list
38
+
39
+        6. Example of usage
40
+
41
+   List of Examples
42
+
43
+   1.1. Set load parameter
44
+   1.2. jsdt_run usage
45
+
46
+Chapter 1. Admin Guide
47
+
48
+   Table of Contents
49
+
50
+   1. Overview
51
+   2. Dependencies
52
+
53
+        2.1. Kamailio Modules
54
+        2.2. External Libraries or Applications
55
+
56
+   3. Parameters
57
+
58
+        3.1. load (str)
59
+
60
+   4. Functions
61
+
62
+        4.1. ruby_run(function, params)
63
+
64
+   5. RPC Commands
65
+
66
+        5.1. app_ruby.reload
67
+        5.2. ruby_jsdt.api_list
68
+
69
+   6. Example of usage
70
+
71
+1. Overview
72
+
73
+   This module allows executing Ruby scripts from the Kamailio
74
+   configuration file. It exports all KEMI functions to Ruby in order to
75
+   access the currently processed SIP message. These functions are
76
+   available within the Ruby module 'KSR'.
77
+
78
+2. Dependencies
79
+
80
+   2.1. Kamailio Modules
81
+   2.2. External Libraries or Applications
82
+
83
+2.1. Kamailio Modules
84
+
85
+   The following modules must be loaded before this module:
86
+     * none.
87
+
88
+2.2. External Libraries or Applications
89
+
90
+   The following libraries or applications must be installed before
91
+   running Kamailio with this module loaded:
92
+     * libruby - the ruby library (for compilation on Debian, ruby-dev
93
+       package is needed.
94
+
95
+3. Parameters
96
+
97
+   3.1. load (str)
98
+
99
+3.1. load (str)
100
+
101
+   Set the path to the Ruby file to be loaded at startup. Then you can use
102
+   Ruby_run(function, params) to execute a function from the script at
103
+   runtime. If you use it for KEMI configuration, then it has to include
104
+   the requited functions.
105
+
106
+   Default value is "null".
107
+
108
+   Example 1.1. Set load parameter
109
+...
110
+modparam("app_ruby", "load", "/usr/local/etc/kamailio/ruby/myscript.rb")
111
+...
112
+
113
+4. Functions
114
+
115
+   4.1. ruby_run(function, params)
116
+
117
+4.1. ruby_run(function, params)
118
+
119
+   Execute the Ruby function 'func' giving params as parameters. There can
120
+   be up to 3 string parameters. The function must exist in the script
121
+   loaded at startup via parameter 'load'. Parameters can be strings with
122
+   pseudo-variables that are evaluated at runtime.
123
+
124
+   Example 1.2. jsdt_run usage
125
+...
126
+if(!ruby_run("rb_append_fu_to_reply"))
127
+{
128
+    xdbg("SCRIPT: failed to execute ruby function!\n");
129
+}
130
+...
131
+ruby_run("rb_funcx", "$rU", "2");
132
+...
133
+
134
+5. RPC Commands
135
+
136
+   5.1. app_ruby.reload
137
+   5.2. ruby_jsdt.api_list
138
+
139
+5.1. app_ruby.reload
140
+
141
+   Marks the need to reload the js script. The actual reload is done by
142
+   every working process when the next call to ruby_run() function or KEMI
143
+   config is executed.
144
+
145
+   Name: app_ruby.reload
146
+
147
+   Parameters: none
148
+
149
+   Example:
150
+...
151
+kamcmd app_ruby.reload
152
+...
153
+
154
+5.2. ruby_jsdt.api_list
155
+
156
+   List the functions available via Kemi framework.
157
+
158
+   Name: ruby_jsdt.api_list
159
+
160
+   Parameters: none
161
+
162
+   Example:
163
+...
164
+kamcmd app_ruby.api_list
165
+...
166
+
167
+6. Example of usage
168
+
169
+   Create your Ruby script and store it on the file system, say:
170
+   '/usr/local/etc/kamailio/ruby/myscript.rb'.
171
+...
172
+def ksr_sl_reply()
173
+        KSR.dbg("==== from ruby\n")
174
+        KSR::SL.sl_send_reply(200, "OK-Ruby")
175
+end
176
+...
177
+
178
+   Load the script via parameter 'load' and execute function via
179
+   ruby_run(...).
180
+...
181
+modparam("app_ruby", "load", "/usr/local/etc/kamailio/ruby/myscript.rb")
182
+...
183
+request_route {
184
+    ...
185
+    if(!jsdt_run("ksr_sl_reply")) {
186
+        xdbg("SCRIPT: failed to execute ruby function!\n");
187
+    }
188
+    ...
189
+}
190
+...
0 191
new file mode 100644
... ...
@@ -0,0 +1,571 @@
1
+/**
2
+ * Copyright (C) 2018 Daniel-Constantin Mierla (asipto.com)
3
+ *
4
+ * This file is part of Kamailio, a free SIP server.
5
+ *
6
+ * This file is free software; you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation; either version 2 of the License, or
9
+ * (at your option) any later version
10
+ *
11
+ *
12
+ * This file is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ * GNU General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU General Public License
18
+ * along with this program; if not, write to the Free Software
19
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
20
+ *
21
+ */
22
+
23
+#include <stdio.h>
24
+#include <unistd.h>
25
+#include <stdlib.h>
26
+#include <string.h>
27
+#include <ctype.h>
28
+
29
+#include "../../core/dprint.h"
30
+#include "../../core/pvar.h"
31
+#include "../../core/sr_module.h"
32
+#include "../../core/mem/shm.h"
33
+#include "../../core/kemi.h"
34
+#include "../../core/rpc.h"
35
+#include "../../core/rpc_lookup.h"
36
+
37
+#include "app_ruby_api.h"
38
+#include "app_ruby_kemi_export.h"
39
+
40
+/* ruby.h defines xmalloc macro, replacing the shm.xmalloc field name */
41
+#undef xmalloc
42
+
43
+int app_ruby_kemi_export_libs(void);
44
+
45
+typedef struct _sr_ruby_env
46
+{
47
+	ksr_ruby_context_t *R;
48
+	sip_msg_t *msg;
49
+	int rinit;
50
+	unsigned int flags;
51
+	unsigned int nload; /* number of scripts loaded */
52
+} sr_ruby_env_t;
53
+
54
+typedef struct ksr_ruby_data {
55
+	VALUE robj;
56
+	ID metid;
57
+	int nargs;
58
+	VALUE vargs[4];
59
+} ksr_ruby_data_t;
60
+
61
+static sr_ruby_env_t _sr_R_env = {0};
62
+
63
+str _sr_ruby_load_file = STR_NULL;
64
+
65
+static int *_sr_ruby_reload_version = NULL;
66
+static int _sr_ruby_local_version = 0;
67
+
68
+/**
69
+ *
70
+ */
71
+sr_ruby_env_t *app_ruby_sr_env_get(void)
72
+{
73
+	return &_sr_R_env;
74
+}
75
+
76
+/**
77
+ * 
78
+ */
79
+int ruby_sr_init_mod(void)
80
+{
81
+	if(_sr_ruby_load_file.s == NULL || _sr_ruby_load_file.len<=0) {
82
+		LM_ERR("no ruby script file to load was provided\n");
83
+		return -1;
84
+	}
85
+	if(_sr_ruby_reload_version == NULL) {
86
+		_sr_ruby_reload_version = (int*)shm_malloc(sizeof(int));
87
+		if(_sr_ruby_reload_version == NULL) {
88
+			LM_ERR("failed to allocated reload version\n");
89
+			return -1;
90
+		}
91
+		*_sr_ruby_reload_version = 0;
92
+	}
93
+	memset(&_sr_R_env, 0, sizeof(sr_ruby_env_t));
94
+	return 0;
95
+}
96
+
97
+static void app_ruby_print_last_exception()
98
+{
99
+	VALUE rException, rExceptStr;
100
+
101
+	rException = rb_errinfo();         /* get last exception */
102
+	rb_set_errinfo(Qnil);              /* clear last exception */
103
+	rExceptStr = rb_funcall(rException, rb_intern("to_s"), 0, Qnil);
104
+	LM_ERR("exception: %s\n", StringValuePtr(rExceptStr));
105
+	return;
106
+}
107
+
108
+/**
109
+ *
110
+ */
111
+int app_ruby_kemi_load_script(void)
112
+{
113
+	int state = 0;
114
+	VALUE script;
115
+
116
+	script  = rb_str_new_cstr(_sr_ruby_load_file.s);
117
+
118
+	/* handle exceptions like rb_eval_string_protect() */
119
+	rb_load_protect(script, 0, &state);
120
+
121
+	if (state) {
122
+		/* got exception */
123
+		app_ruby_print_last_exception();
124
+		LM_ERR("failed to load rb script file: %.*s (%d)\n",
125
+				_sr_ruby_load_file.len, _sr_ruby_load_file.s, state);
126
+		// return -1;
127
+	}
128
+	LM_DBG("rb script loaded: %s\n", _sr_ruby_load_file.s);
129
+
130
+	return 0;
131
+}
132
+
133
+/**
134
+ *
135
+ */
136
+int app_ruby_kemi_reload_script(void)
137
+{
138
+	int v;
139
+	if(_sr_ruby_load_file.s == NULL && _sr_ruby_load_file.len<=0) {
140
+		LM_WARN("script file path not provided\n");
141
+		return -1;
142
+	}
143
+	if(_sr_ruby_reload_version == NULL) {
144
+		LM_WARN("reload not enabled\n");
145
+		return -1;
146
+	}
147
+	if(_sr_R_env.rinit == 0) {
148
+		LM_ERR("load ruby context not created\n");
149
+		return -1;
150
+	}
151
+
152
+	v = *_sr_ruby_reload_version;
153
+	if(v == _sr_ruby_local_version) {
154
+		/* same version */
155
+		return 0;
156
+	}
157
+	LM_DBG("reloading ruby script file: %.*s (%d => %d)\n",
158
+				_sr_ruby_load_file.len, _sr_ruby_load_file.s,
159
+				_sr_ruby_local_version, v);
160
+	app_ruby_kemi_load_script();
161
+	_sr_ruby_local_version = v;
162
+	return 0;
163
+}
164
+
165
+/**
166
+ * 
167
+ */
168
+int ruby_sr_init_child(void)
169
+{
170
+	int state = 0;
171
+	VALUE result;
172
+
173
+	/* construct the VM */
174
+	ruby_init();
175
+	ruby_init_loadpath();
176
+	ruby_script(_sr_ruby_load_file.s);
177
+
178
+	/* Ruby goes here */
179
+	result = rb_eval_string_protect("puts 'Hello " NAME "!'", &state);
180
+
181
+	if (state) {
182
+		/* handle exception */
183
+		app_ruby_print_last_exception();
184
+		LM_ERR("test execution with error\n");
185
+		return -1;
186
+	} else {
187
+		LM_DBG("test execution without error\n");
188
+	}
189
+
190
+	if(app_ruby_kemi_export_libs()<0) {
191
+		return -1;
192
+	}
193
+
194
+	if(app_ruby_kemi_load_script()<0) {
195
+		return -1;
196
+	}
197
+
198
+	_sr_R_env.rinit = 1;
199
+
200
+	return 0;
201
+}
202
+
203
+/**
204
+ * 
205
+ */
206
+void ruby_sr_destroy(void)
207
+{
208
+	if(_sr_R_env.rinit == 1) {
209
+		return;
210
+	}
211
+	memset(&_sr_R_env, 0, sizeof(sr_ruby_env_t));
212
+	/* destruct the VM */
213
+	ruby_cleanup(0);
214
+	return;
215
+}
216
+
217
+/**
218
+ * 
219
+ */
220
+int ruby_sr_initialized(void)
221
+{
222
+	if(_sr_R_env.rinit==1) {
223
+		return 1;
224
+	}
225
+	return 0;
226
+}
227
+
228
+/**
229
+ *
230
+ */
231
+int sr_kemi_ruby_return_int(sr_kemi_t *ket, int rc)
232
+{
233
+	if(ket->rtype==SR_KEMIP_INT) {
234
+		return INT2NUM(rc);
235
+	}
236
+	if(ket->rtype==SR_KEMIP_BOOL && rc!=SR_KEMI_FALSE) {
237
+		return Qtrue;
238
+	}
239
+	return Qfalse;
240
+}
241
+
242
+/**
243
+ *
244
+ */
245
+static VALUE ksr_ruby_exec_callback(VALUE ptr)
246
+{
247
+	ksr_ruby_data_t *data = (ksr_ruby_data_t *)ptr;
248
+	return rb_funcall2(data->robj, data->metid, data->nargs, data->vargs);
249
+}
250
+
251
+/**
252
+ * 
253
+ */
254
+VALUE sr_kemi_ruby_exec_func(ksr_ruby_context_t *R, int eidx, int argc,
255
+		VALUE* argv, VALUE self)
256
+{
257
+	sr_kemi_val_t vps[SR_KEMI_PARAMS_MAX];
258
+	sr_ruby_env_t *env_R;
259
+	sr_kemi_t *ket;
260
+	str *fname;
261
+	str *mname;
262
+	int i;
263
+	int ret = -1;
264
+
265
+	env_R = app_ruby_sr_env_get();
266
+	ket = sr_kemi_ruby_export_get(eidx);
267
+
268
+	LM_DBG("executing %p eidx %d\n", ket, eidx);
269
+	if(env_R==NULL || env_R->msg==NULL || ket==NULL) {
270
+		LM_ERR("invalid ruby environment attributes or parameters\n");
271
+		return Qfalse;
272
+	}
273
+
274
+	if(argc==0 && ket->ptypes[0]==SR_KEMIP_NONE) {
275
+		ret = ((sr_kemi_fm_f)(ket->func))(env_R->msg);
276
+		return sr_kemi_ruby_return_int(ket, ret);
277
+	}
278
+	fname = &ket->fname;
279
+	mname = &ket->mname;
280
+	if(argc==0 && ket->ptypes[0]!=SR_KEMIP_NONE) {
281
+		LM_ERR("invalid number of parameters for: %.*s.%.*s\n",
282
+				mname->len, mname->s, fname->len, fname->s);
283
+		return Qfalse;
284
+	}
285
+
286
+	if(argc>SR_KEMI_PARAMS_MAX) {
287
+		LM_ERR("too many parameters for: %.*s.%.*s\n",
288
+				mname->len, mname->s, fname->len, fname->s);
289
+		return Qfalse;
290
+	}
291
+
292
+	memset(vps, 0, SR_KEMI_PARAMS_MAX*sizeof(sr_kemi_val_t));
293
+	for(i=0; i<SR_KEMI_PARAMS_MAX; i++) {
294
+		if(ket->ptypes[i]==SR_KEMIP_NONE) {
295
+			break;
296
+		} else if(ket->ptypes[i]==SR_KEMIP_STR) {
297
+			if(!RB_TYPE_P(argv[i], T_STRING)) {
298
+				LM_ERR("invalid str parameter type %d (%d)\n", ket->ptypes[i], i);
299
+				return Qfalse;
300
+			}
301
+			vps[i].s.s = StringValuePtr(argv[i]);
302
+			vps[i].s.len = strlen(vps[i].s.s);
303
+			LM_DBG("param[%d] for: %.*s.%.*s is str: %.*s\n", i,
304
+				mname->len, mname->s, fname->len, fname->s, vps[i].s.len, vps[i].s.s);
305
+		} else if(ket->ptypes[i]==SR_KEMIP_INT) {
306
+			if(!RB_INTEGER_TYPE_P(argv[i])) {
307
+				LM_ERR("invalid int parameter type %d (%d)\n", ket->ptypes[i], i);
308
+				return Qfalse;
309
+			}
310
+			vps[i].n = NUM2INT(argv[i]);
311
+			LM_DBG("param[%d] for: %.*s.%.*s is int: %d\n", i,
312
+				mname->len, mname->s, fname->len, fname->s, vps[i].n);
313
+		} else {
314
+			LM_ERR("unknown parameter type %d (%d)\n", ket->ptypes[i], i);
315
+			return Qfalse;
316
+		}
317
+	}
318
+
319
+	switch(i) {
320
+		case 1:
321
+			if(ket->ptypes[0]==SR_KEMIP_INT) {
322
+				ret = ((sr_kemi_fmn_f)(ket->func))(env_R->msg, vps[0].n);
323
+				return sr_kemi_ruby_return_int(ket, ret);
324
+			} else if(ket->ptypes[0]==SR_KEMIP_STR) {
325
+				ret = ((sr_kemi_fms_f)(ket->func))(env_R->msg, &vps[0].s);
326
+				return sr_kemi_ruby_return_int(ket, ret);
327
+			} else {
328
+				LM_ERR("invalid parameters for: %.*s\n",
329
+						fname->len, fname->s);
330
+				return Qfalse;
331
+			}
332
+		break;
333
+		case 2:
334
+			if(ket->ptypes[0]==SR_KEMIP_INT) {
335
+				if(ket->ptypes[1]==SR_KEMIP_INT) {
336
+					ret = ((sr_kemi_fmnn_f)(ket->func))(env_R->msg, vps[0].n, vps[1].n);
337
+					return sr_kemi_ruby_return_int(ket, ret);
338
+				} else if(ket->ptypes[1]==SR_KEMIP_STR) {
339
+					ret = ((sr_kemi_fmns_f)(ket->func))(env_R->msg, vps[0].n, &vps[1].s);
340
+					return sr_kemi_ruby_return_int(ket, ret);
341
+				} else {
342
+					LM_ERR("invalid parameters for: %.*s\n",
343
+							fname->len, fname->s);
344
+					return Qfalse;
345
+				}
346
+			} else if(ket->ptypes[0]==SR_KEMIP_STR) {
347
+				if(ket->ptypes[1]==SR_KEMIP_INT) {
348
+					ret = ((sr_kemi_fmsn_f)(ket->func))(env_R->msg, &vps[0].s, vps[1].n);
349
+					return sr_kemi_ruby_return_int(ket, ret);
350
+				} else if(ket->ptypes[1]==SR_KEMIP_STR) {
351
+					ret = ((sr_kemi_fmss_f)(ket->func))(env_R->msg, &vps[0].s, &vps[1].s);
352
+					return sr_kemi_ruby_return_int(ket, ret);
353
+				} else {
354
+					LM_ERR("invalid parameters for: %.*s\n",
355
+							fname->len, fname->s);
356
+					return Qfalse;
357
+				}
358
+			} else {
359
+				LM_ERR("invalid parameters for: %.*s\n",
360
+						fname->len, fname->s);
361
+				return Qfalse;
362
+			}
363
+		break;
364
+		default:
365
+			LM_ERR("invalid parameters for: %.*s\n",
366
+					fname->len, fname->s);
367
+			return Qfalse;
368
+	}
369
+}
370
+
371
+/**
372
+ * 
373
+ */
374
+int app_ruby_run_ex(sip_msg_t *msg, char *func, char *p1, char *p2,
375
+		char *p3, int emode)
376
+{
377
+	sip_msg_t *bmsg;
378
+	ksr_ruby_data_t rbdata;
379
+    int rberr = 0;
380
+    VALUE rbres;
381
+
382
+	if(_sr_R_env.rinit==0) {
383
+		LM_ERR("js loading state not initialized (call: %s)\n", func);
384
+		return -1;
385
+	}
386
+	/* check the script version loaded */
387
+	app_ruby_kemi_reload_script();
388
+
389
+	rbdata.robj = rb_mKernel;
390
+	rbdata.nargs = 0;
391
+	rbdata.metid = rb_intern(func);
392
+
393
+	LM_DBG("executing ruby function: [[%s]]\n", func);
394
+	bmsg = _sr_R_env.msg;
395
+	_sr_R_env.msg = msg;
396
+	if(p1!=NULL) {
397
+		rbdata.vargs[rbdata.nargs] = rb_str_new_cstr(p1);
398
+		rbdata.nargs++;
399
+		if(p2!=NULL) {
400
+			rbdata.vargs[rbdata.nargs] = rb_str_new_cstr(p2);
401
+			rbdata.nargs++;
402
+			if(p3!=NULL) {
403
+				rbdata.vargs[rbdata.nargs] = rb_str_new_cstr(p3);
404
+				rbdata.nargs++;
405
+			}
406
+		}
407
+	}
408
+
409
+	rbres = rb_protect(ksr_ruby_exec_callback, (VALUE)&rbdata, &rberr);
410
+
411
+	_sr_R_env.msg = bmsg;
412
+
413
+	if (rberr) {
414
+		app_ruby_print_last_exception();
415
+		LM_ERR("ruby exception (%d) on callback for: %s\n", rberr, func);
416
+		return -1;
417
+	}
418
+
419
+	return 1;
420
+}
421
+
422
+/**
423
+ * 
424
+ */
425
+int app_ruby_run(sip_msg_t *msg, char *func, char *p1, char *p2,
426
+		char *p3)
427
+{
428
+	return app_ruby_run_ex(msg, func, p1, p2, p3, 0);
429
+}
430
+
431
+/**
432
+ * 
433
+ */
434
+int app_ruby_runstring(sip_msg_t *msg, char *script)
435
+{
436
+	LM_ERR("not implemented\n");
437
+	return -1;
438
+}
439
+
440
+/**
441
+ * 
442
+ */
443
+int app_ruby_dostring(sip_msg_t *msg, char *script)
444
+{
445
+	LM_ERR("not implemented\n");
446
+	return -1;
447
+}
448
+
449
+/**
450
+ * 
451
+ */
452
+int app_ruby_dofile(sip_msg_t *msg, char *script)
453
+{
454
+	LM_ERR("not implemented\n");
455
+	return -1;
456
+}
457
+
458
+ksr_ruby_export_t *_sr_R_KSRMethods = NULL;
459
+#define SR_RUBY_KSR_MODULES_SIZE	256
460
+#define SR_RUBY_KSR_METHODS_SIZE	(SR_KEMI_RUBY_EXPORT_SIZE + SR_RUBY_KSR_MODULES_SIZE)
461
+
462
+static VALUE _ksr_mKSR;
463
+static VALUE _ksr_mSMD[SR_RUBY_KSR_MODULES_SIZE];
464
+
465
+/**
466
+ * 
467
+ */
468
+void ksr_app_ruby_toupper(char *bin, char *bout)
469
+{
470
+	int i;
471
+	for(i=0; bin[i]!='\0'; i++) {
472
+		bout[i] = (char)toupper(bin[i]);
473
+	}
474
+	bout[i] = '\0';
475
+}
476
+/**
477
+ * 
478
+ */
479
+int app_ruby_kemi_export_libs(void)
480
+{
481
+	ksr_ruby_export_t *_sr_crt_R_KSRMethods = NULL;
482
+	sr_kemi_module_t *emods = NULL;
483
+	int emods_size = 0;
484
+	int i;
485
+	int k;
486
+	int n;
487
+	int m;
488
+	char rmname[128];
489
+
490
+	_sr_R_KSRMethods = malloc(SR_RUBY_KSR_METHODS_SIZE * sizeof(ksr_ruby_export_t));
491
+	if(_sr_R_KSRMethods==NULL) {
492
+		LM_ERR("no more pkg memory\n");
493
+		return 0;
494
+	}
495
+	memset(_sr_R_KSRMethods, 0, SR_RUBY_KSR_METHODS_SIZE * sizeof(ksr_ruby_export_t));
496
+
497
+	emods_size = sr_kemi_modules_size_get();
498
+	emods = sr_kemi_modules_get();
499
+
500
+	n = 0;
501
+	_sr_crt_R_KSRMethods = _sr_R_KSRMethods;
502
+	if(emods_size==0 || emods[0].kexp==NULL) {
503
+		LM_ERR("no kemi exports registered\n");
504
+		return 0;
505
+	}
506
+
507
+	/* toplevel module KSR */
508
+	_ksr_mKSR = rb_define_module("KSR");
509
+
510
+	for(i=0; emods[0].kexp[i].func!=NULL; i++) {
511
+		LM_DBG("exporting KSR.%s(...)\n", emods[0].kexp[i].fname.s);
512
+		_sr_crt_R_KSRMethods[i].mname = "";
513
+		_sr_crt_R_KSRMethods[i].fname = emods[0].kexp[i].fname.s;
514
+		_sr_crt_R_KSRMethods[i].func =
515
+			sr_kemi_ruby_export_associate(&emods[0].kexp[i]);
516
+		if(_sr_crt_R_KSRMethods[i].func == NULL) {
517
+			LM_ERR("failed to associate kemi function with ruby export\n");
518
+			free(_sr_R_KSRMethods);
519
+			_sr_R_KSRMethods = NULL;
520
+			return 0;
521
+		}
522
+
523
+		rb_define_singleton_method(_ksr_mKSR, _sr_crt_R_KSRMethods[i].fname,
524
+						_sr_crt_R_KSRMethods[i].func, -1);
525
+
526
+		n++;
527
+	}
528
+
529
+	/* registered kemi modules */
530
+	m = 0;
531
+	if(emods_size>1) {
532
+		for(k=1; k<emods_size; k++) {
533
+			n++;
534
+			_sr_crt_R_KSRMethods = _sr_R_KSRMethods + n;
535
+			ksr_app_ruby_toupper(emods[k].kexp[0].mname.s, rmname);
536
+			_ksr_mSMD[m] = rb_define_module_under(_ksr_mKSR, rmname);
537
+			for(i=0; emods[k].kexp[i].func!=NULL; i++) {
538
+				_sr_crt_R_KSRMethods[i].mname = emods[k].kexp[0].mname.s;
539
+				_sr_crt_R_KSRMethods[i].fname = emods[k].kexp[i].fname.s;
540
+				_sr_crt_R_KSRMethods[i].func =
541
+					sr_kemi_ruby_export_associate(&emods[k].kexp[i]);
542
+				LM_DBG("exporting KSR.%s.%s(...)\n", rmname,
543
+						emods[k].kexp[i].fname.s);
544
+				if(_sr_crt_R_KSRMethods[i].func == NULL) {
545
+					LM_ERR("failed to associate kemi function with func export\n");
546
+					free(_sr_R_KSRMethods);
547
+					_sr_R_KSRMethods = NULL;
548
+					return 0;
549
+				}
550
+
551
+				rb_define_singleton_method(_ksr_mSMD[m], _sr_crt_R_KSRMethods[i].fname,
552
+						_sr_crt_R_KSRMethods[i].func, -1);
553
+
554
+				n++;
555
+			}
556
+			m++;
557
+			LM_DBG("initializing kemi sub-module: KSR.%s\n", rmname);
558
+		}
559
+	}
560
+	LM_DBG("module 'KSR' has been initialized\n");
561
+
562
+	return 1;
563
+}
564
+
565
+/**
566
+ * 
567
+ */
568
+int app_ruby_init_rpc(void)
569
+{
570
+	return 0;
571
+}
0 572
\ No newline at end of file
1 573
new file mode 100644
... ...
@@ -0,0 +1,60 @@
1
+/**
2
+ * Copyright (C) 2018 Daniel-Constantin Mierla (asipto.com)
3
+ *
4
+ * This file is part of Kamailio, a free SIP server.
5
+ *
6
+ * This file is free software; you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation; either version 2 of the License, or
9
+ * (at your option) any later version
10
+ *
11
+ *
12
+ * This file is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ * GNU General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU General Public License
18
+ * along with this program; if not, write to the Free Software
19
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
20
+ *
21
+ */
22
+
23
+#ifndef _APP_RUBY_API_H_
24
+#define _APP_RUBY_API_H_
25
+
26
+#include <ruby.h>
27
+
28
+#include "../../core/parser/msg_parser.h"
29
+
30
+typedef VALUE (*app_ruby_function)(int argc, VALUE* argv, VALUE self);
31
+
32
+typedef struct _ksr_ruby_context {
33
+	int ctxid;
34
+} ksr_ruby_context_t;
35
+
36
+typedef struct _ksr_ruby_export {
37
+	char *mname;
38
+	char *fname;
39
+	app_ruby_function func;
40
+} ksr_ruby_export_t;
41
+
42
+int ruby_sr_init_mod(void);
43
+int ruby_sr_init_child(void);
44
+void ruby_sr_destroy(void);
45
+
46
+int ruby_sr_initialized(void);
47
+
48
+VALUE sr_kemi_ruby_exec_func(ksr_ruby_context_t *R, int eidx, int argc,
49
+		VALUE* argv, VALUE self);
50
+
51
+int app_ruby_run_ex(sip_msg_t *msg, char *func, char *p1, char *p2,
52
+		char *p3, int emode);
53
+int app_ruby_run(sip_msg_t *msg, char *func, char *p1, char *p2,
54
+		char *p3);
55
+int app_ruby_runstring(sip_msg_t *msg, char *script);
56
+int app_ruby_dostring(sip_msg_t *msg, char *script);
57
+int app_ruby_dofile(sip_msg_t *msg, char *script);
58
+
59
+int app_ruby_init_rpc(void);
60
+#endif
0 61
new file mode 100644
... ...
@@ -0,0 +1,9286 @@
1
+/**
2
+ * Copyright (C) 2018 Daniel-Constantin Mierla (asipto.com)
3
+ *
4
+ * This file is part of Kamailio, a free SIP server.
5
+ *
6
+ * Kamailio is free software; you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation; either version 2 of the License, or
9
+ * (at your option) any later version
10
+ *
11
+ * Kamailio is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ * GNU General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU General Public License
17
+ * along with this program; if not, write to the Free Software
18
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
19
+ *
20
+ */
21
+
22
+/**
23
+ * this file is generated - do not edit
24
+ */
25
+
26
+#include <stdio.h>
27
+#include <unistd.h>
28
+#include <stdlib.h>
29
+
30
+#include "../../core/dprint.h"
31
+
32
+#include "app_ruby_api.h"
33
+#include "app_ruby_kemi_export.h"
34
+
35
+
36
+/**
37
+ *
38
+ */
39
+static VALUE sr_kemi_ruby_exec_func_0(int argc, VALUE* argv, VALUE self)
40
+{
41
+	return sr_kemi_ruby_exec_func(NULL, 0, argc, argv, self);
42
+}
43
+
44
+/**
45
+ *
46
+ */
47
+static VALUE sr_kemi_ruby_exec_func_1(int argc, VALUE* argv, VALUE self)
48
+{
49
+	return sr_kemi_ruby_exec_func(NULL, 1, argc, argv, self);
50
+}
51
+
52
+/**
53
+ *
54
+ */
55
+static VALUE sr_kemi_ruby_exec_func_2(int argc, VALUE* argv, VALUE self)
56
+{
57
+	return sr_kemi_ruby_exec_func(NULL, 2, argc, argv, self);
58
+}
59
+
60
+/**
61
+ *
62
+ */
63
+static VALUE sr_kemi_ruby_exec_func_3(int argc, VALUE* argv, VALUE self)
64
+{
65
+	return sr_kemi_ruby_exec_func(NULL, 3, argc, argv, self);
66
+}
67
+
68
+/**
69
+ *
70
+ */
71
+static VALUE sr_kemi_ruby_exec_func_4(int argc, VALUE* argv, VALUE self)
72
+{
73
+	return sr_kemi_ruby_exec_func(NULL, 4, argc, argv, self);
74
+}
75
+
76
+/**
77
+ *
78
+ */
79
+static VALUE sr_kemi_ruby_exec_func_5(int argc, VALUE* argv, VALUE self)
80
+{
81
+	return sr_kemi_ruby_exec_func(NULL, 5, argc, argv, self);
82
+}
83
+
84
+/**
85
+ *
86
+ */
87
+static VALUE sr_kemi_ruby_exec_func_6(int argc, VALUE* argv, VALUE self)
88
+{
89
+	return sr_kemi_ruby_exec_func(NULL, 6, argc, argv, self);
90
+}
91
+
92
+/**
93
+ *
94
+ */
95
+static VALUE sr_kemi_ruby_exec_func_7(int argc, VALUE* argv, VALUE self)
96
+{
97
+	return sr_kemi_ruby_exec_func(NULL, 7, argc, argv, self);
98
+}
99
+
100
+/**
101
+ *
102
+ */
103
+static VALUE sr_kemi_ruby_exec_func_8(int argc, VALUE* argv, VALUE self)
104
+{
105
+	return sr_kemi_ruby_exec_func(NULL, 8, argc, argv, self);
106
+}
107
+
108
+/**
109
+ *
110
+ */
111
+static VALUE sr_kemi_ruby_exec_func_9(int argc, VALUE* argv, VALUE self)
112
+{
113
+	return sr_kemi_ruby_exec_func(NULL, 9, argc, argv, self);
114
+}
115
+
116
+/**
117
+ *
118
+ */
119
+static VALUE sr_kemi_ruby_exec_func_10(int argc, VALUE* argv, VALUE self)
120
+{
121
+	return sr_kemi_ruby_exec_func(NULL, 10, argc, argv, self);
122
+}
123
+
124
+/**
125
+ *
126
+ */
127
+static VALUE sr_kemi_ruby_exec_func_11(int argc, VALUE* argv, VALUE self)
128
+{
129
+	return sr_kemi_ruby_exec_func(NULL, 11, argc, argv, self);
130
+}
131
+
132
+/**
133
+ *
134
+ */
135
+static VALUE sr_kemi_ruby_exec_func_12(int argc, VALUE* argv, VALUE self)
136
+{
137
+	return sr_kemi_ruby_exec_func(NULL, 12, argc, argv, self);
138
+}
139
+
140
+/**
141
+ *
142
+ */
143
+static VALUE sr_kemi_ruby_exec_func_13(int argc, VALUE* argv, VALUE self)
144
+{
145
+	return sr_kemi_ruby_exec_func(NULL, 13, argc, argv, self);
146
+}
147
+
148
+/**
149
+ *
150
+ */
151
+static VALUE sr_kemi_ruby_exec_func_14(int argc, VALUE* argv, VALUE self)
152
+{
153
+	return sr_kemi_ruby_exec_func(NULL, 14, argc, argv, self);
154
+}
155
+
156
+/**
157
+ *
158
+ */
159
+static VALUE sr_kemi_ruby_exec_func_15(int argc, VALUE* argv, VALUE self)
160
+{
161
+	return sr_kemi_ruby_exec_func(NULL, 15, argc, argv, self);
162
+}
163
+
164
+/**
165
+ *
166
+ */
167
+static VALUE sr_kemi_ruby_exec_func_16(int argc, VALUE* argv, VALUE self)
168
+{
169
+	return sr_kemi_ruby_exec_func(NULL, 16, argc, argv, self);
170
+}
171
+
172
+/**
173
+ *
174
+ */
175
+static VALUE sr_kemi_ruby_exec_func_17(int argc, VALUE* argv, VALUE self)
176
+{
177
+	return sr_kemi_ruby_exec_func(NULL, 17, argc, argv, self);
178
+}
179
+
180
+/**
181
+ *
182
+ */
183
+static VALUE sr_kemi_ruby_exec_func_18(int argc, VALUE* argv, VALUE self)
184
+{
185
+	return sr_kemi_ruby_exec_func(NULL, 18, argc, argv, self);
186
+}
187
+
188
+/**
189
+ *
190
+ */
191
+static VALUE sr_kemi_ruby_exec_func_19(int argc, VALUE* argv, VALUE self)
192
+{
193
+	return sr_kemi_ruby_exec_func(NULL, 19, argc, argv, self);
194
+}
195
+
196
+/**
197
+ *
198
+ */
199
+static VALUE sr_kemi_ruby_exec_func_20(int argc, VALUE* argv, VALUE self)
200
+{
201
+	return sr_kemi_ruby_exec_func(NULL, 20, argc, argv, self);
202
+}
203
+
204
+/**
205
+ *
206
+ */
207
+static VALUE sr_kemi_ruby_exec_func_21(int argc, VALUE* argv, VALUE self)
208
+{
209
+	return sr_kemi_ruby_exec_func(NULL, 21, argc, argv, self);
210
+}
211
+
212
+/**
213
+ *
214
+ */
215
+static VALUE sr_kemi_ruby_exec_func_22(int argc, VALUE* argv, VALUE self)
216
+{
217
+	return sr_kemi_ruby_exec_func(NULL, 22, argc, argv, self);
218
+}
219
+
220
+/**
221
+ *
222
+ */
223
+static VALUE sr_kemi_ruby_exec_func_23(int argc, VALUE* argv, VALUE self)
224
+{
225
+	return sr_kemi_ruby_exec_func(NULL, 23, argc, argv, self);
226
+}
227
+
228
+/**
229
+ *
230
+ */
231
+static VALUE sr_kemi_ruby_exec_func_24(int argc, VALUE* argv, VALUE self)
232
+{
233
+	return sr_kemi_ruby_exec_func(NULL, 24, argc, argv, self);
234
+}
235
+
236
+/**
237
+ *
238
+ */
239
+static VALUE sr_kemi_ruby_exec_func_25(int argc, VALUE* argv, VALUE self)
240
+{
241
+	return sr_kemi_ruby_exec_func(NULL, 25, argc, argv, self);
242
+}
243
+
244
+/**
245
+ *
246
+ */
247
+static VALUE sr_kemi_ruby_exec_func_26(int argc, VALUE* argv, VALUE self)
248
+{
249
+	return sr_kemi_ruby_exec_func(NULL, 26, argc, argv, self);
250
+}
251
+
252
+/**
253
+ *
254
+ */
255
+static VALUE sr_kemi_ruby_exec_func_27(int argc, VALUE* argv, VALUE self)
256
+{
257
+	return sr_kemi_ruby_exec_func(NULL, 27, argc, argv, self);
258
+}
259
+
260
+/**
261
+ *
262
+ */
263
+static VALUE sr_kemi_ruby_exec_func_28(int argc, VALUE* argv, VALUE self)
264
+{
265
+	return sr_kemi_ruby_exec_func(NULL, 28, argc, argv, self);
266
+}
267
+
268
+/**
269
+ *
270
+ */
271
+static VALUE sr_kemi_ruby_exec_func_29(int argc, VALUE* argv, VALUE self)
272
+{
273
+	return sr_kemi_ruby_exec_func(NULL, 29, argc, argv, self);
274
+}
275
+
276
+/**
277
+ *
278
+ */
279
+static VALUE sr_kemi_ruby_exec_func_30(int argc, VALUE* argv, VALUE self)
280
+{
281
+	return sr_kemi_ruby_exec_func(NULL, 30, argc, argv, self);
282
+}
283
+
284
+/**
285
+ *
286
+ */
287
+static VALUE sr_kemi_ruby_exec_func_31(int argc, VALUE* argv, VALUE self)
288
+{
289
+	return sr_kemi_ruby_exec_func(NULL, 31, argc, argv, self);
290
+}
291
+
292
+/**
293
+ *
294
+ */
295
+static VALUE sr_kemi_ruby_exec_func_32(int argc, VALUE* argv, VALUE self)
296
+{
297
+	return sr_kemi_ruby_exec_func(NULL, 32, argc, argv, self);
298
+}
299
+
300
+/**
301
+ *
302
+ */
303
+static VALUE sr_kemi_ruby_exec_func_33(int argc, VALUE* argv, VALUE self)
304
+{
305
+	return sr_kemi_ruby_exec_func(NULL, 33, argc, argv, self);
306
+}
307
+
308
+/**
309
+ *
310
+ */
311
+static VALUE sr_kemi_ruby_exec_func_34(int argc, VALUE* argv, VALUE self)
312
+{
313
+	return sr_kemi_ruby_exec_func(NULL, 34, argc, argv, self);
314
+}
315
+
316
+/**
317
+ *
318
+ */
319
+static VALUE sr_kemi_ruby_exec_func_35(int argc, VALUE* argv, VALUE self)
320
+{
321
+	return sr_kemi_ruby_exec_func(NULL, 35, argc, argv, self);
322
+}
323
+
324
+/**
325
+ *
326
+ */
327
+static VALUE sr_kemi_ruby_exec_func_36(int argc, VALUE* argv, VALUE self)
328
+{
329
+	return sr_kemi_ruby_exec_func(NULL, 36, argc, argv, self);
330
+}
331
+
332
+/**
333
+ *
334
+ */
335
+static VALUE sr_kemi_ruby_exec_func_37(int argc, VALUE* argv, VALUE self)
336
+{
337
+	return sr_kemi_ruby_exec_func(NULL, 37, argc, argv, self);
338
+}
339
+
340
+/**
341
+ *
342
+ */
343
+static VALUE sr_kemi_ruby_exec_func_38(int argc, VALUE* argv, VALUE self)
344
+{
345
+	return sr_kemi_ruby_exec_func(NULL, 38, argc, argv, self);
346
+}
347
+
348
+/**
349
+ *
350
+ */
351
+static VALUE sr_kemi_ruby_exec_func_39(int argc, VALUE* argv, VALUE self)
352
+{
353
+	return sr_kemi_ruby_exec_func(NULL, 39, argc, argv, self);
354
+}
355
+
356
+/**
357
+ *
358
+ */
359
+static VALUE sr_kemi_ruby_exec_func_40(int argc, VALUE* argv, VALUE self)
360
+{
361
+	return sr_kemi_ruby_exec_func(NULL, 40, argc, argv, self);
362
+}
363
+
364
+/**
365
+ *
366
+ */
367
+static VALUE sr_kemi_ruby_exec_func_41(int argc, VALUE* argv, VALUE self)
368
+{
369
+	return sr_kemi_ruby_exec_func(NULL, 41, argc, argv, self);
370
+}
371
+
372
+/**
373
+ *
374
+ */
375
+static VALUE sr_kemi_ruby_exec_func_42(int argc, VALUE* argv, VALUE self)
376
+{
377
+	return sr_kemi_ruby_exec_func(NULL, 42, argc, argv, self);
378
+}
379
+
380
+/**
381
+ *
382
+ */
383
+static VALUE sr_kemi_ruby_exec_func_43(int argc, VALUE* argv, VALUE self)
384
+{
385
+	return sr_kemi_ruby_exec_func(NULL, 43, argc, argv, self);
386
+}
387
+
388
+/**
389
+ *
390
+ */
391
+static VALUE sr_kemi_ruby_exec_func_44(int argc, VALUE* argv, VALUE self)
392
+{
393
+	return sr_kemi_ruby_exec_func(NULL, 44, argc, argv, self);
394
+}
395
+
396
+/**
397
+ *
398
+ */
399
+static VALUE sr_kemi_ruby_exec_func_45(int argc, VALUE* argv, VALUE self)
400
+{
401
+	return sr_kemi_ruby_exec_func(NULL, 45, argc, argv, self);
402
+}
403
+
404
+/**
405
+ *
406
+ */
407
+static VALUE sr_kemi_ruby_exec_func_46(int argc, VALUE* argv, VALUE self)
408
+{
409
+	return sr_kemi_ruby_exec_func(NULL, 46, argc, argv, self);
410
+}
411
+
412
+/**
413
+ *
414
+ */
415
+static VALUE sr_kemi_ruby_exec_func_47(int argc, VALUE* argv, VALUE self)
416
+{
417
+	return sr_kemi_ruby_exec_func(NULL, 47, argc, argv, self);
418
+}
419
+
420
+/**
421
+ *
422
+ */
423
+static VALUE sr_kemi_ruby_exec_func_48(int argc, VALUE* argv, VALUE self)
424
+{
425
+	return sr_kemi_ruby_exec_func(NULL, 48, argc, argv, self);
426
+}
427
+
428
+/**
429
+ *
430
+ */
431
+static VALUE sr_kemi_ruby_exec_func_49(int argc, VALUE* argv, VALUE self)
432
+{
433
+	return sr_kemi_ruby_exec_func(NULL, 49, argc, argv, self);
434
+}
435
+
436
+/**
437
+ *
438
+ */
439
+static VALUE sr_kemi_ruby_exec_func_50(int argc, VALUE* argv, VALUE self)
440
+{
441
+	return sr_kemi_ruby_exec_func(NULL, 50, argc, argv, self);
442
+}
443
+
444
+/**
445
+ *
446
+ */
447
+static VALUE sr_kemi_ruby_exec_func_51(int argc, VALUE* argv, VALUE self)
448
+{
449
+	return sr_kemi_ruby_exec_func(NULL, 51, argc, argv, self);
450
+}
451
+
452
+/**
453
+ *
454
+ */
455
+static VALUE sr_kemi_ruby_exec_func_52(int argc, VALUE* argv, VALUE self)
456
+{
457
+	return sr_kemi_ruby_exec_func(NULL, 52, argc, argv, self);
458
+}
459
+
460
+/**
461
+ *
462
+ */
463
+static VALUE sr_kemi_ruby_exec_func_53(int argc, VALUE* argv, VALUE self)
464
+{
465
+	return sr_kemi_ruby_exec_func(NULL, 53, argc, argv, self);
466
+}
467
+
468
+/**
469
+ *
470
+ */
471
+static VALUE sr_kemi_ruby_exec_func_54(int argc, VALUE* argv, VALUE self)
472
+{
473
+	return sr_kemi_ruby_exec_func(NULL, 54, argc, argv, self);
474
+}
475
+
476
+/**
477
+ *
478
+ */
479
+static VALUE sr_kemi_ruby_exec_func_55(int argc, VALUE* argv, VALUE self)
480
+{
481
+	return sr_kemi_ruby_exec_func(NULL, 55, argc, argv, self);
482
+}
483
+
484
+/**
485
+ *
486
+ */
487
+static VALUE sr_kemi_ruby_exec_func_56(int argc, VALUE* argv, VALUE self)
488
+{
489
+	return sr_kemi_ruby_exec_func(NULL, 56, argc, argv, self);
490
+}
491
+
492
+/**
493
+ *
494
+ */
495
+static VALUE sr_kemi_ruby_exec_func_57(int argc, VALUE* argv, VALUE self)
496
+{
497
+	return sr_kemi_ruby_exec_func(NULL, 57, argc, argv, self);
498
+}
499
+
500
+/**
501
+ *
502
+ */
503
+static VALUE sr_kemi_ruby_exec_func_58(int argc, VALUE* argv, VALUE self)
504
+{
505
+	return sr_kemi_ruby_exec_func(NULL, 58, argc, argv, self);
506
+}
507
+
508
+/**
509
+ *
510
+ */
511
+static VALUE sr_kemi_ruby_exec_func_59(int argc, VALUE* argv, VALUE self)
512
+{
513
+	return sr_kemi_ruby_exec_func(NULL, 59, argc, argv, self);
514
+}
515
+
516
+/**
517
+ *
518
+ */
519
+static VALUE sr_kemi_ruby_exec_func_60(int argc, VALUE* argv, VALUE self)
520
+{
521
+	return sr_kemi_ruby_exec_func(NULL, 60, argc, argv, self);
522
+}
523
+
524
+/**
525
+ *
526
+ */
527
+static VALUE sr_kemi_ruby_exec_func_61(int argc, VALUE* argv, VALUE self)
528
+{
529
+	return sr_kemi_ruby_exec_func(NULL, 61, argc, argv, self);
530
+}
531
+
532
+/**
533
+ *
534
+ */
535
+static VALUE sr_kemi_ruby_exec_func_62(int argc, VALUE* argv, VALUE self)
536
+{
537
+	return sr_kemi_ruby_exec_func(NULL, 62, argc, argv, self);
538
+}
539
+
540
+/**
541
+ *
542
+ */
543
+static VALUE sr_kemi_ruby_exec_func_63(int argc, VALUE* argv, VALUE self)
544
+{
545
+	return sr_kemi_ruby_exec_func(NULL, 63, argc, argv, self);
546
+}
547
+
548
+/**
549
+ *
550
+ */
551
+static VALUE sr_kemi_ruby_exec_func_64(int argc, VALUE* argv, VALUE self)
552
+{
553
+	return sr_kemi_ruby_exec_func(NULL, 64, argc, argv, self);
554
+}
555
+
556
+/**
557
+ *
558
+ */