]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add socketDescriptor() method to ESL::Connection obj
authorAnthony Minessale <anthony.minessale@gmail.com>
Fri, 12 Jun 2009 22:57:13 +0000 (22:57 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Fri, 12 Jun 2009 22:57:13 +0000 (22:57 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13770 d0543943-73ff-0310-b7d9-9358b9ac24b2

libs/esl/lua/esl_wrap.cpp
libs/esl/perl/ESL.pm
libs/esl/perl/esl_wrap.cpp
libs/esl/php/ESL.php
libs/esl/php/esl_wrap.cpp
libs/esl/php/php_ESL.h
libs/esl/python/ESL.py
libs/esl/python/esl_wrap.cpp
libs/esl/ruby/esl_wrap.cpp
libs/esl/src/esl_oop.cpp
libs/esl/src/include/esl_oop.h

index 7aa2a82d0d06c7171164d4f9e36a2654df2b49b5..70692a91e46e69be07e30ac2a4c5316eaf4f35bc 100644 (file)
@@ -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}, 
index 9da5768fbd2f67fb2e7841dabbf0543886087654..b50ee4a0832517a7487ebea047f29416f907e288 100644 (file)
@@ -128,6 +128,7 @@ sub DESTROY {
     }
 }
 
+*socketDescriptor = *ESLc::ESLconnection_socketDescriptor;
 *connected = *ESLc::ESLconnection_connected;
 *getInfo = *ESLc::ESLconnection_getInfo;
 *send = *ESLc::ESLconnection_send;
index ff0c7363418a2ed9805df1a37400a8025f3c2b64..add8b4fa39753843be69f4142e72636d6ba6beb2 100644 (file)
@@ -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},
index 12afaeb7180d93fdeb13a9d91ae359223b67fdad..a83df6a0b3d9b27f854ea48e286d51029915f49f 100644 (file)
@@ -121,6 +121,10 @@ class ESLconnection {
                $this->_cPtr=$r;
        }
 
+       function socketDescriptor() {
+               return ESLconnection_socketDescriptor($this->_cPtr);
+       }
+
        function connected() {
                return ESLconnection_connected($this->_cPtr);
        }
index 6ef33ae93221c855bb6ca90e84d5d8968758166f..c28ec3a143b541f24e8c1fd82fffda487b8a31d3 100644 (file)
@@ -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)
index 3f0109619ffe0f23a4058866702733b919180174..8c9dede981ff6e06cf55f220b8bb760571d1069e 100644 (file)
@@ -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);
index ad81ff2b7d1ecfc6e69ec3f36efb5b8d8a767280..8e52ea303ff47d2312252874370817c9bf445d26 100644 (file)
@@ -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)
index cd2a658c559ec8c5ea176336ac5e546714e3664b..06dab8faa69fdfd316075b6c06ee238b28ecb705 100644 (file)
@@ -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},
index 84a655912e3b14798541e859006132a6dbfbdecc..238e6e1d0e2c2b55fc72c3b58ec1215206816176 100644 (file)
@@ -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);
index e7168938ca9c85c27c149542bb2633d0193b8256..45d286a035031ed48fa3b5fe1b3650f269c823bd 100644 (file)
@@ -33,6 +33,16 @@ ESLconnection::~ESLconnection()
 
 }
 
+int ESLconnection::socketDescriptor()
+{
+       if (handle.connected) {
+        return (int) handle.sock;
+    }
+
+       return -1;
+}
+
+
 int ESLconnection::disconnect()
 {
        if (handle.connected) {
index 840b0ef99e3878aa7d94f55c34c27d329a690bb3..4c47dd82e7e258642c66babea72e16268a4a2cfa 100644 (file)
@@ -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);