[Freeswitch-trunk] [commit] r13770 - in freeswitch/trunk/libs/esl: lua perl php python ruby src src/include

FreeSWITCH SVN anthm at freeswitch.org
Fri Jun 12 15:57:14 PDT 2009


Author: anthm
Date: Fri Jun 12 17:57:13 2009
New Revision: 13770

Log:
add socketDescriptor() method to ESL::Connection obj

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

Modified: freeswitch/trunk/libs/esl/lua/esl_wrap.cpp
==============================================================================
--- freeswitch/trunk/libs/esl/lua/esl_wrap.cpp	(original)
+++ freeswitch/trunk/libs/esl/lua/esl_wrap.cpp	Fri Jun 12 17:57:13 2009
@@ -2275,6 +2275,31 @@
 }
 
 
+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 @@
 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}, 

Modified: freeswitch/trunk/libs/esl/perl/ESL.pm
==============================================================================
--- freeswitch/trunk/libs/esl/perl/ESL.pm	(original)
+++ freeswitch/trunk/libs/esl/perl/ESL.pm	Fri Jun 12 17:57:13 2009
@@ -128,6 +128,7 @@
     }
 }
 
+*socketDescriptor = *ESLc::ESLconnection_socketDescriptor;
 *connected = *ESLc::ESLconnection_connected;
 *getInfo = *ESLc::ESLconnection_getInfo;
 *send = *ESLc::ESLconnection_send;

Modified: freeswitch/trunk/libs/esl/perl/esl_wrap.cpp
==============================================================================
--- freeswitch/trunk/libs/esl/perl/esl_wrap.cpp	(original)
+++ freeswitch/trunk/libs/esl/perl/esl_wrap.cpp	Fri Jun 12 17:57:13 2009
@@ -2745,6 +2745,34 @@
 }
 
 
+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 @@
 {"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},

Modified: freeswitch/trunk/libs/esl/php/ESL.php
==============================================================================
--- freeswitch/trunk/libs/esl/php/ESL.php	(original)
+++ freeswitch/trunk/libs/esl/php/ESL.php	Fri Jun 12 17:57:13 2009
@@ -121,6 +121,10 @@
 		$this->_cPtr=$r;
 	}
 
+	function socketDescriptor() {
+		return ESLconnection_socketDescriptor($this->_cPtr);
+	}
+
 	function connected() {
 		return ESLconnection_connected($this->_cPtr);
 	}

Modified: freeswitch/trunk/libs/esl/php/esl_wrap.cpp
==============================================================================
--- freeswitch/trunk/libs/esl/php/esl_wrap.cpp	(original)
+++ freeswitch/trunk/libs/esl/php/esl_wrap.cpp	Fri Jun 12 17:57:13 2009
@@ -1821,6 +1821,32 @@
 }
 
 
+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 @@
  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)

Modified: freeswitch/trunk/libs/esl/php/php_ESL.h
==============================================================================
--- freeswitch/trunk/libs/esl/php/php_ESL.h	(original)
+++ freeswitch/trunk/libs/esl/php/php_ESL.h	Fri Jun 12 17:57:13 2009
@@ -50,6 +50,7 @@
 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);

Modified: freeswitch/trunk/libs/esl/python/ESL.py
==============================================================================
--- freeswitch/trunk/libs/esl/python/ESL.py	(original)
+++ freeswitch/trunk/libs/esl/python/ESL.py	Fri Jun 12 17:57:13 2009
@@ -77,6 +77,7 @@
         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)

Modified: freeswitch/trunk/libs/esl/python/esl_wrap.cpp
==============================================================================
--- freeswitch/trunk/libs/esl/python/esl_wrap.cpp	(original)
+++ freeswitch/trunk/libs/esl/python/esl_wrap.cpp	Fri Jun 12 17:57:13 2009
@@ -3659,6 +3659,28 @@
 }
 
 
+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 @@
 	 { (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},

Modified: freeswitch/trunk/libs/esl/ruby/esl_wrap.cpp
==============================================================================
--- freeswitch/trunk/libs/esl/ruby/esl_wrap.cpp	(original)
+++ freeswitch/trunk/libs/esl/ruby/esl_wrap.cpp	Fri Jun 12 17:57:13 2009
@@ -2781,6 +2781,30 @@
 }
 
 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 ;
   int result;
@@ -3729,6 +3753,7 @@
   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);

Modified: freeswitch/trunk/libs/esl/src/esl_oop.cpp
==============================================================================
--- freeswitch/trunk/libs/esl/src/esl_oop.cpp	(original)
+++ freeswitch/trunk/libs/esl/src/esl_oop.cpp	Fri Jun 12 17:57:13 2009
@@ -33,6 +33,16 @@
 
 }
 
+int ESLconnection::socketDescriptor()
+{
+	if (handle.connected) {
+        return (int) handle.sock;
+    }
+
+	return -1;
+}
+
+
 int ESLconnection::disconnect()
 {
 	if (handle.connected) {

Modified: freeswitch/trunk/libs/esl/src/include/esl_oop.h
==============================================================================
--- freeswitch/trunk/libs/esl/src/include/esl_oop.h	(original)
+++ freeswitch/trunk/libs/esl/src/include/esl_oop.h	Fri Jun 12 17:57:13 2009
@@ -76,6 +76,7 @@
 	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);



More information about the Freeswitch-trunk mailing list