mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-11-14 13:28:31 +00:00
Merge branch 'master' into smgmaster
Conflicts: build/modules.conf.in libs/esl/fs_cli.c
This commit is contained in:
commit
ff3648ef21
406 files changed
+25830
-41048
No files matched your search
+4
-4
@@ -3,11 +3,11 @@ INCS=-I$(PWD)/src/include
|
||||
LIBEDIT_DIR=../../libs/libedit
|
||||
DEBUG=-g -ggdb
|
||||
BASE_FLAGS=$(INCS) -DHAVE_EDITLINE $(DEBUG) -I$(LIBEDIT_DIR)/src/ -fPIC
|
||||
PICKY=-O2 -ffast-math -Wall -Werror -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes
|
||||
PICKY=-O2
|
||||
CFLAGS=$(BASE_FLAGS) $(PICKY)
|
||||
CXXFLAGS=$(BASE_FLAGS) -Wall -Werror -Wno-unused-variable
|
||||
CXXFLAGS=$(BASE_FLAGS)
|
||||
MYLIB=libesl.a
|
||||
LIBS=-lncurses -lpthread -lesl -lm
|
||||
LIBS=-lncurses -lesl -lpthread -lm
|
||||
LDFLAGS=-L.
|
||||
OBJS=src/esl.o src/esl_event.o src/esl_threadmutex.o src/esl_config.o src/esl_json.o src/esl_buffer.o
|
||||
SRC=src/esl.c src/esl_json.c src/esl_event.c src/esl_threadmutex.c src/esl_config.c src/esl_oop.cpp src/esl_json.c src/esl_buffer.c
|
||||
@@ -32,7 +32,7 @@ testclient: $(MYLIB) testclient.c
|
||||
$(CC) $(CC_CFLAGS) $(CFLAGS) testclient.c -o testclient $(LDFLAGS) $(LIBS)
|
||||
|
||||
fs_cli: $(MYLIB) fs_cli.c
|
||||
$(CC) $(CC_CFLAGS) $(CFLAGS) fs_cli.c -o fs_cli $(LDFLAGS) -L$(LIBEDIT_DIR)/src/.libs $(LIBS) -ledit
|
||||
$(CC) $(CC_CFLAGS) $(CFLAGS) fs_cli.c -o fs_cli $(LDFLAGS) -L$(LIBEDIT_DIR)/src/.libs -ledit $(LIBS)
|
||||
|
||||
%.o: %.c $(HEADERS)
|
||||
$(CC) $(CC_CFLAGS) $(CFLAGS) -c $< -o $@
|
||||
|
||||
+526
-434
File diff suppressed because it is too large.
Load diff
@@ -904,6 +904,31 @@ SWIGEXPORT jlong JNICALL Java_org_freeswitch_esl_eslJNI_ESLconnection_1sendEvent
|
||||
}
|
||||
|
||||
|
||||
SWIGEXPORT jint JNICALL Java_org_freeswitch_esl_eslJNI_ESLconnection_1sendMSG(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jstring jarg3) {
|
||||
jint jresult = 0 ;
|
||||
ESLconnection *arg1 = (ESLconnection *) 0 ;
|
||||
ESLevent *arg2 = (ESLevent *) 0 ;
|
||||
char *arg3 = (char *) NULL ;
|
||||
int result;
|
||||
|
||||
(void)jenv;
|
||||
(void)jcls;
|
||||
(void)jarg1_;
|
||||
(void)jarg2_;
|
||||
arg1 = *(ESLconnection **)&jarg1;
|
||||
arg2 = *(ESLevent **)&jarg2;
|
||||
arg3 = 0;
|
||||
if (jarg3) {
|
||||
arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0);
|
||||
if (!arg3) return 0;
|
||||
}
|
||||
result = (int)(arg1)->sendMSG(arg2,(char const *)arg3);
|
||||
jresult = (jint)result;
|
||||
if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3);
|
||||
return jresult;
|
||||
}
|
||||
|
||||
|
||||
SWIGEXPORT jlong JNICALL Java_org_freeswitch_esl_eslJNI_ESLconnection_1recvEvent(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
|
||||
jlong jresult = 0 ;
|
||||
ESLconnection *arg1 = (ESLconnection *) 0 ;
|
||||
|
||||
@@ -82,6 +82,10 @@ public class ESLconnection {
|
||||
return (cPtr == 0) ? null : new ESLevent(cPtr, true);
|
||||
}
|
||||
|
||||
public int sendMSG(ESLevent send_me, String uuid) {
|
||||
return eslJNI.ESLconnection_sendMSG(swigCPtr, this, ESLevent.getCPtr(send_me), send_me, uuid);
|
||||
}
|
||||
|
||||
public ESLevent recvEvent() {
|
||||
long cPtr = eslJNI.ESLconnection_recvEvent(swigCPtr, this);
|
||||
return (cPtr == 0) ? null : new ESLevent(cPtr, true);
|
||||
|
||||
@@ -43,6 +43,7 @@ class eslJNI {
|
||||
public final static native long ESLconnection_api(long jarg1, ESLconnection jarg1_, String jarg2, String jarg3);
|
||||
public final static native long ESLconnection_bgapi(long jarg1, ESLconnection jarg1_, String jarg2, String jarg3, String jarg4);
|
||||
public final static native long ESLconnection_sendEvent(long jarg1, ESLconnection jarg1_, long jarg2, ESLevent jarg2_);
|
||||
public final static native int ESLconnection_sendMSG(long jarg1, ESLconnection jarg1_, long jarg2, ESLevent jarg2_, String jarg3);
|
||||
public final static native long ESLconnection_recvEvent(long jarg1, ESLconnection jarg1_);
|
||||
public final static native long ESLconnection_recvEventTimed(long jarg1, ESLconnection jarg1_, int jarg2);
|
||||
public final static native long ESLconnection_filter(long jarg1, ESLconnection jarg1_, String jarg2, String jarg3);
|
||||
|
||||
@@ -2632,6 +2632,43 @@ fail:
|
||||
}
|
||||
|
||||
|
||||
static int _wrap_ESLconnection_sendMSG(lua_State* L) {
|
||||
int SWIG_arg = -1;
|
||||
ESLconnection *arg1 = (ESLconnection *) 0 ;
|
||||
ESLevent *arg2 = (ESLevent *) 0 ;
|
||||
char *arg3 = (char *) NULL ;
|
||||
int result;
|
||||
|
||||
SWIG_check_num_args("sendMSG",2,3)
|
||||
if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("sendMSG",1,"ESLconnection *");
|
||||
if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("sendMSG",2,"ESLevent *");
|
||||
if(lua_gettop(L)>=3 && !lua_isstring(L,3)) SWIG_fail_arg("sendMSG",3,"char const *");
|
||||
|
||||
if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLconnection,0))){
|
||||
SWIG_fail_ptr("ESLconnection_sendMSG",1,SWIGTYPE_p_ESLconnection);
|
||||
}
|
||||
|
||||
|
||||
if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_ESLevent,0))){
|
||||
SWIG_fail_ptr("ESLconnection_sendMSG",2,SWIGTYPE_p_ESLevent);
|
||||
}
|
||||
|
||||
if(lua_gettop(L)>=3){
|
||||
arg3 = (char *)lua_tostring(L, 3);
|
||||
}
|
||||
result = (int)(arg1)->sendMSG(arg2,(char const *)arg3);
|
||||
SWIG_arg=0;
|
||||
lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
|
||||
return SWIG_arg;
|
||||
|
||||
if(0) SWIG_fail;
|
||||
|
||||
fail:
|
||||
lua_error(L);
|
||||
return SWIG_arg;
|
||||
}
|
||||
|
||||
|
||||
static int _wrap_ESLconnection_recvEvent(lua_State* L) {
|
||||
int SWIG_arg = -1;
|
||||
ESLconnection *arg1 = (ESLconnection *) 0 ;
|
||||
@@ -2917,6 +2954,7 @@ static swig_lua_method swig_ESLconnection_methods[] = {
|
||||
{"api", _wrap_ESLconnection_api},
|
||||
{"bgapi", _wrap_ESLconnection_bgapi},
|
||||
{"sendEvent", _wrap_ESLconnection_sendEvent},
|
||||
{"sendMSG", _wrap_ESLconnection_sendMSG},
|
||||
{"recvEvent", _wrap_ESLconnection_recvEvent},
|
||||
{"recvEventTimed", _wrap_ESLconnection_recvEventTimed},
|
||||
{"filter", _wrap_ESLconnection_filter},
|
||||
|
||||
@@ -286,6 +286,9 @@ class ESLPINVOKE {
|
||||
[DllImport("ESL", EntryPoint="CSharp_ESLconnection_SendEvent")]
|
||||
public static extern IntPtr ESLconnection_SendEvent(HandleRef jarg1, HandleRef jarg2);
|
||||
|
||||
[DllImport("ESL", EntryPoint="CSharp_ESLconnection_sendMSG")]
|
||||
public static extern int ESLconnection_sendMSG(HandleRef jarg1, HandleRef jarg2, string jarg3);
|
||||
|
||||
[DllImport("ESL", EntryPoint="CSharp_ESLconnection_RecvEvent")]
|
||||
public static extern IntPtr ESLconnection_RecvEvent(HandleRef jarg1);
|
||||
|
||||
|
||||
@@ -92,6 +92,11 @@ public class ESLconnection : IDisposable {
|
||||
return ret;
|
||||
}
|
||||
|
||||
public int sendMSG(ESLevent send_me, string uuid) {
|
||||
int ret = ESLPINVOKE.ESLconnection_sendMSG(swigCPtr, ESLevent.getCPtr(send_me), uuid);
|
||||
return ret;
|
||||
}
|
||||
|
||||
public ESLevent RecvEvent() {
|
||||
IntPtr cPtr = ESLPINVOKE.ESLconnection_RecvEvent(swigCPtr);
|
||||
ESLevent ret = (cPtr == IntPtr.Zero) ? null : new ESLevent(cPtr, true);
|
||||
|
||||
@@ -743,6 +743,22 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_ESLconnection_SendEvent(void * jarg1, void
|
||||
}
|
||||
|
||||
|
||||
SWIGEXPORT int SWIGSTDCALL CSharp_ESLconnection_sendMSG(void * jarg1, void * jarg2, char * jarg3) {
|
||||
int jresult ;
|
||||
ESLconnection *arg1 = (ESLconnection *) 0 ;
|
||||
ESLevent *arg2 = (ESLevent *) 0 ;
|
||||
char *arg3 = (char *) NULL ;
|
||||
int result;
|
||||
|
||||
arg1 = (ESLconnection *)jarg1;
|
||||
arg2 = (ESLevent *)jarg2;
|
||||
arg3 = (char *)jarg3;
|
||||
result = (int)(arg1)->sendMSG(arg2,(char const *)arg3);
|
||||
jresult = result;
|
||||
return jresult;
|
||||
}
|
||||
|
||||
|
||||
SWIGEXPORT void * SWIGSTDCALL CSharp_ESLconnection_RecvEvent(void * jarg1) {
|
||||
void * jresult ;
|
||||
ESLconnection *arg1 = (ESLconnection *) 0 ;
|
||||
|
||||
@@ -138,6 +138,7 @@ sub DESTROY {
|
||||
*api = *ESLc::ESLconnection_api;
|
||||
*bgapi = *ESLc::ESLconnection_bgapi;
|
||||
*sendEvent = *ESLc::ESLconnection_sendEvent;
|
||||
*sendMSG = *ESLc::ESLconnection_sendMSG;
|
||||
*recvEvent = *ESLc::ESLconnection_recvEvent;
|
||||
*recvEventTimed = *ESLc::ESLconnection_recvEventTimed;
|
||||
*filter = *ESLc::ESLconnection_filter;
|
||||
|
||||
@@ -3282,6 +3282,57 @@ XS(_wrap_ESLconnection_sendEvent) {
|
||||
}
|
||||
|
||||
|
||||
XS(_wrap_ESLconnection_sendMSG) {
|
||||
{
|
||||
ESLconnection *arg1 = (ESLconnection *) 0 ;
|
||||
ESLevent *arg2 = (ESLevent *) 0 ;
|
||||
char *arg3 = (char *) NULL ;
|
||||
int result;
|
||||
void *argp1 = 0 ;
|
||||
int res1 = 0 ;
|
||||
void *argp2 = 0 ;
|
||||
int res2 = 0 ;
|
||||
int res3 ;
|
||||
char *buf3 = 0 ;
|
||||
int alloc3 = 0 ;
|
||||
int argvi = 0;
|
||||
dXSARGS;
|
||||
|
||||
if ((items < 2) || (items > 3)) {
|
||||
SWIG_croak("Usage: ESLconnection_sendMSG(self,send_me,uuid);");
|
||||
}
|
||||
res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLconnection, 0 | 0 );
|
||||
if (!SWIG_IsOK(res1)) {
|
||||
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_sendMSG" "', argument " "1"" of type '" "ESLconnection *""'");
|
||||
}
|
||||
arg1 = reinterpret_cast< ESLconnection * >(argp1);
|
||||
res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_ESLevent, 0 | 0 );
|
||||
if (!SWIG_IsOK(res2)) {
|
||||
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_sendMSG" "', argument " "2"" of type '" "ESLevent *""'");
|
||||
}
|
||||
arg2 = reinterpret_cast< ESLevent * >(argp2);
|
||||
if (items > 2) {
|
||||
res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
|
||||
if (!SWIG_IsOK(res3)) {
|
||||
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLconnection_sendMSG" "', argument " "3"" of type '" "char const *""'");
|
||||
}
|
||||
arg3 = reinterpret_cast< char * >(buf3);
|
||||
}
|
||||
result = (int)(arg1)->sendMSG(arg2,(char const *)arg3);
|
||||
ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
|
||||
|
||||
|
||||
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
|
||||
XSRETURN(argvi);
|
||||
fail:
|
||||
|
||||
|
||||
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
|
||||
SWIG_croak_null();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
XS(_wrap_ESLconnection_recvEvent) {
|
||||
{
|
||||
ESLconnection *arg1 = (ESLconnection *) 0 ;
|
||||
@@ -3785,6 +3836,7 @@ static swig_command_info swig_commands[] = {
|
||||
{"ESLc::ESLconnection_api", _wrap_ESLconnection_api},
|
||||
{"ESLc::ESLconnection_bgapi", _wrap_ESLconnection_bgapi},
|
||||
{"ESLc::ESLconnection_sendEvent", _wrap_ESLconnection_sendEvent},
|
||||
{"ESLc::ESLconnection_sendMSG", _wrap_ESLconnection_sendMSG},
|
||||
{"ESLc::ESLconnection_recvEvent", _wrap_ESLconnection_recvEvent},
|
||||
{"ESLc::ESLconnection_recvEventTimed", _wrap_ESLconnection_recvEventTimed},
|
||||
{"ESLc::ESLconnection_filter", _wrap_ESLconnection_filter},
|
||||
|
||||
@@ -174,6 +174,14 @@ class ESLconnection {
|
||||
return is_resource($r) ? new ESLevent($r) : $r;
|
||||
}
|
||||
|
||||
function sendMSG($send_me,$uuid=null) {
|
||||
switch (func_num_args()) {
|
||||
case 1: $r=ESLconnection_sendMSG($this->_cPtr,$send_me); break;
|
||||
default: $r=ESLconnection_sendMSG($this->_cPtr,$send_me,$uuid);
|
||||
}
|
||||
return $r;
|
||||
}
|
||||
|
||||
function recvEvent() {
|
||||
$r=ESLconnection_recvEvent($this->_cPtr);
|
||||
return is_resource($r) ? new ESLevent($r) : $r;
|
||||
|
||||
@@ -2244,6 +2244,48 @@ fail:
|
||||
}
|
||||
|
||||
|
||||
ZEND_NAMED_FUNCTION(_wrap_ESLconnection_sendMSG) {
|
||||
ESLconnection *arg1 = (ESLconnection *) 0 ;
|
||||
ESLevent *arg2 = (ESLevent *) 0 ;
|
||||
char *arg3 = (char *) NULL ;
|
||||
int result;
|
||||
zval **args[3];
|
||||
int arg_count;
|
||||
|
||||
SWIG_ResetError();
|
||||
arg_count = ZEND_NUM_ARGS();
|
||||
if(arg_count<2 || arg_count>3 ||
|
||||
zend_get_parameters_array_ex(arg_count,args)!=SUCCESS)
|
||||
WRONG_PARAM_COUNT;
|
||||
|
||||
{
|
||||
if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLconnection, 0) < 0) {
|
||||
SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLconnection_sendMSG. Expected SWIGTYPE_p_ESLconnection");
|
||||
}
|
||||
}
|
||||
if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL");
|
||||
{
|
||||
if(SWIG_ConvertPtr(*args[1], (void **) &arg2, SWIGTYPE_p_ESLevent, 0) < 0) {
|
||||
SWIG_PHP_Error(E_ERROR, "Type error in argument 2 of ESLconnection_sendMSG. Expected SWIGTYPE_p_ESLevent");
|
||||
}
|
||||
}
|
||||
if(arg_count > 2) {
|
||||
/*@SWIG:/usr/local/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
|
||||
convert_to_string_ex(args[2]);
|
||||
arg3 = (char *) Z_STRVAL_PP(args[2]);
|
||||
/*@SWIG@*/;
|
||||
|
||||
}
|
||||
result = (int)(arg1)->sendMSG(arg2,(char const *)arg3);
|
||||
{
|
||||
ZVAL_LONG(return_value,result);
|
||||
}
|
||||
return;
|
||||
fail:
|
||||
zend_error(SWIG_ErrorCode(),SWIG_ErrorMsg());
|
||||
}
|
||||
|
||||
|
||||
ZEND_NAMED_FUNCTION(_wrap_ESLconnection_recvEvent) {
|
||||
ESLconnection *arg1 = (ESLconnection *) 0 ;
|
||||
ESLevent *result = 0 ;
|
||||
@@ -2651,6 +2693,7 @@ static zend_function_entry ESL_functions[] = {
|
||||
SWIG_ZEND_NAMED_FE(eslconnection_api,_wrap_ESLconnection_api,NULL)
|
||||
SWIG_ZEND_NAMED_FE(eslconnection_bgapi,_wrap_ESLconnection_bgapi,NULL)
|
||||
SWIG_ZEND_NAMED_FE(eslconnection_sendevent,_wrap_ESLconnection_sendEvent,NULL)
|
||||
SWIG_ZEND_NAMED_FE(eslconnection_sendmsg,_wrap_ESLconnection_sendMSG,NULL)
|
||||
SWIG_ZEND_NAMED_FE(eslconnection_recvevent,_wrap_ESLconnection_recvEvent,NULL)
|
||||
SWIG_ZEND_NAMED_FE(eslconnection_recveventtimed,_wrap_ESLconnection_recvEventTimed,NULL)
|
||||
SWIG_ZEND_NAMED_FE(eslconnection_filter,_wrap_ESLconnection_filter,NULL)
|
||||
|
||||
@@ -60,6 +60,7 @@ ZEND_NAMED_FUNCTION(_wrap_ESLconnection_sendRecv);
|
||||
ZEND_NAMED_FUNCTION(_wrap_ESLconnection_api);
|
||||
ZEND_NAMED_FUNCTION(_wrap_ESLconnection_bgapi);
|
||||
ZEND_NAMED_FUNCTION(_wrap_ESLconnection_sendEvent);
|
||||
ZEND_NAMED_FUNCTION(_wrap_ESLconnection_sendMSG);
|
||||
ZEND_NAMED_FUNCTION(_wrap_ESLconnection_recvEvent);
|
||||
ZEND_NAMED_FUNCTION(_wrap_ESLconnection_recvEventTimed);
|
||||
ZEND_NAMED_FUNCTION(_wrap_ESLconnection_filter);
|
||||
|
||||
@@ -87,6 +87,7 @@ class ESLconnection:
|
||||
def api(*args): return apply(_ESL.ESLconnection_api, args)
|
||||
def bgapi(*args): return apply(_ESL.ESLconnection_bgapi, args)
|
||||
def sendEvent(*args): return apply(_ESL.ESLconnection_sendEvent, args)
|
||||
def sendMSG(*args): return apply(_ESL.ESLconnection_sendMSG, args)
|
||||
def recvEvent(*args): return apply(_ESL.ESLconnection_recvEvent, args)
|
||||
def recvEventTimed(*args): return apply(_ESL.ESLconnection_recvEventTimed, args)
|
||||
def filter(*args): return apply(_ESL.ESLconnection_filter, args)
|
||||
|
||||
@@ -4370,6 +4370,58 @@ fail:
|
||||
}
|
||||
|
||||
|
||||
SWIGINTERN PyObject *_wrap_ESLconnection_sendMSG(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
|
||||
PyObject *resultobj = 0;
|
||||
ESLconnection *arg1 = (ESLconnection *) 0 ;
|
||||
ESLevent *arg2 = (ESLevent *) 0 ;
|
||||
char *arg3 = (char *) NULL ;
|
||||
int result;
|
||||
void *argp1 = 0 ;
|
||||
int res1 = 0 ;
|
||||
void *argp2 = 0 ;
|
||||
int res2 = 0 ;
|
||||
int res3 ;
|
||||
char *buf3 = 0 ;
|
||||
int alloc3 = 0 ;
|
||||
PyObject * obj0 = 0 ;
|
||||
PyObject * obj1 = 0 ;
|
||||
PyObject * obj2 = 0 ;
|
||||
|
||||
SWIG_PYTHON_THREAD_BEGIN_BLOCK;
|
||||
if (!PyArg_ParseTuple(args,(char *)"OO|O:ESLconnection_sendMSG",&obj0,&obj1,&obj2)) SWIG_fail;
|
||||
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLconnection, 0 | 0 );
|
||||
if (!SWIG_IsOK(res1)) {
|
||||
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_sendMSG" "', argument " "1"" of type '" "ESLconnection *""'");
|
||||
}
|
||||
arg1 = reinterpret_cast< ESLconnection * >(argp1);
|
||||
res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_ESLevent, 0 | 0 );
|
||||
if (!SWIG_IsOK(res2)) {
|
||||
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_sendMSG" "', argument " "2"" of type '" "ESLevent *""'");
|
||||
}
|
||||
arg2 = reinterpret_cast< ESLevent * >(argp2);
|
||||
if (obj2) {
|
||||
res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
|
||||
if (!SWIG_IsOK(res3)) {
|
||||
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLconnection_sendMSG" "', argument " "3"" of type '" "char const *""'");
|
||||
}
|
||||
arg3 = reinterpret_cast< char * >(buf3);
|
||||
}
|
||||
{
|
||||
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
|
||||
result = (int)(arg1)->sendMSG(arg2,(char const *)arg3);
|
||||
SWIG_PYTHON_THREAD_END_ALLOW;
|
||||
}
|
||||
resultobj = SWIG_From_int(static_cast< int >(result));
|
||||
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
|
||||
SWIG_PYTHON_THREAD_END_BLOCK;
|
||||
return resultobj;
|
||||
fail:
|
||||
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
|
||||
SWIG_PYTHON_THREAD_END_BLOCK;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
SWIGINTERN PyObject *_wrap_ESLconnection_recvEvent(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
|
||||
PyObject *resultobj = 0;
|
||||
ESLconnection *arg1 = (ESLconnection *) 0 ;
|
||||
@@ -4859,6 +4911,7 @@ static PyMethodDef SwigMethods[] = {
|
||||
{ (char *)"ESLconnection_api", _wrap_ESLconnection_api, METH_VARARGS, NULL},
|
||||
{ (char *)"ESLconnection_bgapi", _wrap_ESLconnection_bgapi, METH_VARARGS, NULL},
|
||||
{ (char *)"ESLconnection_sendEvent", _wrap_ESLconnection_sendEvent, METH_VARARGS, NULL},
|
||||
{ (char *)"ESLconnection_sendMSG", _wrap_ESLconnection_sendMSG, METH_VARARGS, NULL},
|
||||
{ (char *)"ESLconnection_recvEvent", _wrap_ESLconnection_recvEvent, METH_VARARGS, NULL},
|
||||
{ (char *)"ESLconnection_recvEventTimed", _wrap_ESLconnection_recvEventTimed, METH_VARARGS, NULL},
|
||||
{ (char *)"ESLconnection_filter", _wrap_ESLconnection_filter, METH_VARARGS, NULL},
|
||||
|
||||
@@ -3245,6 +3245,51 @@ fail:
|
||||
}
|
||||
|
||||
|
||||
SWIGINTERN VALUE
|
||||
_wrap_ESLconnection_sendMSG(int argc, VALUE *argv, VALUE self) {
|
||||
ESLconnection *arg1 = (ESLconnection *) 0 ;
|
||||
ESLevent *arg2 = (ESLevent *) 0 ;
|
||||
char *arg3 = (char *) NULL ;
|
||||
int result;
|
||||
void *argp1 = 0 ;
|
||||
int res1 = 0 ;
|
||||
void *argp2 = 0 ;
|
||||
int res2 = 0 ;
|
||||
int res3 ;
|
||||
char *buf3 = 0 ;
|
||||
int alloc3 = 0 ;
|
||||
VALUE vresult = Qnil;
|
||||
|
||||
if ((argc < 1) || (argc > 2)) {
|
||||
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
|
||||
}
|
||||
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ESLconnection, 0 | 0 );
|
||||
if (!SWIG_IsOK(res1)) {
|
||||
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ESLconnection *","sendMSG", 1, self ));
|
||||
}
|
||||
arg1 = reinterpret_cast< ESLconnection * >(argp1);
|
||||
res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_ESLevent, 0 | 0 );
|
||||
if (!SWIG_IsOK(res2)) {
|
||||
SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "ESLevent *","sendMSG", 2, argv[0] ));
|
||||
}
|
||||
arg2 = reinterpret_cast< ESLevent * >(argp2);
|
||||
if (argc > 1) {
|
||||
res3 = SWIG_AsCharPtrAndSize(argv[1], &buf3, NULL, &alloc3);
|
||||
if (!SWIG_IsOK(res3)) {
|
||||
SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "char const *","sendMSG", 3, argv[1] ));
|
||||
}
|
||||
arg3 = reinterpret_cast< char * >(buf3);
|
||||
}
|
||||
result = (int)(arg1)->sendMSG(arg2,(char const *)arg3);
|
||||
vresult = SWIG_From_int(static_cast< int >(result));
|
||||
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
|
||||
return vresult;
|
||||
fail:
|
||||
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
|
||||
SWIGINTERN VALUE
|
||||
_wrap_ESLconnection_recvEvent(int argc, VALUE *argv, VALUE self) {
|
||||
ESLconnection *arg1 = (ESLconnection *) 0 ;
|
||||
@@ -3958,6 +4003,7 @@ SWIGEXPORT void Init_ESL(void) {
|
||||
rb_define_method(cESLconnection.klass, "api", VALUEFUNC(_wrap_ESLconnection_api), -1);
|
||||
rb_define_method(cESLconnection.klass, "bgapi", VALUEFUNC(_wrap_ESLconnection_bgapi), -1);
|
||||
rb_define_method(cESLconnection.klass, "sendEvent", VALUEFUNC(_wrap_ESLconnection_sendEvent), -1);
|
||||
rb_define_method(cESLconnection.klass, "sendMSG", VALUEFUNC(_wrap_ESLconnection_sendMSG), -1);
|
||||
rb_define_method(cESLconnection.klass, "recvEvent", VALUEFUNC(_wrap_ESLconnection_recvEvent), -1);
|
||||
rb_define_method(cESLconnection.klass, "recvEventTimed", VALUEFUNC(_wrap_ESLconnection_recvEventTimed), -1);
|
||||
rb_define_method(cESLconnection.klass, "filter", VALUEFUNC(_wrap_ESLconnection_filter), -1);
|
||||
|
||||
@@ -534,6 +534,39 @@ ESL_DECLARE(esl_status_t) esl_execute(esl_handle_t *handle, const char *app, con
|
||||
}
|
||||
|
||||
|
||||
ESL_DECLARE(esl_status_t) esl_sendmsg(esl_handle_t *handle, esl_event_t *event, const char *uuid)
|
||||
{
|
||||
char cmd_buf[128] = "sendmsg\n";
|
||||
char *txt;
|
||||
|
||||
if (!handle || !handle->connected || handle->sock == ESL_SOCK_INVALID) {
|
||||
return ESL_FAIL;
|
||||
}
|
||||
|
||||
if (uuid) {
|
||||
snprintf(cmd_buf, sizeof(cmd_buf), "sendmsg %s\n", uuid);
|
||||
}
|
||||
|
||||
esl_event_serialize(event, &txt, ESL_FALSE);
|
||||
esl_log(ESL_LOG_DEBUG, "%s%s\n", cmd_buf, txt);
|
||||
|
||||
if (send(handle->sock, cmd_buf, strlen(cmd_buf), 0) <= 0) goto fail;
|
||||
if (send(handle->sock, txt, strlen(txt), 0) <= 0) goto fail;
|
||||
|
||||
free(txt);
|
||||
|
||||
return esl_recv(handle);
|
||||
|
||||
fail:
|
||||
|
||||
handle->connected = 0;
|
||||
|
||||
free(txt);
|
||||
|
||||
return ESL_FAIL;
|
||||
}
|
||||
|
||||
|
||||
ESL_DECLARE(esl_status_t) esl_filter(esl_handle_t *handle, const char *header, const char *value)
|
||||
{
|
||||
char send_buf[1024] = "";
|
||||
|
||||
@@ -270,8 +270,9 @@ ESL_DECLARE(char *) esl_event_get_header_idx(esl_event_t *event, const char *hea
|
||||
}
|
||||
|
||||
return hp->value;
|
||||
|
||||
}
|
||||
} else if (!strcmp(header_name, "_body")) {
|
||||
return event->body;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@@ -414,6 +415,10 @@ static esl_status_t esl_event_base_add_header(esl_event_t *event, esl_stack_t st
|
||||
int index = 0;
|
||||
char *real_header_name = NULL;
|
||||
|
||||
if (!strcmp(header_name, "_body")) {
|
||||
esl_event_set_body(event, data);
|
||||
}
|
||||
|
||||
if ((index_ptr = strchr(header_name, '['))) {
|
||||
index_ptr++;
|
||||
index = atoi(index_ptr);
|
||||
@@ -604,6 +609,17 @@ ESL_DECLARE(esl_status_t) esl_event_add_header_string(esl_event_t *event, esl_st
|
||||
return ESL_FAIL;
|
||||
}
|
||||
|
||||
ESL_DECLARE(esl_status_t) esl_event_set_body(esl_event_t *event, const char *body)
|
||||
{
|
||||
esl_safe_free(event->body);
|
||||
|
||||
if (body) {
|
||||
event->body = DUP(body);
|
||||
}
|
||||
|
||||
return ESL_SUCCESS;
|
||||
}
|
||||
|
||||
ESL_DECLARE(esl_status_t) esl_event_add_body(esl_event_t *event, const char *fmt, ...)
|
||||
{
|
||||
int ret = 0;
|
||||
@@ -791,7 +807,7 @@ ESL_DECLARE(esl_status_t) esl_event_serialize(esl_event_t *event, char **str, es
|
||||
if (encode) {
|
||||
esl_url_encode(hp->value, encode_buf, encode_len);
|
||||
} else {
|
||||
esl_snprintf(encode_buf, encode_len, "[%s]", hp->value);
|
||||
esl_snprintf(encode_buf, encode_len, "%s", hp->value);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -205,6 +205,15 @@ ESLevent *ESLconnection::sendEvent(ESLevent *send_me)
|
||||
return new ESLevent("server_disconnected");
|
||||
}
|
||||
|
||||
int ESLconnection::sendMSG(ESLevent *send_me, const char *uuid)
|
||||
{
|
||||
if (esl_sendmsg(&handle, send_me->event, uuid) == ESL_SUCCESS) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
ESLevent *ESLconnection::recvEvent()
|
||||
{
|
||||
if (esl_recv_event(&handle, 1, NULL) == ESL_SUCCESS) {
|
||||
|
||||
@@ -61,12 +61,22 @@ typedef enum {
|
||||
|
||||
#ifdef WIN32
|
||||
#define ESL_SEQ_FWHITE FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY
|
||||
#define ESL_SEQ_BWHITE FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE
|
||||
#define ESL_SEQ_FRED FOREGROUND_RED | FOREGROUND_INTENSITY
|
||||
#define ESL_SEQ_FMAGEN FOREGROUND_BLUE | FOREGROUND_RED
|
||||
#define ESL_SEQ_FCYAN FOREGROUND_GREEN | FOREGROUND_BLUE
|
||||
#define ESL_SEQ_FGREEN FOREGROUND_GREEN
|
||||
#define ESL_SEQ_BRED FOREGROUND_RED
|
||||
#define ESL_SEQ_FMAGEN FOREGROUND_BLUE | FOREGROUND_RED | FOREGROUND_INTENSITY
|
||||
#define ESL_SEQ_BMAGEN FOREGROUND_BLUE | FOREGROUND_RED
|
||||
#define ESL_SEQ_FCYAN FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY
|
||||
#define ESL_SEQ_BCYAN FOREGROUND_GREEN | FOREGROUND_BLUE
|
||||
#define ESL_SEQ_FGREEN FOREGROUND_GREEN | FOREGROUND_INTENSITY
|
||||
#define ESL_SEQ_BGREEN FOREGROUND_GREEN
|
||||
#define ESL_SEQ_FYELLOW FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_INTENSITY
|
||||
#define ESL_SEQ_BYELLOW FOREGROUND_RED | FOREGROUND_GREEN
|
||||
#define ESL_SEQ_DEFAULT_COLOR ESL_SEQ_FWHITE
|
||||
#define ESL_SEQ_FBLUE FOREGROUND_BLUE | FOREGROUND_INTENSITY
|
||||
#define ESL_SEQ_BBLUE FOREGROUND_BLUE
|
||||
#define ESL_SEQ_FBLACK 0 | FOREGROUND_INTENSITY
|
||||
#define ESL_SEQ_BBLACK 0
|
||||
#else
|
||||
#define ESL_SEQ_ESC "\033["
|
||||
/* Ansi Control character suffixes */
|
||||
@@ -397,6 +407,14 @@ ESL_DECLARE(esl_status_t) esl_execute(esl_handle_t *handle, const char *app, con
|
||||
*/
|
||||
ESL_DECLARE(esl_status_t) esl_sendevent(esl_handle_t *handle, esl_event_t *event);
|
||||
|
||||
/*!
|
||||
\brief Send an event as a message to be parsed
|
||||
\param handle Handle to which the event should be sent
|
||||
\param event Event to be sent
|
||||
\param uuid a specific uuid if not the default
|
||||
*/
|
||||
ESL_DECLARE(esl_status_t) esl_sendmsg(esl_handle_t *handle, esl_event_t *event, const char *uuid);
|
||||
|
||||
/*!
|
||||
\brief Connect a handle to a host/port with a specific password. This will also authenticate against the server
|
||||
\param handle Handle to connect
|
||||
|
||||
@@ -298,6 +298,7 @@ ESL_DECLARE(esl_status_t) esl_event_create_json(esl_event_t **event, const char
|
||||
\note the body parameter can be shadowed by the esl_event_reserve_subclass_detailed function
|
||||
*/
|
||||
ESL_DECLARE(esl_status_t) esl_event_add_body(esl_event_t *event, const char *fmt, ...);
|
||||
ESL_DECLARE(esl_status_t) esl_event_set_body(esl_event_t *event, const char *body);
|
||||
|
||||
/*!
|
||||
\brief Create a new event assuming it will not be custom event and therefore hiding the unused parameters
|
||||
|
||||
@@ -86,6 +86,7 @@ class ESLconnection {
|
||||
ESLevent *api(const char *cmd, const char *arg = NULL);
|
||||
ESLevent *bgapi(const char *cmd, const char *arg = NULL, const char *job_uuid = NULL);
|
||||
ESLevent *sendEvent(ESLevent *send_me);
|
||||
int sendMSG(ESLevent *send_me, const char *uuid = NULL);
|
||||
ESLevent *recvEvent();
|
||||
ESLevent *recvEventTimed(int ms);
|
||||
ESLevent *filter(const char *header, const char *value);
|
||||
|
||||
Reference in new issue
Block a user