Merge tag 'upstream/3.3.3'
[debian/amanda] / perl / Amanda / Device.c
index cfbb55fda36a96565203b0d946da124ab46f5298..b8efee619d6ddedd589fa70c74566398f30946ff 100644 (file)
@@ -1508,23 +1508,22 @@ SWIG_Perl_SetModule(swig_module_info *module) {
 
 #define SWIGTYPE_p_Device swig_types[0]
 #define SWIGTYPE_p_DevicePropertyBase swig_types[1]
-#define SWIGTYPE_p_DirectTCPAddr swig_types[2]
-#define SWIGTYPE_p_DirectTCPConnection swig_types[3]
-#define SWIGTYPE_p_GSList swig_types[4]
-#define SWIGTYPE_p_GValue swig_types[5]
-#define SWIGTYPE_p_a_STRMAX__char swig_types[6]
-#define SWIGTYPE_p_char swig_types[7]
-#define SWIGTYPE_p_double swig_types[8]
-#define SWIGTYPE_p_dumpfile_t swig_types[9]
-#define SWIGTYPE_p_float swig_types[10]
-#define SWIGTYPE_p_guint swig_types[11]
-#define SWIGTYPE_p_guint32 swig_types[12]
-#define SWIGTYPE_p_guint64 swig_types[13]
-#define SWIGTYPE_p_int swig_types[14]
-#define SWIGTYPE_p_p_DirectTCPAddr swig_types[15]
-#define SWIGTYPE_p_unsigned_char swig_types[16]
-static swig_type_info *swig_types[18];
-static swig_module_info swig_module = {swig_types, 17, 0, 0, 0, 0};
+#define SWIGTYPE_p_DirectTCPConnection swig_types[2]
+#define SWIGTYPE_p_GSList swig_types[3]
+#define SWIGTYPE_p_GValue swig_types[4]
+#define SWIGTYPE_p_a_STRMAX__char swig_types[5]
+#define SWIGTYPE_p_char swig_types[6]
+#define SWIGTYPE_p_double swig_types[7]
+#define SWIGTYPE_p_dumpfile_t swig_types[8]
+#define SWIGTYPE_p_float swig_types[9]
+#define SWIGTYPE_p_guint swig_types[10]
+#define SWIGTYPE_p_guint32 swig_types[11]
+#define SWIGTYPE_p_guint64 swig_types[12]
+#define SWIGTYPE_p_int swig_types[13]
+#define SWIGTYPE_p_p_DirectTCPAddr swig_types[14]
+#define SWIGTYPE_p_unsigned_char swig_types[15]
+static swig_type_info *swig_types[17];
+static swig_module_info swig_module = {swig_types, 16, 0, 0, 0, 0};
 #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
 #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
 
@@ -1985,6 +1984,12 @@ SWIGINTERN gboolean Device_start(Device *self,DeviceAccessMode mode,char *label,
 SWIGINTERN gboolean Device_finish(Device *self){
            return device_finish(self);
        }
+SWIGINTERN guint64 Device_get_bytes_read(Device *self){
+           return device_get_bytes_read(self);
+       }
+SWIGINTERN guint64 Device_get_bytes_written(Device *self){
+           return device_get_bytes_written(self);
+       }
 SWIGINTERN gboolean Device_start_file(Device *self,dumpfile_t *jobInfo){
            return device_start_file(self, jobInfo);
        }
@@ -2017,39 +2022,9 @@ SWIGINTERN void Device_listen(Device *self,gboolean for_writing,DirectTCPAddr **
            if (!device_listen(self, for_writing, addrs))
                *addrs = NULL;
        }
-SWIGINTERN DirectTCPConnection *Device_accept(Device *self){
-           DirectTCPConnection *conn = NULL;
-           gboolean rv;
-
-           rv = device_accept(self, &conn, NULL, NULL);
-           if (!rv && conn) {
-               /* conn is ref'd for our convenience, but we don't want it */
-               g_object_unref(conn);
-               conn = NULL;
-           }
-           return conn;
-       }
-SWIGINTERN DirectTCPConnection *Device_connect(Device *self,gboolean for_writing,DirectTCPAddr *addrs){
-           DirectTCPConnection *conn = NULL;
-           gboolean rv;
-
-           rv = device_connect(self, for_writing, addrs, &conn, NULL, NULL);
-           if (!rv && conn) {
-               /* conn is ref'd for our convenience, but we don't want it */
-               g_object_unref(conn);
-               conn = NULL;
-           }
-           return conn;
-       }
 SWIGINTERN gboolean Device_use_connection(Device *self,DirectTCPConnection *conn){
            return device_use_connection(self, conn);
        }
-SWIGINTERN gboolean Device_write_from_connection(Device *self,guint64 size,guint64 *actual_size){
-           return device_write_from_connection(self, size, actual_size);
-       }
-SWIGINTERN gboolean Device_read_to_connection(Device *self,guint64 size,guint64 *actual_size){
-           return device_read_to_connection(self, size, actual_size);
-       }
 SWIGINTERN GSList const *Device_property_list(Device *self){
            return device_property_get_list(self);
        }
@@ -2713,6 +2688,76 @@ XS(_wrap_Device_finish) {
 }
 
 
+XS(_wrap_Device_get_bytes_read) {
+  {
+    Device *arg1 = (Device *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    guint64 result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Device_get_bytes_read(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_get_bytes_read" "', argument " "1"" of type '" "Device *""'"); 
+    }
+    arg1 = (Device *)(argp1);
+    result = Device_get_bytes_read(arg1);
+    {
+      SV *for_stack;
+      SP += argvi; PUTBACK;
+      for_stack = sv_2mortal(amglue_newSVu64(result));
+      SPAGAIN; SP -= argvi;
+      ST(argvi) = for_stack;
+      argvi++;
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Device_get_bytes_written) {
+  {
+    Device *arg1 = (Device *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    guint64 result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Device_get_bytes_written(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_get_bytes_written" "', argument " "1"" of type '" "Device *""'"); 
+    }
+    arg1 = (Device *)(argp1);
+    result = Device_get_bytes_written(arg1);
+    {
+      SV *for_stack;
+      SP += argvi; PUTBACK;
+      for_stack = sv_2mortal(amglue_newSVu64(result));
+      SPAGAIN; SP -= argvi;
+      ST(argvi) = for_stack;
+      argvi++;
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
 XS(_wrap_Device_start_file) {
   {
     Device *arg1 = (Device *) 0 ;
@@ -3143,112 +3188,6 @@ XS(_wrap_Device_listen) {
 }
 
 
-XS(_wrap_Device_accept) {
-  {
-    Device *arg1 = (Device *) 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int argvi = 0;
-    DirectTCPConnection *result = 0 ;
-    dXSARGS;
-    
-    if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: Device_accept(self);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_accept" "', argument " "1"" of type '" "Device *""'"); 
-    }
-    arg1 = (Device *)(argp1);
-    result = (DirectTCPConnection *)Device_accept(arg1);
-    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_DirectTCPConnection, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
-    
-    XSRETURN(argvi);
-  fail:
-    
-    SWIG_croak_null();
-  }
-}
-
-
-XS(_wrap_Device_connect) {
-  {
-    Device *arg1 = (Device *) 0 ;
-    gboolean arg2 ;
-    DirectTCPAddr *arg3 = (DirectTCPAddr *) 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int argvi = 0;
-    DirectTCPConnection *result = 0 ;
-    dXSARGS;
-    
-    if ((items < 3) || (items > 3)) {
-      SWIG_croak("Usage: Device_connect(self,for_writing,addrs);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_connect" "', argument " "1"" of type '" "Device *""'"); 
-    }
-    arg1 = (Device *)(argp1);
-    {
-      arg2 = SvTRUE(ST(1));
-    }
-    {
-      AV *addrs_av;
-      int num_addrs, i;
-      
-      if (!SvROK(ST(2)) || SvTYPE(SvRV(ST(2))) != SVt_PVAV) {
-        SWIG_exception_fail(SWIG_TypeError, "must provide an arrayref of DirectTCPAddrs");
-      }
-      addrs_av = (AV *)SvRV(ST(2));
-      num_addrs = av_len(addrs_av)+1;
-      
-      arg3 = g_new0(DirectTCPAddr, num_addrs+1);
-      
-      for (i = 0; i < num_addrs; i++) {
-        SV **svp = av_fetch(addrs_av, i, 0);
-        AV *addr_av;
-        sockaddr_union addr;
-        IV port;
-        
-        if (!svp || !SvROK(*svp) || SvTYPE(SvRV(*svp)) != SVt_PVAV
-          || av_len((AV *)SvRV(*svp))+1 != 2) {
-          SWIG_exception_fail(SWIG_TypeError, "each DirectTCPAddr must be a 2-element arrayref");
-        }
-        
-        addr_av = (AV *)SvRV(*svp);
-        
-        /* get address */
-        svp = av_fetch(addr_av, 0, 0);
-        if (!svp || !SvPOK(*svp) || !str_to_sockaddr(SvPV_nolen(*svp), &addr)) {
-          SWIG_exception_fail(SWIG_TypeError, "invalid IPv4 addr in address");
-        }
-        
-        /* get port */
-        svp = av_fetch(addr_av, 1, 0);
-        if (!svp || !SvIOK(*svp) || (port = SvIV(*svp)) <= 0 || port >= 65536) {
-          SWIG_exception_fail(SWIG_TypeError, "invalid port in address");
-        }
-        SU_SET_PORT(&addr, port);
-        
-        copy_sockaddr(arg3, &addr);
-      }
-    }
-    result = (DirectTCPConnection *)Device_connect(arg1,arg2,arg3);
-    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_DirectTCPConnection, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
-    
-    
-    
-    XSRETURN(argvi);
-  fail:
-    
-    
-    
-    SWIG_croak_null();
-  }
-}
-
-
 XS(_wrap_Device_use_connection) {
   {
     Device *arg1 = (Device *) 0 ;
@@ -3293,108 +3232,6 @@ XS(_wrap_Device_use_connection) {
 }
 
 
-XS(_wrap_Device_write_from_connection) {
-  {
-    Device *arg1 = (Device *) 0 ;
-    guint64 arg2 ;
-    guint64 *arg3 = (guint64 *) 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    guint64 sz3 ;
-    int argvi = 0;
-    gboolean result;
-    dXSARGS;
-    
-    {
-      sz3 = 0;
-      arg3 = &sz3;
-    }
-    if ((items < 2) || (items > 2)) {
-      SWIG_croak("Usage: Device_write_from_connection(self,size);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_write_from_connection" "', argument " "1"" of type '" "Device *""'"); 
-    }
-    arg1 = (Device *)(argp1);
-    {
-      arg2 = amglue_SvU64(ST(1));
-    }
-    result = (gboolean)Device_write_from_connection(arg1,arg2,arg3);
-    {
-      if (result)
-      ST(argvi) = &PL_sv_yes;
-      else
-      ST(argvi) = &PL_sv_no;
-      argvi++;
-    }
-    {
-      SP += argvi; PUTBACK;
-      ST(argvi) = sv_2mortal(amglue_newSVu64(*arg3));
-      SPAGAIN; SP -= argvi; argvi++;
-    }
-    
-    
-    XSRETURN(argvi);
-  fail:
-    
-    
-    SWIG_croak_null();
-  }
-}
-
-
-XS(_wrap_Device_read_to_connection) {
-  {
-    Device *arg1 = (Device *) 0 ;
-    guint64 arg2 ;
-    guint64 *arg3 = (guint64 *) 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    guint64 sz3 ;
-    int argvi = 0;
-    gboolean result;
-    dXSARGS;
-    
-    {
-      sz3 = 0;
-      arg3 = &sz3;
-    }
-    if ((items < 2) || (items > 2)) {
-      SWIG_croak("Usage: Device_read_to_connection(self,size);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_read_to_connection" "', argument " "1"" of type '" "Device *""'"); 
-    }
-    arg1 = (Device *)(argp1);
-    {
-      arg2 = amglue_SvU64(ST(1));
-    }
-    result = (gboolean)Device_read_to_connection(arg1,arg2,arg3);
-    {
-      if (result)
-      ST(argvi) = &PL_sv_yes;
-      else
-      ST(argvi) = &PL_sv_no;
-      argvi++;
-    }
-    {
-      SP += argvi; PUTBACK;
-      ST(argvi) = sv_2mortal(amglue_newSVu64(*arg3));
-      SPAGAIN; SP -= argvi; argvi++;
-    }
-    
-    
-    XSRETURN(argvi);
-  fail:
-    
-    
-    SWIG_croak_null();
-  }
-}
-
-
 XS(_wrap_Device_property_list) {
   {
     Device *arg1 = (Device *) 0 ;
@@ -4407,7 +4244,6 @@ XS(_wrap_IS_WRITABLE_ACCESS_MODE) {
 
 static swig_type_info _swigt__p_Device = {"_p_Device", "struct Device *|Device *", 0, 0, (void*)"Amanda::Device::Device", 0};
 static swig_type_info _swigt__p_DevicePropertyBase = {"_p_DevicePropertyBase", "DevicePropertyBase *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_DirectTCPAddr = {"_p_DirectTCPAddr", "DirectTCPAddr *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_DirectTCPConnection = {"_p_DirectTCPConnection", "struct DirectTCPConnection *|DirectTCPConnection *", 0, 0, (void*)"Amanda::Device::DirectTCPConnection", 0};
 static swig_type_info _swigt__p_GSList = {"_p_GSList", "GSList *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_GValue = {"_p_GValue", "GValue *", 0, 0, (void*)0, 0};
@@ -4426,7 +4262,6 @@ static swig_type_info _swigt__p_unsigned_char = {"_p_unsigned_char", "guchar *|u
 static swig_type_info *swig_type_initial[] = {
   &_swigt__p_Device,
   &_swigt__p_DevicePropertyBase,
-  &_swigt__p_DirectTCPAddr,
   &_swigt__p_DirectTCPConnection,
   &_swigt__p_GSList,
   &_swigt__p_GValue,
@@ -4445,7 +4280,6 @@ static swig_type_info *swig_type_initial[] = {
 
 static swig_cast_info _swigc__p_Device[] = {  {&_swigt__p_Device, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_DevicePropertyBase[] = {  {&_swigt__p_DevicePropertyBase, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_DirectTCPAddr[] = {  {&_swigt__p_DirectTCPAddr, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_DirectTCPConnection[] = {  {&_swigt__p_DirectTCPConnection, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_GSList[] = {  {&_swigt__p_GSList, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_GValue[] = {  {&_swigt__p_GValue, 0, 0, 0},{0, 0, 0, 0}};
@@ -4464,7 +4298,6 @@ static swig_cast_info _swigc__p_unsigned_char[] = {  {&_swigt__p_unsigned_char,
 static swig_cast_info *swig_cast_initial[] = {
   _swigc__p_Device,
   _swigc__p_DevicePropertyBase,
-  _swigc__p_DirectTCPAddr,
   _swigc__p_DirectTCPConnection,
   _swigc__p_GSList,
   _swigc__p_GValue,
@@ -4507,6 +4340,8 @@ static swig_command_info swig_commands[] = {
 {"Amanda::Devicec::Device_read_label", _wrap_Device_read_label},
 {"Amanda::Devicec::Device_start", _wrap_Device_start},
 {"Amanda::Devicec::Device_finish", _wrap_Device_finish},
+{"Amanda::Devicec::Device_get_bytes_read", _wrap_Device_get_bytes_read},
+{"Amanda::Devicec::Device_get_bytes_written", _wrap_Device_get_bytes_written},
 {"Amanda::Devicec::Device_start_file", _wrap_Device_start_file},
 {"Amanda::Devicec::Device_write_block", _wrap_Device_write_block},
 {"Amanda::Devicec::Device_finish_file", _wrap_Device_finish_file},
@@ -4517,11 +4352,7 @@ static swig_command_info swig_commands[] = {
 {"Amanda::Devicec::Device_eject", _wrap_Device_eject},
 {"Amanda::Devicec::Device_directtcp_supported", _wrap_Device_directtcp_supported},
 {"Amanda::Devicec::Device_listen", _wrap_Device_listen},
-{"Amanda::Devicec::Device_accept", _wrap_Device_accept},
-{"Amanda::Devicec::Device_connect", _wrap_Device_connect},
 {"Amanda::Devicec::Device_use_connection", _wrap_Device_use_connection},
-{"Amanda::Devicec::Device_write_from_connection", _wrap_Device_write_from_connection},
-{"Amanda::Devicec::Device_read_to_connection", _wrap_Device_read_to_connection},
 {"Amanda::Devicec::Device_property_list", _wrap_Device_property_list},
 {"Amanda::Devicec::Device_property_get", _wrap_Device_property_get},
 {"Amanda::Devicec::Device_property_set", _wrap_Device_property_set},