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
61