add socketDescriptor() method to ESL::Connection obj
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13770 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
9675a6e24b
commit
04a965edb3
|
@ -2275,6 +2275,31 @@ fail:
|
|||
}
|
||||
|
||||
|
||||
static int _wrap_ESLconnection_socketDescriptor(lua_State* L) {
|
||||
int SWIG_arg = -1;
|
||||
ESLconnection *arg1 = (ESLconnection *) 0 ;
|
||||
int result;
|
||||
|
||||
SWIG_check_num_args("socketDescriptor",1,1)
|
||||
if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("socketDescriptor",1,"ESLconnection *");
|
||||
|
||||
if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLconnection,0))){
|
||||
SWIG_fail_ptr("ESLconnection_socketDescriptor",1,SWIGTYPE_p_ESLconnection);
|
||||
}
|
||||
|
||||
result = (int)(arg1)->socketDescriptor();
|
||||
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_connected(lua_State* L) {
|
||||
int SWIG_arg = -1;
|
||||
ESLconnection *arg1 = (ESLconnection *) 0 ;
|
||||
|
@ -2756,6 +2781,7 @@ ESLconnection *arg1 = (ESLconnection *) obj;
|
|||
delete arg1;
|
||||
}
|
||||
static swig_lua_method swig_ESLconnection_methods[] = {
|
||||
{"socketDescriptor", _wrap_ESLconnection_socketDescriptor},
|
||||
{"connected", _wrap_ESLconnection_connected},
|
||||
{"getInfo", _wrap_ESLconnection_getInfo},
|
||||
{"send", _wrap_ESLconnection_send},
|
||||
|
|
|
@ -128,6 +128,7 @@ sub DESTROY {
|
|||
}
|
||||
}
|
||||
|
||||
*socketDescriptor = *ESLc::ESLconnection_socketDescriptor;
|
||||
*connected = *ESLc::ESLconnection_connected;
|
||||
*getInfo = *ESLc::ESLconnection_getInfo;
|
||||
*send = *ESLc::ESLconnection_send;
|
||||
|
|
|
@ -2745,6 +2745,34 @@ XS(_wrap_delete_ESLconnection) {
|
|||
}
|
||||
|
||||
|
||||
XS(_wrap_ESLconnection_socketDescriptor) {
|
||||
{
|
||||
ESLconnection *arg1 = (ESLconnection *) 0 ;
|
||||
int result;
|
||||
void *argp1 = 0 ;
|
||||
int res1 = 0 ;
|
||||
int argvi = 0;
|
||||
dXSARGS;
|
||||
|
||||
if ((items < 1) || (items > 1)) {
|
||||
SWIG_croak("Usage: ESLconnection_socketDescriptor(self);");
|
||||
}
|
||||
res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLconnection, 0 | 0 );
|
||||
if (!SWIG_IsOK(res1)) {
|
||||
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_socketDescriptor" "', argument " "1"" of type '" "ESLconnection *""'");
|
||||
}
|
||||
arg1 = reinterpret_cast< ESLconnection * >(argp1);
|
||||
result = (int)(arg1)->socketDescriptor();
|
||||
ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
|
||||
|
||||
XSRETURN(argvi);
|
||||
fail:
|
||||
|
||||
SWIG_croak_null();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
XS(_wrap_ESLconnection_connected) {
|
||||
{
|
||||
ESLconnection *arg1 = (ESLconnection *) 0 ;
|
||||
|
@ -3514,6 +3542,7 @@ static swig_command_info swig_commands[] = {
|
|||
{"ESLc::ESLevent_nextHeader", _wrap_ESLevent_nextHeader},
|
||||
{"ESLc::new_ESLconnection", _wrap_new_ESLconnection},
|
||||
{"ESLc::delete_ESLconnection", _wrap_delete_ESLconnection},
|
||||
{"ESLc::ESLconnection_socketDescriptor", _wrap_ESLconnection_socketDescriptor},
|
||||
{"ESLc::ESLconnection_connected", _wrap_ESLconnection_connected},
|
||||
{"ESLc::ESLconnection_getInfo", _wrap_ESLconnection_getInfo},
|
||||
{"ESLc::ESLconnection_send", _wrap_ESLconnection_send},
|
||||
|
|
|
@ -121,6 +121,10 @@ class ESLconnection {
|
|||
$this->_cPtr=$r;
|
||||
}
|
||||
|
||||
function socketDescriptor() {
|
||||
return ESLconnection_socketDescriptor($this->_cPtr);
|
||||
}
|
||||
|
||||
function connected() {
|
||||
return ESLconnection_connected($this->_cPtr);
|
||||
}
|
||||
|
|
|
@ -1821,6 +1821,32 @@ static void __wrap_delete_ESLconnection(zend_rsrc_list_entry *rsrc, const char *
|
|||
}
|
||||
|
||||
|
||||
ZEND_NAMED_FUNCTION(_wrap_ESLconnection_socketDescriptor) {
|
||||
ESLconnection *arg1 = (ESLconnection *) 0 ;
|
||||
int result;
|
||||
zval **args[1];
|
||||
|
||||
SWIG_ResetError();
|
||||
if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_array_ex(1, 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_socketDescriptor. Expected SWIGTYPE_p_ESLconnection");
|
||||
}
|
||||
}
|
||||
if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL");
|
||||
result = (int)(arg1)->socketDescriptor();
|
||||
{
|
||||
ZVAL_LONG(return_value,result);
|
||||
}
|
||||
return;
|
||||
fail:
|
||||
zend_error(SWIG_ErrorCode(),SWIG_ErrorMsg());
|
||||
}
|
||||
|
||||
|
||||
ZEND_NAMED_FUNCTION(_wrap_ESLconnection_connected) {
|
||||
ESLconnection *arg1 = (ESLconnection *) 0 ;
|
||||
int result;
|
||||
|
@ -2454,6 +2480,7 @@ static zend_function_entry ESL_functions[] = {
|
|||
SWIG_ZEND_NAMED_FE(eslevent_firstheader,_wrap_ESLevent_firstHeader,NULL)
|
||||
SWIG_ZEND_NAMED_FE(eslevent_nextheader,_wrap_ESLevent_nextHeader,NULL)
|
||||
SWIG_ZEND_NAMED_FE(new_eslconnection,_wrap_new_ESLconnection,NULL)
|
||||
SWIG_ZEND_NAMED_FE(eslconnection_socketdescriptor,_wrap_ESLconnection_socketDescriptor,NULL)
|
||||
SWIG_ZEND_NAMED_FE(eslconnection_connected,_wrap_ESLconnection_connected,NULL)
|
||||
SWIG_ZEND_NAMED_FE(eslconnection_getinfo,_wrap_ESLconnection_getInfo,NULL)
|
||||
SWIG_ZEND_NAMED_FE(eslconnection_send,_wrap_ESLconnection_send,NULL)
|
||||
|
|
|
@ -50,6 +50,7 @@ ZEND_NAMED_FUNCTION(_wrap_ESLevent_delHeader);
|
|||
ZEND_NAMED_FUNCTION(_wrap_ESLevent_firstHeader);
|
||||
ZEND_NAMED_FUNCTION(_wrap_ESLevent_nextHeader);
|
||||
ZEND_NAMED_FUNCTION(_wrap_new_ESLconnection);
|
||||
ZEND_NAMED_FUNCTION(_wrap_ESLconnection_socketDescriptor);
|
||||
ZEND_NAMED_FUNCTION(_wrap_ESLconnection_connected);
|
||||
ZEND_NAMED_FUNCTION(_wrap_ESLconnection_getInfo);
|
||||
ZEND_NAMED_FUNCTION(_wrap_ESLconnection_send);
|
||||
|
|
|
@ -77,6 +77,7 @@ class ESLconnection:
|
|||
except: self.this = this
|
||||
__swig_destroy__ = _ESL.delete_ESLconnection
|
||||
__del__ = lambda self : None;
|
||||
def socketDescriptor(*args): return apply(_ESL.ESLconnection_socketDescriptor, args)
|
||||
def connected(*args): return apply(_ESL.ESLconnection_connected, args)
|
||||
def getInfo(*args): return apply(_ESL.ESLconnection_getInfo, args)
|
||||
def send(*args): return apply(_ESL.ESLconnection_send, args)
|
||||
|
|
|
@ -3659,6 +3659,28 @@ fail:
|
|||
}
|
||||
|
||||
|
||||
SWIGINTERN PyObject *_wrap_ESLconnection_socketDescriptor(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
|
||||
PyObject *resultobj = 0;
|
||||
ESLconnection *arg1 = (ESLconnection *) 0 ;
|
||||
int result;
|
||||
void *argp1 = 0 ;
|
||||
int res1 = 0 ;
|
||||
PyObject * obj0 = 0 ;
|
||||
|
||||
if (!PyArg_ParseTuple(args,(char *)"O:ESLconnection_socketDescriptor",&obj0)) 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_socketDescriptor" "', argument " "1"" of type '" "ESLconnection *""'");
|
||||
}
|
||||
arg1 = reinterpret_cast< ESLconnection * >(argp1);
|
||||
result = (int)(arg1)->socketDescriptor();
|
||||
resultobj = SWIG_From_int(static_cast< int >(result));
|
||||
return resultobj;
|
||||
fail:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
SWIGINTERN PyObject *_wrap_ESLconnection_connected(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
|
||||
PyObject *resultobj = 0;
|
||||
ESLconnection *arg1 = (ESLconnection *) 0 ;
|
||||
|
@ -4307,6 +4329,7 @@ static PyMethodDef SwigMethods[] = {
|
|||
{ (char *)"ESLevent_swigregister", ESLevent_swigregister, METH_VARARGS, NULL},
|
||||
{ (char *)"new_ESLconnection", _wrap_new_ESLconnection, METH_VARARGS, NULL},
|
||||
{ (char *)"delete_ESLconnection", _wrap_delete_ESLconnection, METH_VARARGS, NULL},
|
||||
{ (char *)"ESLconnection_socketDescriptor", _wrap_ESLconnection_socketDescriptor, METH_VARARGS, NULL},
|
||||
{ (char *)"ESLconnection_connected", _wrap_ESLconnection_connected, METH_VARARGS, NULL},
|
||||
{ (char *)"ESLconnection_getInfo", _wrap_ESLconnection_getInfo, METH_VARARGS, NULL},
|
||||
{ (char *)"ESLconnection_send", _wrap_ESLconnection_send, METH_VARARGS, NULL},
|
||||
|
|
|
@ -2780,6 +2780,30 @@ free_ESLconnection(ESLconnection *arg1) {
|
|||
delete arg1;
|
||||
}
|
||||
|
||||
SWIGINTERN VALUE
|
||||
_wrap_ESLconnection_socketDescriptor(int argc, VALUE *argv, VALUE self) {
|
||||
ESLconnection *arg1 = (ESLconnection *) 0 ;
|
||||
int result;
|
||||
void *argp1 = 0 ;
|
||||
int res1 = 0 ;
|
||||
VALUE vresult = Qnil;
|
||||
|
||||
if ((argc < 0) || (argc > 0)) {
|
||||
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",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 *","socketDescriptor", 1, self ));
|
||||
}
|
||||
arg1 = reinterpret_cast< ESLconnection * >(argp1);
|
||||
result = (int)(arg1)->socketDescriptor();
|
||||
vresult = SWIG_From_int(static_cast< int >(result));
|
||||
return vresult;
|
||||
fail:
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
|
||||
SWIGINTERN VALUE
|
||||
_wrap_ESLconnection_connected(int argc, VALUE *argv, VALUE self) {
|
||||
ESLconnection *arg1 = (ESLconnection *) 0 ;
|
||||
|
@ -3729,6 +3753,7 @@ SWIGEXPORT void Init_ESL(void) {
|
|||
SWIG_TypeClientData(SWIGTYPE_p_ESLconnection, (void *) &cESLconnection);
|
||||
rb_define_alloc_func(cESLconnection.klass, _wrap_ESLconnection_allocate);
|
||||
rb_define_method(cESLconnection.klass, "initialize", VALUEFUNC(_wrap_new_ESLconnection), -1);
|
||||
rb_define_method(cESLconnection.klass, "socketDescriptor", VALUEFUNC(_wrap_ESLconnection_socketDescriptor), -1);
|
||||
rb_define_method(cESLconnection.klass, "connected", VALUEFUNC(_wrap_ESLconnection_connected), -1);
|
||||
rb_define_method(cESLconnection.klass, "getInfo", VALUEFUNC(_wrap_ESLconnection_getInfo), -1);
|
||||
rb_define_method(cESLconnection.klass, "send", VALUEFUNC(_wrap_ESLconnection_send), -1);
|
||||
|
|
|
@ -33,6 +33,16 @@ ESLconnection::~ESLconnection()
|
|||
|
||||
}
|
||||
|
||||
int ESLconnection::socketDescriptor()
|
||||
{
|
||||
if (handle.connected) {
|
||||
return (int) handle.sock;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
int ESLconnection::disconnect()
|
||||
{
|
||||
if (handle.connected) {
|
||||
|
|
|
@ -76,6 +76,7 @@ class ESLconnection {
|
|||
ESLconnection(const char *host, const char *port, const char *password);
|
||||
ESLconnection(int socket);
|
||||
virtual ~ESLconnection();
|
||||
int socketDescriptor();
|
||||
int connected();
|
||||
ESLevent *getInfo();
|
||||
int send(const char *cmd);
|
||||
|
|
Loading…
Reference in New Issue