bb3a19d022171735cc56bde5a8b900a415cd2dd5
[debian/amanda] / perl / Amanda / Device.c
1 /* ----------------------------------------------------------------------------
2  * This file was automatically generated by SWIG (http://www.swig.org).
3  * Version 1.3.39
4  * 
5  * This file is not intended to be easily readable and contains a number of 
6  * coding conventions designed to improve portability and efficiency. Do not make
7  * changes to this file unless you know what you are doing--modify the SWIG 
8  * interface file instead. 
9  * ----------------------------------------------------------------------------- */
10
11 #include "../config/config.h"
12
13
14 #define SWIGPERL
15 #define SWIG_CASTRANK_MODE
16
17 /* -----------------------------------------------------------------------------
18  *  This section contains generic SWIG labels for method/variable
19  *  declarations/attributes, and other compiler dependent labels.
20  * ----------------------------------------------------------------------------- */
21
22 /* template workaround for compilers that cannot correctly implement the C++ standard */
23 #ifndef SWIGTEMPLATEDISAMBIGUATOR
24 # if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
25 #  define SWIGTEMPLATEDISAMBIGUATOR template
26 # elif defined(__HP_aCC)
27 /* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
28 /* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
29 #  define SWIGTEMPLATEDISAMBIGUATOR template
30 # else
31 #  define SWIGTEMPLATEDISAMBIGUATOR
32 # endif
33 #endif
34
35 /* inline attribute */
36 #ifndef SWIGINLINE
37 # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
38 #   define SWIGINLINE inline
39 # else
40 #   define SWIGINLINE
41 # endif
42 #endif
43
44 /* attribute recognised by some compilers to avoid 'unused' warnings */
45 #ifndef SWIGUNUSED
46 # if defined(__GNUC__)
47 #   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
48 #     define SWIGUNUSED __attribute__ ((__unused__)) 
49 #   else
50 #     define SWIGUNUSED
51 #   endif
52 # elif defined(__ICC)
53 #   define SWIGUNUSED __attribute__ ((__unused__)) 
54 # else
55 #   define SWIGUNUSED 
56 # endif
57 #endif
58
59 #ifndef SWIG_MSC_UNSUPPRESS_4505
60 # if defined(_MSC_VER)
61 #   pragma warning(disable : 4505) /* unreferenced local function has been removed */
62 # endif 
63 #endif
64
65 #ifndef SWIGUNUSEDPARM
66 # ifdef __cplusplus
67 #   define SWIGUNUSEDPARM(p)
68 # else
69 #   define SWIGUNUSEDPARM(p) p SWIGUNUSED 
70 # endif
71 #endif
72
73 /* internal SWIG method */
74 #ifndef SWIGINTERN
75 # define SWIGINTERN static SWIGUNUSED
76 #endif
77
78 /* internal inline SWIG method */
79 #ifndef SWIGINTERNINLINE
80 # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
81 #endif
82
83 /* exporting methods */
84 #if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
85 #  ifndef GCC_HASCLASSVISIBILITY
86 #    define GCC_HASCLASSVISIBILITY
87 #  endif
88 #endif
89
90 #ifndef SWIGEXPORT
91 # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
92 #   if defined(STATIC_LINKED)
93 #     define SWIGEXPORT
94 #   else
95 #     define SWIGEXPORT __declspec(dllexport)
96 #   endif
97 # else
98 #   if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
99 #     define SWIGEXPORT __attribute__ ((visibility("default")))
100 #   else
101 #     define SWIGEXPORT
102 #   endif
103 # endif
104 #endif
105
106 /* calling conventions for Windows */
107 #ifndef SWIGSTDCALL
108 # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
109 #   define SWIGSTDCALL __stdcall
110 # else
111 #   define SWIGSTDCALL
112 # endif 
113 #endif
114
115 /* Deal with Microsoft's attempt at deprecating C standard runtime functions */
116 #if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
117 # define _CRT_SECURE_NO_DEPRECATE
118 #endif
119
120 /* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
121 #if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
122 # define _SCL_SECURE_NO_DEPRECATE
123 #endif
124
125
126 /* -----------------------------------------------------------------------------
127  * swigrun.swg
128  *
129  * This file contains generic C API SWIG runtime support for pointer
130  * type checking.
131  * ----------------------------------------------------------------------------- */
132
133 /* This should only be incremented when either the layout of swig_type_info changes,
134    or for whatever reason, the runtime changes incompatibly */
135 #define SWIG_RUNTIME_VERSION "4"
136
137 /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
138 #ifdef SWIG_TYPE_TABLE
139 # define SWIG_QUOTE_STRING(x) #x
140 # define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
141 # define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
142 #else
143 # define SWIG_TYPE_TABLE_NAME
144 #endif
145
146 /*
147   You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
148   creating a static or dynamic library from the SWIG runtime code.
149   In 99.9% of the cases, SWIG just needs to declare them as 'static'.
150   
151   But only do this if strictly necessary, ie, if you have problems
152   with your compiler or suchlike.
153 */
154
155 #ifndef SWIGRUNTIME
156 # define SWIGRUNTIME SWIGINTERN
157 #endif
158
159 #ifndef SWIGRUNTIMEINLINE
160 # define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
161 #endif
162
163 /*  Generic buffer size */
164 #ifndef SWIG_BUFFER_SIZE
165 # define SWIG_BUFFER_SIZE 1024
166 #endif
167
168 /* Flags for pointer conversions */
169 #define SWIG_POINTER_DISOWN        0x1
170 #define SWIG_CAST_NEW_MEMORY       0x2
171
172 /* Flags for new pointer objects */
173 #define SWIG_POINTER_OWN           0x1
174
175
176 /* 
177    Flags/methods for returning states.
178    
179    The SWIG conversion methods, as ConvertPtr, return and integer 
180    that tells if the conversion was successful or not. And if not,
181    an error code can be returned (see swigerrors.swg for the codes).
182    
183    Use the following macros/flags to set or process the returning
184    states.
185    
186    In old versions of SWIG, code such as the following was usually written:
187
188      if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
189        // success code
190      } else {
191        //fail code
192      }
193
194    Now you can be more explicit:
195
196     int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
197     if (SWIG_IsOK(res)) {
198       // success code
199     } else {
200       // fail code
201     }
202
203    which is the same really, but now you can also do
204
205     Type *ptr;
206     int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
207     if (SWIG_IsOK(res)) {
208       // success code
209       if (SWIG_IsNewObj(res) {
210         ...
211         delete *ptr;
212       } else {
213         ...
214       }
215     } else {
216       // fail code
217     }
218     
219    I.e., now SWIG_ConvertPtr can return new objects and you can
220    identify the case and take care of the deallocation. Of course that
221    also requires SWIG_ConvertPtr to return new result values, such as
222
223       int SWIG_ConvertPtr(obj, ptr,...) {         
224         if (<obj is ok>) {                             
225           if (<need new object>) {                     
226             *ptr = <ptr to new allocated object>; 
227             return SWIG_NEWOBJ;                
228           } else {                                     
229             *ptr = <ptr to old object>;        
230             return SWIG_OLDOBJ;                
231           }                                    
232         } else {                                       
233           return SWIG_BADOBJ;                  
234         }                                              
235       }
236
237    Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
238    more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
239    SWIG errors code.
240
241    Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
242    allows to return the 'cast rank', for example, if you have this
243
244        int food(double)
245        int fooi(int);
246
247    and you call
248  
249       food(1)   // cast rank '1'  (1 -> 1.0)
250       fooi(1)   // cast rank '0'
251
252    just use the SWIG_AddCast()/SWIG_CheckState()
253 */
254
255 #define SWIG_OK                    (0) 
256 #define SWIG_ERROR                 (-1)
257 #define SWIG_IsOK(r)               (r >= 0)
258 #define SWIG_ArgError(r)           ((r != SWIG_ERROR) ? r : SWIG_TypeError)  
259
260 /* The CastRankLimit says how many bits are used for the cast rank */
261 #define SWIG_CASTRANKLIMIT         (1 << 8)
262 /* The NewMask denotes the object was created (using new/malloc) */
263 #define SWIG_NEWOBJMASK            (SWIG_CASTRANKLIMIT  << 1)
264 /* The TmpMask is for in/out typemaps that use temporal objects */
265 #define SWIG_TMPOBJMASK            (SWIG_NEWOBJMASK << 1)
266 /* Simple returning values */
267 #define SWIG_BADOBJ                (SWIG_ERROR)
268 #define SWIG_OLDOBJ                (SWIG_OK)
269 #define SWIG_NEWOBJ                (SWIG_OK | SWIG_NEWOBJMASK)
270 #define SWIG_TMPOBJ                (SWIG_OK | SWIG_TMPOBJMASK)
271 /* Check, add and del mask methods */
272 #define SWIG_AddNewMask(r)         (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
273 #define SWIG_DelNewMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
274 #define SWIG_IsNewObj(r)           (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
275 #define SWIG_AddTmpMask(r)         (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
276 #define SWIG_DelTmpMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
277 #define SWIG_IsTmpObj(r)           (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
278
279 /* Cast-Rank Mode */
280 #if defined(SWIG_CASTRANK_MODE)
281 #  ifndef SWIG_TypeRank
282 #    define SWIG_TypeRank             unsigned long
283 #  endif
284 #  ifndef SWIG_MAXCASTRANK            /* Default cast allowed */
285 #    define SWIG_MAXCASTRANK          (2)
286 #  endif
287 #  define SWIG_CASTRANKMASK          ((SWIG_CASTRANKLIMIT) -1)
288 #  define SWIG_CastRank(r)           (r & SWIG_CASTRANKMASK)
289 SWIGINTERNINLINE int SWIG_AddCast(int r) { 
290   return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
291 }
292 SWIGINTERNINLINE int SWIG_CheckState(int r) { 
293   return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; 
294 }
295 #else /* no cast-rank mode */
296 #  define SWIG_AddCast
297 #  define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
298 #endif
299
300
301 #include <string.h>
302
303 #ifdef __cplusplus
304 extern "C" {
305 #endif
306
307 typedef void *(*swig_converter_func)(void *, int *);
308 typedef struct swig_type_info *(*swig_dycast_func)(void **);
309
310 /* Structure to store information on one type */
311 typedef struct swig_type_info {
312   const char             *name;                 /* mangled name of this type */
313   const char             *str;                  /* human readable name of this type */
314   swig_dycast_func        dcast;                /* dynamic cast function down a hierarchy */
315   struct swig_cast_info  *cast;                 /* linked list of types that can cast into this type */
316   void                   *clientdata;           /* language specific type data */
317   int                    owndata;               /* flag if the structure owns the clientdata */
318 } swig_type_info;
319
320 /* Structure to store a type and conversion function used for casting */
321 typedef struct swig_cast_info {
322   swig_type_info         *type;                 /* pointer to type that is equivalent to this type */
323   swig_converter_func     converter;            /* function to cast the void pointers */
324   struct swig_cast_info  *next;                 /* pointer to next cast in linked list */
325   struct swig_cast_info  *prev;                 /* pointer to the previous cast */
326 } swig_cast_info;
327
328 /* Structure used to store module information
329  * Each module generates one structure like this, and the runtime collects
330  * all of these structures and stores them in a circularly linked list.*/
331 typedef struct swig_module_info {
332   swig_type_info         **types;               /* Array of pointers to swig_type_info structures that are in this module */
333   size_t                 size;                  /* Number of types in this module */
334   struct swig_module_info *next;                /* Pointer to next element in circularly linked list */
335   swig_type_info         **type_initial;        /* Array of initially generated type structures */
336   swig_cast_info         **cast_initial;        /* Array of initially generated casting structures */
337   void                    *clientdata;          /* Language specific module data */
338 } swig_module_info;
339
340 /* 
341   Compare two type names skipping the space characters, therefore
342   "char*" == "char *" and "Class<int>" == "Class<int >", etc.
343
344   Return 0 when the two name types are equivalent, as in
345   strncmp, but skipping ' '.
346 */
347 SWIGRUNTIME int
348 SWIG_TypeNameComp(const char *f1, const char *l1,
349                   const char *f2, const char *l2) {
350   for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
351     while ((*f1 == ' ') && (f1 != l1)) ++f1;
352     while ((*f2 == ' ') && (f2 != l2)) ++f2;
353     if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
354   }
355   return (int)((l1 - f1) - (l2 - f2));
356 }
357
358 /*
359   Check type equivalence in a name list like <name1>|<name2>|...
360   Return 0 if not equal, 1 if equal
361 */
362 SWIGRUNTIME int
363 SWIG_TypeEquiv(const char *nb, const char *tb) {
364   int equiv = 0;
365   const char* te = tb + strlen(tb);
366   const char* ne = nb;
367   while (!equiv && *ne) {
368     for (nb = ne; *ne; ++ne) {
369       if (*ne == '|') break;
370     }
371     equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
372     if (*ne) ++ne;
373   }
374   return equiv;
375 }
376
377 /*
378   Check type equivalence in a name list like <name1>|<name2>|...
379   Return 0 if equal, -1 if nb < tb, 1 if nb > tb
380 */
381 SWIGRUNTIME int
382 SWIG_TypeCompare(const char *nb, const char *tb) {
383   int equiv = 0;
384   const char* te = tb + strlen(tb);
385   const char* ne = nb;
386   while (!equiv && *ne) {
387     for (nb = ne; *ne; ++ne) {
388       if (*ne == '|') break;
389     }
390     equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
391     if (*ne) ++ne;
392   }
393   return equiv;
394 }
395
396
397 /*
398   Check the typename
399 */
400 SWIGRUNTIME swig_cast_info *
401 SWIG_TypeCheck(const char *c, swig_type_info *ty) {
402   if (ty) {
403     swig_cast_info *iter = ty->cast;
404     while (iter) {
405       if (strcmp(iter->type->name, c) == 0) {
406         if (iter == ty->cast)
407           return iter;
408         /* Move iter to the top of the linked list */
409         iter->prev->next = iter->next;
410         if (iter->next)
411           iter->next->prev = iter->prev;
412         iter->next = ty->cast;
413         iter->prev = 0;
414         if (ty->cast) ty->cast->prev = iter;
415         ty->cast = iter;
416         return iter;
417       }
418       iter = iter->next;
419     }
420   }
421   return 0;
422 }
423
424 /* 
425   Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison
426 */
427 SWIGRUNTIME swig_cast_info *
428 SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) {
429   if (ty) {
430     swig_cast_info *iter = ty->cast;
431     while (iter) {
432       if (iter->type == from) {
433         if (iter == ty->cast)
434           return iter;
435         /* Move iter to the top of the linked list */
436         iter->prev->next = iter->next;
437         if (iter->next)
438           iter->next->prev = iter->prev;
439         iter->next = ty->cast;
440         iter->prev = 0;
441         if (ty->cast) ty->cast->prev = iter;
442         ty->cast = iter;
443         return iter;
444       }
445       iter = iter->next;
446     }
447   }
448   return 0;
449 }
450
451 /*
452   Cast a pointer up an inheritance hierarchy
453 */
454 SWIGRUNTIMEINLINE void *
455 SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
456   return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
457 }
458
459 /* 
460    Dynamic pointer casting. Down an inheritance hierarchy
461 */
462 SWIGRUNTIME swig_type_info *
463 SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
464   swig_type_info *lastty = ty;
465   if (!ty || !ty->dcast) return ty;
466   while (ty && (ty->dcast)) {
467     ty = (*ty->dcast)(ptr);
468     if (ty) lastty = ty;
469   }
470   return lastty;
471 }
472
473 /*
474   Return the name associated with this type
475 */
476 SWIGRUNTIMEINLINE const char *
477 SWIG_TypeName(const swig_type_info *ty) {
478   return ty->name;
479 }
480
481 /*
482   Return the pretty name associated with this type,
483   that is an unmangled type name in a form presentable to the user.
484 */
485 SWIGRUNTIME const char *
486 SWIG_TypePrettyName(const swig_type_info *type) {
487   /* The "str" field contains the equivalent pretty names of the
488      type, separated by vertical-bar characters.  We choose
489      to print the last name, as it is often (?) the most
490      specific. */
491   if (!type) return NULL;
492   if (type->str != NULL) {
493     const char *last_name = type->str;
494     const char *s;
495     for (s = type->str; *s; s++)
496       if (*s == '|') last_name = s+1;
497     return last_name;
498   }
499   else
500     return type->name;
501 }
502
503 /* 
504    Set the clientdata field for a type
505 */
506 SWIGRUNTIME void
507 SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
508   swig_cast_info *cast = ti->cast;
509   /* if (ti->clientdata == clientdata) return; */
510   ti->clientdata = clientdata;
511   
512   while (cast) {
513     if (!cast->converter) {
514       swig_type_info *tc = cast->type;
515       if (!tc->clientdata) {
516         SWIG_TypeClientData(tc, clientdata);
517       }
518     }    
519     cast = cast->next;
520   }
521 }
522 SWIGRUNTIME void
523 SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
524   SWIG_TypeClientData(ti, clientdata);
525   ti->owndata = 1;
526 }
527   
528 /*
529   Search for a swig_type_info structure only by mangled name
530   Search is a O(log #types)
531   
532   We start searching at module start, and finish searching when start == end.  
533   Note: if start == end at the beginning of the function, we go all the way around
534   the circular list.
535 */
536 SWIGRUNTIME swig_type_info *
537 SWIG_MangledTypeQueryModule(swig_module_info *start, 
538                             swig_module_info *end, 
539                             const char *name) {
540   swig_module_info *iter = start;
541   do {
542     if (iter->size) {
543       register size_t l = 0;
544       register size_t r = iter->size - 1;
545       do {
546         /* since l+r >= 0, we can (>> 1) instead (/ 2) */
547         register size_t i = (l + r) >> 1; 
548         const char *iname = iter->types[i]->name;
549         if (iname) {
550           register int compare = strcmp(name, iname);
551           if (compare == 0) {       
552             return iter->types[i];
553           } else if (compare < 0) {
554             if (i) {
555               r = i - 1;
556             } else {
557               break;
558             }
559           } else if (compare > 0) {
560             l = i + 1;
561           }
562         } else {
563           break; /* should never happen */
564         }
565       } while (l <= r);
566     }
567     iter = iter->next;
568   } while (iter != end);
569   return 0;
570 }
571
572 /*
573   Search for a swig_type_info structure for either a mangled name or a human readable name.
574   It first searches the mangled names of the types, which is a O(log #types)
575   If a type is not found it then searches the human readable names, which is O(#types).
576   
577   We start searching at module start, and finish searching when start == end.  
578   Note: if start == end at the beginning of the function, we go all the way around
579   the circular list.
580 */
581 SWIGRUNTIME swig_type_info *
582 SWIG_TypeQueryModule(swig_module_info *start, 
583                      swig_module_info *end, 
584                      const char *name) {
585   /* STEP 1: Search the name field using binary search */
586   swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
587   if (ret) {
588     return ret;
589   } else {
590     /* STEP 2: If the type hasn't been found, do a complete search
591        of the str field (the human readable name) */
592     swig_module_info *iter = start;
593     do {
594       register size_t i = 0;
595       for (; i < iter->size; ++i) {
596         if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
597           return iter->types[i];
598       }
599       iter = iter->next;
600     } while (iter != end);
601   }
602   
603   /* neither found a match */
604   return 0;
605 }
606
607 /* 
608    Pack binary data into a string
609 */
610 SWIGRUNTIME char *
611 SWIG_PackData(char *c, void *ptr, size_t sz) {
612   static const char hex[17] = "0123456789abcdef";
613   register const unsigned char *u = (unsigned char *) ptr;
614   register const unsigned char *eu =  u + sz;
615   for (; u != eu; ++u) {
616     register unsigned char uu = *u;
617     *(c++) = hex[(uu & 0xf0) >> 4];
618     *(c++) = hex[uu & 0xf];
619   }
620   return c;
621 }
622
623 /* 
624    Unpack binary data from a string
625 */
626 SWIGRUNTIME const char *
627 SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
628   register unsigned char *u = (unsigned char *) ptr;
629   register const unsigned char *eu = u + sz;
630   for (; u != eu; ++u) {
631     register char d = *(c++);
632     register unsigned char uu;
633     if ((d >= '0') && (d <= '9'))
634       uu = ((d - '0') << 4);
635     else if ((d >= 'a') && (d <= 'f'))
636       uu = ((d - ('a'-10)) << 4);
637     else 
638       return (char *) 0;
639     d = *(c++);
640     if ((d >= '0') && (d <= '9'))
641       uu |= (d - '0');
642     else if ((d >= 'a') && (d <= 'f'))
643       uu |= (d - ('a'-10));
644     else 
645       return (char *) 0;
646     *u = uu;
647   }
648   return c;
649 }
650
651 /* 
652    Pack 'void *' into a string buffer.
653 */
654 SWIGRUNTIME char *
655 SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
656   char *r = buff;
657   if ((2*sizeof(void *) + 2) > bsz) return 0;
658   *(r++) = '_';
659   r = SWIG_PackData(r,&ptr,sizeof(void *));
660   if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
661   strcpy(r,name);
662   return buff;
663 }
664
665 SWIGRUNTIME const char *
666 SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
667   if (*c != '_') {
668     if (strcmp(c,"NULL") == 0) {
669       *ptr = (void *) 0;
670       return name;
671     } else {
672       return 0;
673     }
674   }
675   return SWIG_UnpackData(++c,ptr,sizeof(void *));
676 }
677
678 SWIGRUNTIME char *
679 SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
680   char *r = buff;
681   size_t lname = (name ? strlen(name) : 0);
682   if ((2*sz + 2 + lname) > bsz) return 0;
683   *(r++) = '_';
684   r = SWIG_PackData(r,ptr,sz);
685   if (lname) {
686     strncpy(r,name,lname+1);
687   } else {
688     *r = 0;
689   }
690   return buff;
691 }
692
693 SWIGRUNTIME const char *
694 SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
695   if (*c != '_') {
696     if (strcmp(c,"NULL") == 0) {
697       memset(ptr,0,sz);
698       return name;
699     } else {
700       return 0;
701     }
702   }
703   return SWIG_UnpackData(++c,ptr,sz);
704 }
705
706 #ifdef __cplusplus
707 }
708 #endif
709
710 /*  Errors in SWIG */
711 #define  SWIG_UnknownError         -1 
712 #define  SWIG_IOError              -2 
713 #define  SWIG_RuntimeError         -3 
714 #define  SWIG_IndexError           -4 
715 #define  SWIG_TypeError            -5 
716 #define  SWIG_DivisionByZero       -6 
717 #define  SWIG_OverflowError        -7 
718 #define  SWIG_SyntaxError          -8 
719 #define  SWIG_ValueError           -9 
720 #define  SWIG_SystemError          -10
721 #define  SWIG_AttributeError       -11
722 #define  SWIG_MemoryError          -12 
723 #define  SWIG_NullReferenceError   -13
724
725
726
727 #ifdef __cplusplus
728 /* Needed on some windows machines---since MS plays funny games with the header files under C++ */
729 #include <math.h>
730 #include <stdlib.h>
731 extern "C" {
732 #endif
733 #include "EXTERN.h"
734 #include "perl.h"
735 #include "XSUB.h"
736
737 /* Add in functionality missing in older versions of Perl. Much of this is based on Devel-PPPort on cpan. */
738
739 /* Add PERL_REVISION, PERL_VERSION, PERL_SUBVERSION if missing */
740 #ifndef PERL_REVISION
741 #  if !defined(__PATCHLEVEL_H_INCLUDED__) && !(defined(PATCHLEVEL) && defined(SUBVERSION))
742 #    define PERL_PATCHLEVEL_H_IMPLICIT
743 #    include <patchlevel.h>
744 #  endif
745 #  if !(defined(PERL_VERSION) || (defined(SUBVERSION) && defined(PATCHLEVEL)))
746 #    include <could_not_find_Perl_patchlevel.h>
747 #  endif
748 #  ifndef PERL_REVISION
749 #    define PERL_REVISION       (5)
750 #    define PERL_VERSION        PATCHLEVEL
751 #    define PERL_SUBVERSION     SUBVERSION
752 #  endif
753 #endif
754
755 #if defined(WIN32) && defined(PERL_OBJECT) && !defined(PerlIO_exportFILE)
756 #define PerlIO_exportFILE(fh,fl) (FILE*)(fh)
757 #endif
758
759 #ifndef SvIOK_UV
760 # define SvIOK_UV(sv)       (SvIOK(sv) && (SvUVX(sv) == SvIVX(sv)))
761 #endif
762
763 #ifndef SvUOK
764 # define SvUOK(sv)           SvIOK_UV(sv)
765 #endif
766
767 #if ((PERL_VERSION < 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION <= 5)))
768 #  define PL_sv_undef               sv_undef
769 #  define PL_na                     na
770 #  define PL_errgv                  errgv
771 #  define PL_sv_no                  sv_no
772 #  define PL_sv_yes                 sv_yes
773 #  define PL_markstack_ptr          markstack_ptr
774 #endif
775
776 #ifndef IVSIZE
777 #  ifdef LONGSIZE
778 #    define IVSIZE LONGSIZE
779 #  else
780 #    define IVSIZE 4 /* A bold guess, but the best we can make. */
781 #  endif
782 #endif
783
784 #ifndef INT2PTR
785 #  if (IVSIZE == PTRSIZE) && (UVSIZE == PTRSIZE)
786 #    define PTRV                  UV
787 #    define INT2PTR(any,d)        (any)(d)
788 #  else
789 #    if PTRSIZE == LONGSIZE
790 #      define PTRV                unsigned long
791 #    else
792 #      define PTRV                unsigned
793 #    endif
794 #    define INT2PTR(any,d)        (any)(PTRV)(d)
795 #  endif
796
797 #  define NUM2PTR(any,d)  (any)(PTRV)(d)
798 #  define PTR2IV(p)       INT2PTR(IV,p)
799 #  define PTR2UV(p)       INT2PTR(UV,p)
800 #  define PTR2NV(p)       NUM2PTR(NV,p)
801
802 #  if PTRSIZE == LONGSIZE
803 #    define PTR2ul(p)     (unsigned long)(p)
804 #  else
805 #    define PTR2ul(p)     INT2PTR(unsigned long,p)
806 #  endif
807 #endif /* !INT2PTR */
808
809 #ifndef SvPV_nolen
810 # define SvPV_nolen(x) SvPV(x,PL_na)
811 #endif
812
813 #ifndef get_sv
814 #  define get_sv perl_get_sv
815 #endif
816
817 #ifndef ERRSV
818 #  define ERRSV get_sv("@",FALSE)
819 #endif
820
821 #ifndef pTHX_
822 #define pTHX_
823 #endif   
824
825 #include <string.h>
826 #ifdef __cplusplus
827 }
828 #endif
829
830 /* -----------------------------------------------------------------------------
831  * error manipulation
832  * ----------------------------------------------------------------------------- */
833
834 SWIGINTERN const char*
835 SWIG_Perl_ErrorType(int code) {
836   const char* type = 0;
837   switch(code) {
838   case SWIG_MemoryError:
839     type = "MemoryError";
840     break;
841   case SWIG_IOError:
842     type = "IOError";
843     break;
844   case SWIG_RuntimeError:
845     type = "RuntimeError";
846     break;
847   case SWIG_IndexError:
848     type = "IndexError";
849     break;
850   case SWIG_TypeError:
851     type = "TypeError";
852     break;
853   case SWIG_DivisionByZero:
854     type = "ZeroDivisionError";
855     break;
856   case SWIG_OverflowError:
857     type = "OverflowError";
858     break;
859   case SWIG_SyntaxError:
860     type = "SyntaxError";
861     break;
862   case SWIG_ValueError:
863     type = "ValueError";
864     break;
865   case SWIG_SystemError:
866     type = "SystemError";
867     break;
868   case SWIG_AttributeError:
869     type = "AttributeError";
870     break;
871   default:
872     type = "RuntimeError";
873   }
874   return type;
875 }
876
877
878
879
880 /* -----------------------------------------------------------------------------
881  * perlrun.swg
882  *
883  * This file contains the runtime support for Perl modules
884  * and includes code for managing global variables and pointer
885  * type checking.
886  * ----------------------------------------------------------------------------- */
887
888 #ifdef PERL_OBJECT
889 #define SWIG_PERL_OBJECT_DECL CPerlObj *SWIGUNUSEDPARM(pPerl),
890 #define SWIG_PERL_OBJECT_CALL pPerl,
891 #else
892 #define SWIG_PERL_OBJECT_DECL
893 #define SWIG_PERL_OBJECT_CALL
894 #endif
895
896 /* Common SWIG API */
897
898 /* for raw pointers */
899 #define SWIG_ConvertPtr(obj, pp, type, flags)           SWIG_Perl_ConvertPtr(SWIG_PERL_OBJECT_CALL obj, pp, type, flags)
900 #define SWIG_NewPointerObj(p, type, flags)              SWIG_Perl_NewPointerObj(SWIG_PERL_OBJECT_CALL p, type, flags)
901
902 /* for raw packed data */
903 #define SWIG_ConvertPacked(obj, p, s, type)             SWIG_Perl_ConvertPacked(SWIG_PERL_OBJECT_CALL obj, p, s, type)
904 #define SWIG_NewPackedObj(p, s, type)                   SWIG_Perl_NewPackedObj(SWIG_PERL_OBJECT_CALL p, s, type)
905
906 /* for class or struct pointers */
907 #define SWIG_ConvertInstance(obj, pptr, type, flags)    SWIG_ConvertPtr(obj, pptr, type, flags)
908 #define SWIG_NewInstanceObj(ptr, type, flags)           SWIG_NewPointerObj(ptr, type, flags)
909
910 /* for C or C++ function pointers */
911 #define SWIG_ConvertFunctionPtr(obj, pptr, type)        SWIG_ConvertPtr(obj, pptr, type, 0)
912 #define SWIG_NewFunctionPtrObj(ptr, type)               SWIG_NewPointerObj(ptr, type, 0)
913
914 /* for C++ member pointers, ie, member methods */
915 #define SWIG_ConvertMember(obj, ptr, sz, ty)            SWIG_ConvertPacked(obj, ptr, sz, ty)
916 #define SWIG_NewMemberObj(ptr, sz, type)                SWIG_NewPackedObj(ptr, sz, type)
917
918
919 /* Runtime API */
920
921 #define SWIG_GetModule(clientdata)                      SWIG_Perl_GetModule()
922 #define SWIG_SetModule(clientdata, pointer)             SWIG_Perl_SetModule(pointer)
923
924
925 /* Error manipulation */
926
927 #define SWIG_ErrorType(code)                            SWIG_Perl_ErrorType(code)               
928 #define SWIG_Error(code, msg)                           sv_setpvf(GvSV(PL_errgv),"%s %s\n", SWIG_ErrorType(code), msg)
929 #define SWIG_fail                                       goto fail                                                   
930
931 /* Perl-specific SWIG API */
932
933 #define SWIG_MakePtr(sv, ptr, type, flags)              SWIG_Perl_MakePtr(SWIG_PERL_OBJECT_CALL sv, ptr, type, flags)
934 #define SWIG_MakePackedObj(sv, p, s, type)              SWIG_Perl_MakePackedObj(SWIG_PERL_OBJECT_CALL sv, p, s, type)
935 #define SWIG_SetError(str)                              SWIG_Error(SWIG_RuntimeError, str)
936
937
938 #define SWIG_PERL_DECL_ARGS_1(arg1)                     (SWIG_PERL_OBJECT_DECL arg1)
939 #define SWIG_PERL_CALL_ARGS_1(arg1)                     (SWIG_PERL_OBJECT_CALL arg1)
940 #define SWIG_PERL_DECL_ARGS_2(arg1, arg2)               (SWIG_PERL_OBJECT_DECL arg1, arg2)
941 #define SWIG_PERL_CALL_ARGS_2(arg1, arg2)               (SWIG_PERL_OBJECT_CALL arg1, arg2)
942
943 /* -----------------------------------------------------------------------------
944  * pointers/data manipulation
945  * ----------------------------------------------------------------------------- */
946
947 /* For backward compatibility only */
948 #define SWIG_POINTER_EXCEPTION  0
949
950 #ifdef __cplusplus
951 extern "C" {
952 #endif
953
954 #define SWIG_OWNER   SWIG_POINTER_OWN
955 #define SWIG_SHADOW  SWIG_OWNER << 1
956
957 #define SWIG_MAYBE_PERL_OBJECT SWIG_PERL_OBJECT_DECL
958
959 /* SWIG Perl macros */
960
961 /* Macro to declare an XS function */
962 #ifndef XSPROTO
963 #   define XSPROTO(name) void name(pTHX_ CV* cv)
964 #endif
965
966 /* Macro to call an XS function */
967 #ifdef PERL_OBJECT 
968 #  define SWIG_CALLXS(_name) _name(cv,pPerl) 
969 #else 
970 #  ifndef MULTIPLICITY 
971 #    define SWIG_CALLXS(_name) _name(cv) 
972 #  else 
973 #    define SWIG_CALLXS(_name) _name(PERL_GET_THX, cv) 
974 #  endif 
975 #endif 
976
977 #ifdef PERL_OBJECT
978 #define MAGIC_PPERL  CPerlObj *pPerl = (CPerlObj *) this;
979
980 #ifdef __cplusplus
981 extern "C" {
982 #endif
983 typedef int (CPerlObj::*SwigMagicFunc)(SV *, MAGIC *);
984 #ifdef __cplusplus
985 }
986 #endif
987
988 #define SWIG_MAGIC(a,b) (SV *a, MAGIC *b)
989 #define SWIGCLASS_STATIC
990
991 #else /* PERL_OBJECT */
992
993 #define MAGIC_PPERL
994 #define SWIGCLASS_STATIC static SWIGUNUSED
995
996 #ifndef MULTIPLICITY
997 #define SWIG_MAGIC(a,b) (SV *a, MAGIC *b)
998
999 #ifdef __cplusplus
1000 extern "C" {
1001 #endif
1002 typedef int (*SwigMagicFunc)(SV *, MAGIC *);
1003 #ifdef __cplusplus
1004 }
1005 #endif
1006
1007 #else /* MULTIPLICITY */
1008
1009 #define SWIG_MAGIC(a,b) (struct interpreter *interp, SV *a, MAGIC *b)
1010
1011 #ifdef __cplusplus
1012 extern "C" {
1013 #endif
1014 typedef int (*SwigMagicFunc)(struct interpreter *, SV *, MAGIC *);
1015 #ifdef __cplusplus
1016 }
1017 #endif
1018
1019 #endif /* MULTIPLICITY */
1020 #endif /* PERL_OBJECT */
1021
1022 /* Workaround for bug in perl 5.6.x croak and earlier */
1023 #if (PERL_VERSION < 8)
1024 #  ifdef PERL_OBJECT
1025 #    define SWIG_croak_null() SWIG_Perl_croak_null(pPerl)
1026 static void SWIG_Perl_croak_null(CPerlObj *pPerl)
1027 #  else
1028 static void SWIG_croak_null()
1029 #  endif
1030 {
1031   SV *err=ERRSV;
1032 #  if (PERL_VERSION < 6)
1033   croak("%_", err);
1034 #  else
1035   if (SvOK(err) && !SvROK(err)) croak("%_", err);
1036   croak(Nullch);
1037 #  endif
1038 }
1039 #else
1040 #  define SWIG_croak_null() croak(Nullch)
1041 #endif
1042
1043
1044 /* 
1045    Define how strict is the cast between strings and integers/doubles
1046    when overloading between these types occurs.
1047    
1048    The default is making it as strict as possible by using SWIG_AddCast
1049    when needed.
1050    
1051    You can use -DSWIG_PERL_NO_STRICT_STR2NUM at compilation time to
1052    disable the SWIG_AddCast, making the casting between string and
1053    numbers less strict.
1054
1055    In the end, we try to solve the overloading between strings and
1056    numerical types in the more natural way, but if you can avoid it,
1057    well, avoid it using %rename, for example.
1058 */
1059 #ifndef SWIG_PERL_NO_STRICT_STR2NUM
1060 # ifndef SWIG_PERL_STRICT_STR2NUM
1061 #  define SWIG_PERL_STRICT_STR2NUM
1062 # endif
1063 #endif
1064 #ifdef SWIG_PERL_STRICT_STR2NUM
1065 /* string takes precedence */
1066 #define SWIG_Str2NumCast(x) SWIG_AddCast(x)  
1067 #else
1068 /* number takes precedence */
1069 #define SWIG_Str2NumCast(x) x
1070 #endif
1071
1072
1073
1074 #include <stdlib.h>
1075
1076 SWIGRUNTIME const char *
1077 SWIG_Perl_TypeProxyName(const swig_type_info *type) {
1078   if (!type) return NULL;
1079   if (type->clientdata != NULL) {
1080     return (const char*) type->clientdata;
1081   } 
1082   else {
1083     return type->name;
1084   }
1085 }
1086
1087 /* Identical to SWIG_TypeCheck, except for strcmp comparison */
1088 SWIGRUNTIME swig_cast_info *
1089 SWIG_TypeProxyCheck(const char *c, swig_type_info *ty) {
1090   if (ty) {
1091     swig_cast_info *iter = ty->cast;
1092     while (iter) {
1093       if ( (!iter->type->clientdata && (strcmp(iter->type->name, c) == 0)) ||
1094             (iter->type->clientdata && (strcmp((char*)iter->type->clientdata, c) == 0)) ) {
1095         if (iter == ty->cast)
1096           return iter;
1097         /* Move iter to the top of the linked list */
1098         iter->prev->next = iter->next;
1099         if (iter->next)
1100           iter->next->prev = iter->prev;
1101         iter->next = ty->cast;
1102         iter->prev = 0;
1103         if (ty->cast) ty->cast->prev = iter;
1104         ty->cast = iter;
1105         return iter;
1106       }
1107       iter = iter->next;
1108     }
1109   }
1110   return 0;
1111 }
1112
1113 /* Function for getting a pointer value */
1114
1115 SWIGRUNTIME int
1116 SWIG_Perl_ConvertPtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void **ptr, swig_type_info *_t, int flags) {
1117   swig_cast_info *tc;
1118   void *voidptr = (void *)0;
1119   SV *tsv = 0;
1120   /* If magical, apply more magic */
1121   if (SvGMAGICAL(sv))
1122     mg_get(sv);
1123
1124   /* Check to see if this is an object */
1125   if (sv_isobject(sv)) {
1126     IV tmp = 0;
1127     tsv = (SV*) SvRV(sv);
1128     if ((SvTYPE(tsv) == SVt_PVHV)) {
1129       MAGIC *mg;
1130       if (SvMAGICAL(tsv)) {
1131         mg = mg_find(tsv,'P');
1132         if (mg) {
1133           sv = mg->mg_obj;
1134           if (sv_isobject(sv)) {
1135             tsv = (SV*)SvRV(sv);
1136             tmp = SvIV(tsv);
1137           }
1138         }
1139       } else {
1140         return SWIG_ERROR;
1141       }
1142     } else {
1143       tmp = SvIV(tsv);
1144     }
1145     voidptr = INT2PTR(void *,tmp);
1146   } else if (! SvOK(sv)) {            /* Check for undef */
1147     *(ptr) = (void *) 0;
1148     return SWIG_OK;
1149   } else if (SvTYPE(sv) == SVt_RV) {  /* Check for NULL pointer */
1150     if (!SvROK(sv)) {
1151       *(ptr) = (void *) 0;
1152       return SWIG_OK;
1153     } else {
1154       return SWIG_ERROR;
1155     }
1156   } else {                            /* Don't know what it is */
1157     return SWIG_ERROR;
1158   }
1159   if (_t) {
1160     /* Now see if the types match */
1161     char *_c = HvNAME(SvSTASH(SvRV(sv)));
1162     tc = SWIG_TypeProxyCheck(_c,_t);
1163     if (!tc) {
1164       return SWIG_ERROR;
1165     }
1166     {
1167       int newmemory = 0;
1168       *ptr = SWIG_TypeCast(tc,voidptr,&newmemory);
1169       assert(!newmemory); /* newmemory handling not yet implemented */
1170     }
1171   } else {
1172     *ptr = voidptr;
1173   }
1174
1175   /* 
1176    *  DISOWN implementation: we need a perl guru to check this one.
1177    */
1178   if (tsv && (flags & SWIG_POINTER_DISOWN)) {
1179     /* 
1180      *  almost copy paste code from below SWIG_POINTER_OWN setting
1181      */
1182     SV *obj = sv;
1183     HV *stash = SvSTASH(SvRV(obj));
1184     GV *gv = *(GV**) hv_fetch(stash, "OWNER", 5, TRUE);
1185     if (isGV(gv)) {
1186       HV *hv = GvHVn(gv);
1187       /*
1188        * To set ownership (see below), a newSViv(1) entry is added. 
1189        * Hence, to remove ownership, we delete the entry.
1190        */
1191       if (hv_exists_ent(hv, obj, 0)) {
1192         hv_delete_ent(hv, obj, 0, 0);
1193       }
1194     }
1195   }
1196   return SWIG_OK;
1197 }
1198
1199 SWIGRUNTIME void
1200 SWIG_Perl_MakePtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void *ptr, swig_type_info *t, int flags) {
1201   if (ptr && (flags & SWIG_SHADOW)) {
1202     SV *self;
1203     SV *obj=newSV(0);
1204     HV *hash=newHV();
1205     HV *stash;
1206     sv_setref_pv(obj, (char *) SWIG_Perl_TypeProxyName(t), ptr);
1207     stash=SvSTASH(SvRV(obj));
1208     if (flags & SWIG_POINTER_OWN) {
1209       HV *hv;
1210       GV *gv=*(GV**)hv_fetch(stash, "OWNER", 5, TRUE);
1211       if (!isGV(gv))
1212         gv_init(gv, stash, "OWNER", 5, FALSE);
1213       hv=GvHVn(gv);
1214       hv_store_ent(hv, obj, newSViv(1), 0);
1215     }
1216     sv_magic((SV *)hash, (SV *)obj, 'P', Nullch, 0);
1217     SvREFCNT_dec(obj);
1218     self=newRV_noinc((SV *)hash);
1219     sv_setsv(sv, self);
1220     SvREFCNT_dec((SV *)self);
1221     sv_bless(sv, stash);
1222   }
1223   else {
1224     sv_setref_pv(sv, (char *) SWIG_Perl_TypeProxyName(t), ptr);
1225   }
1226 }
1227
1228 SWIGRUNTIMEINLINE SV *
1229 SWIG_Perl_NewPointerObj(SWIG_MAYBE_PERL_OBJECT void *ptr, swig_type_info *t, int flags) {
1230   SV *result = sv_newmortal();
1231   SWIG_MakePtr(result, ptr, t, flags);
1232   return result;
1233 }
1234
1235 SWIGRUNTIME void
1236 SWIG_Perl_MakePackedObj(SWIG_MAYBE_PERL_OBJECT SV *sv, void *ptr, int sz, swig_type_info *type) {
1237   char result[1024];
1238   char *r = result;
1239   if ((2*sz + 1 + strlen(SWIG_Perl_TypeProxyName(type))) > 1000) return;
1240   *(r++) = '_';
1241   r = SWIG_PackData(r,ptr,sz);
1242   strcpy(r,SWIG_Perl_TypeProxyName(type));
1243   sv_setpv(sv, result);
1244 }
1245
1246 SWIGRUNTIME SV *
1247 SWIG_Perl_NewPackedObj(SWIG_MAYBE_PERL_OBJECT void *ptr, int sz, swig_type_info *type) {
1248   SV *result = sv_newmortal();
1249   SWIG_Perl_MakePackedObj(result, ptr, sz, type);
1250   return result;
1251 }
1252
1253 /* Convert a packed value value */
1254 SWIGRUNTIME int
1255 SWIG_Perl_ConvertPacked(SWIG_MAYBE_PERL_OBJECT SV *obj, void *ptr, int sz, swig_type_info *ty) {
1256   swig_cast_info *tc;
1257   const char  *c = 0;
1258
1259   if ((!obj) || (!SvOK(obj))) return SWIG_ERROR;
1260   c = SvPV_nolen(obj);
1261   /* Pointer values must start with leading underscore */
1262   if (*c != '_') return SWIG_ERROR;
1263   c++;
1264   c = SWIG_UnpackData(c,ptr,sz);
1265   if (ty) {
1266     tc = SWIG_TypeCheck(c,ty);
1267     if (!tc) return SWIG_ERROR;
1268   }
1269   return SWIG_OK;
1270 }
1271
1272
1273 /* Macros for low-level exception handling */
1274 #define SWIG_croak(x)    { SWIG_Error(SWIG_RuntimeError, x); SWIG_fail; }
1275
1276
1277 typedef XSPROTO(SwigPerlWrapper);
1278 typedef SwigPerlWrapper *SwigPerlWrapperPtr;
1279
1280 /* Structure for command table */
1281 typedef struct {
1282   const char         *name;
1283   SwigPerlWrapperPtr  wrapper;
1284 } swig_command_info;
1285
1286 /* Information for constant table */
1287
1288 #define SWIG_INT     1
1289 #define SWIG_FLOAT   2
1290 #define SWIG_STRING  3
1291 #define SWIG_POINTER 4
1292 #define SWIG_BINARY  5
1293
1294 /* Constant information structure */
1295 typedef struct swig_constant_info {
1296     int              type;
1297     const char      *name;
1298     long             lvalue;
1299     double           dvalue;
1300     void            *pvalue;
1301     swig_type_info **ptype;
1302 } swig_constant_info;
1303
1304
1305 /* Structure for variable table */
1306 typedef struct {
1307   const char   *name;
1308   SwigMagicFunc   set;
1309   SwigMagicFunc   get;
1310   swig_type_info  **type;
1311 } swig_variable_info;
1312
1313 /* Magic variable code */
1314 #ifndef PERL_OBJECT
1315 #define swig_create_magic(s,a,b,c) _swig_create_magic(s,a,b,c)
1316   #ifndef MULTIPLICITY
1317      SWIGRUNTIME void _swig_create_magic(SV *sv, char *name, int (*set)(SV *, MAGIC *), int (*get)(SV *,MAGIC *)) 
1318   #else
1319      SWIGRUNTIME void _swig_create_magic(SV *sv, char *name, int (*set)(struct interpreter*, SV *, MAGIC *), int (*get)(struct interpreter*, SV *,MAGIC *)) 
1320   #endif
1321 #else
1322 #  define swig_create_magic(s,a,b,c) _swig_create_magic(pPerl,s,a,b,c)
1323 SWIGRUNTIME void _swig_create_magic(CPerlObj *pPerl, SV *sv, const char *name, int (CPerlObj::*set)(SV *, MAGIC *), int (CPerlObj::*get)(SV *, MAGIC *)) 
1324 #endif
1325 {
1326   MAGIC *mg;
1327   sv_magic(sv,sv,'U',(char *) name,strlen(name));
1328   mg = mg_find(sv,'U');
1329   mg->mg_virtual = (MGVTBL *) malloc(sizeof(MGVTBL));
1330   mg->mg_virtual->svt_get = (SwigMagicFunc) get;
1331   mg->mg_virtual->svt_set = (SwigMagicFunc) set;
1332   mg->mg_virtual->svt_len = 0;
1333   mg->mg_virtual->svt_clear = 0;
1334   mg->mg_virtual->svt_free = 0;
1335 }
1336
1337
1338 SWIGRUNTIME swig_module_info *
1339 SWIG_Perl_GetModule(void) {
1340   static void *type_pointer = (void *)0;
1341   SV *pointer;
1342
1343   /* first check if pointer already created */
1344   if (!type_pointer) {
1345     pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, FALSE | GV_ADDMULTI);
1346     if (pointer && SvOK(pointer)) {
1347       type_pointer = INT2PTR(swig_type_info **, SvIV(pointer));
1348     }
1349   }
1350
1351   return (swig_module_info *) type_pointer;
1352 }
1353
1354 SWIGRUNTIME void
1355 SWIG_Perl_SetModule(swig_module_info *module) {
1356   SV *pointer;
1357
1358   /* create a new pointer */
1359   pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, TRUE | GV_ADDMULTI);
1360   sv_setiv(pointer, PTR2IV(module));
1361 }
1362
1363 #ifdef __cplusplus
1364 }
1365 #endif
1366
1367 /* Workaround perl5 global namespace pollution. Note that undefining library
1368  * functions like fopen will not solve the problem on all platforms as fopen
1369  * might be a macro on Windows but not necessarily on other operating systems. */
1370 #ifdef do_open
1371   #undef do_open
1372 #endif
1373 #ifdef do_close
1374   #undef do_close
1375 #endif
1376 #ifdef scalar
1377   #undef scalar
1378 #endif
1379 #ifdef list
1380   #undef list
1381 #endif
1382 #ifdef apply
1383   #undef apply
1384 #endif
1385 #ifdef convert
1386   #undef convert
1387 #endif
1388 #ifdef Error
1389   #undef Error
1390 #endif
1391 #ifdef form
1392   #undef form
1393 #endif
1394 #ifdef vform
1395   #undef vform
1396 #endif
1397 #ifdef LABEL
1398   #undef LABEL
1399 #endif
1400 #ifdef METHOD
1401   #undef METHOD
1402 #endif
1403 #ifdef Move
1404   #undef Move
1405 #endif
1406 #ifdef yylex
1407   #undef yylex
1408 #endif
1409 #ifdef yyparse
1410   #undef yyparse
1411 #endif
1412 #ifdef yyerror
1413   #undef yyerror
1414 #endif
1415 #ifdef invert
1416   #undef invert
1417 #endif
1418 #ifdef ref
1419   #undef ref
1420 #endif
1421 #ifdef read
1422   #undef read
1423 #endif
1424 #ifdef write
1425   #undef write
1426 #endif
1427 #ifdef eof
1428   #undef eof
1429 #endif
1430 #ifdef bool
1431   #undef bool
1432 #endif
1433 #ifdef close
1434   #undef close
1435 #endif
1436 #ifdef rewind
1437   #undef rewind
1438 #endif
1439 #ifdef free
1440   #undef free
1441 #endif
1442 #ifdef malloc
1443   #undef malloc
1444 #endif
1445 #ifdef calloc
1446   #undef calloc
1447 #endif
1448 #ifdef Stat
1449   #undef Stat
1450 #endif
1451 #ifdef check
1452   #undef check
1453 #endif
1454 #ifdef seekdir
1455   #undef seekdir
1456 #endif
1457 #ifdef open
1458   #undef open
1459 #endif
1460 #ifdef readdir
1461   #undef readdir
1462 #endif
1463 #ifdef bind
1464   #undef bind
1465 #endif
1466
1467
1468
1469 #define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) 
1470
1471 #define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else 
1472
1473
1474
1475   #define SWIG_exception(code, msg) do { SWIG_Error(code, msg); SWIG_fail;; } while(0) 
1476
1477
1478 /* -------- TYPES TABLE (BEGIN) -------- */
1479
1480 #define SWIGTYPE_p_Device swig_types[0]
1481 #define SWIGTYPE_p_DevicePropertyBase swig_types[1]
1482 #define SWIGTYPE_p_DirectTCPAddr swig_types[2]
1483 #define SWIGTYPE_p_DirectTCPConnection swig_types[3]
1484 #define SWIGTYPE_p_GSList swig_types[4]
1485 #define SWIGTYPE_p_GValue swig_types[5]
1486 #define SWIGTYPE_p_a_STRMAX__char swig_types[6]
1487 #define SWIGTYPE_p_char swig_types[7]
1488 #define SWIGTYPE_p_double swig_types[8]
1489 #define SWIGTYPE_p_dumpfile_t swig_types[9]
1490 #define SWIGTYPE_p_float swig_types[10]
1491 #define SWIGTYPE_p_guint swig_types[11]
1492 #define SWIGTYPE_p_guint32 swig_types[12]
1493 #define SWIGTYPE_p_guint64 swig_types[13]
1494 #define SWIGTYPE_p_int swig_types[14]
1495 #define SWIGTYPE_p_p_DirectTCPAddr swig_types[15]
1496 #define SWIGTYPE_p_unsigned_char swig_types[16]
1497 static swig_type_info *swig_types[18];
1498 static swig_module_info swig_module = {swig_types, 17, 0, 0, 0, 0};
1499 #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
1500 #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
1501
1502 /* -------- TYPES TABLE (END) -------- */
1503
1504 #define SWIG_init    boot_Amanda__Device
1505
1506 #define SWIG_name   "Amanda::Devicec::boot_Amanda__Device"
1507 #define SWIG_prefix "Amanda::Devicec::"
1508
1509 #define SWIGVERSION 0x010339 
1510 #define SWIG_VERSION SWIGVERSION
1511
1512
1513 #define SWIG_as_voidptr(a) (void *)((const void *)(a)) 
1514 #define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),(void**)(a)) 
1515
1516
1517 #ifdef __cplusplus
1518 extern "C"
1519 #endif
1520 #ifndef PERL_OBJECT
1521 #ifndef MULTIPLICITY
1522 SWIGEXPORT void SWIG_init (CV* cv);
1523 #else
1524 SWIGEXPORT void SWIG_init (pTHXo_ CV* cv);
1525 #endif
1526 #else
1527 SWIGEXPORT void SWIG_init (CV *cv, CPerlObj *);
1528 #endif
1529
1530
1531 #include "amglue.h"
1532
1533
1534 #include "amglue.h"
1535
1536
1537 #include "amglue.h"
1538
1539
1540 #include "device.h"
1541 #include "property.h"
1542 #include "fileheader.h"
1543 #include "glib-util.h"
1544 #include "simpleprng.h"
1545
1546
1547
1548 /* Utility functions for typemaps, below */
1549
1550 /* return a new, mortal SV corresponding to the given GValue
1551  *
1552  * @param value: the value to convert
1553  * @returns: a new, mortal SV
1554  */
1555 static SV *
1556 set_sv_from_gvalue(GValue *value)
1557 {
1558     GType fundamental = G_TYPE_FUNDAMENTAL(G_VALUE_TYPE(value));
1559     SV *sv = NULL;
1560
1561     /* complex reference types */
1562     switch (fundamental) {
1563         case G_TYPE_LONG:
1564             return sv_2mortal(amglue_newSVi64(g_value_get_long(value)));
1565
1566         case G_TYPE_ULONG:
1567             return sv_2mortal(amglue_newSVu64(g_value_get_ulong(value)));
1568
1569         case G_TYPE_INT64:
1570             return sv_2mortal(amglue_newSVi64(g_value_get_int64(value)));
1571
1572         case G_TYPE_UINT64:
1573             return sv_2mortal(amglue_newSVu64(g_value_get_uint64(value)));
1574     }
1575
1576     /* simple types that can be constructed with sv_set*v */
1577     sv = sv_newmortal();
1578     switch (fundamental) {
1579         case G_TYPE_CHAR:
1580             sv_setiv(sv, g_value_get_char(value));
1581             break;
1582
1583         case G_TYPE_UCHAR:
1584             sv_setuv(sv, g_value_get_uchar(value));
1585             break;
1586
1587         case G_TYPE_BOOLEAN:
1588             sv_setiv(sv, g_value_get_boolean(value));
1589             break;
1590
1591         case G_TYPE_INT:
1592             sv_setiv(sv, g_value_get_int(value));
1593             break;
1594
1595         case G_TYPE_UINT:
1596             sv_setuv(sv, g_value_get_uint(value));
1597             break;
1598
1599         case G_TYPE_FLOAT:
1600             sv_setnv(sv, g_value_get_float(value));
1601             break;
1602
1603         case G_TYPE_DOUBLE:
1604             sv_setnv(sv, g_value_get_double(value));
1605             break;
1606
1607         case G_TYPE_STRING:
1608             sv_setpv(sv, g_value_get_string(value));
1609             break;
1610
1611         case G_TYPE_ENUM:
1612             sv_setiv(sv, g_value_get_enum(value));
1613             break;
1614
1615         case G_TYPE_FLAGS:
1616             sv_setiv(sv, g_value_get_flags(value));
1617             break;
1618
1619         /* Unsupported */
1620         default:
1621         case G_TYPE_POINTER:
1622         case G_TYPE_INTERFACE:
1623         case G_TYPE_OBJECT:
1624         case G_TYPE_PARAM:
1625             warn("Unsupported fundamental property type #%d", (int)fundamental);
1626             sv_setsv(sv, &PL_sv_undef);
1627             break;
1628     }
1629
1630     return sv;
1631 }
1632
1633 /* Given an SV and an initialized GValue, set the GValue to the value
1634  * represented by the SV.  The GValue's type must already be set.
1635  *
1636  * For basic corresponding types (string -> string, integer -> integer),
1637  * the translation is straightforward.  However, if the GValue is not a
1638  * string, but the SV has a string value, then g_value_set_from_string will
1639  * be used to parse the string.
1640  *
1641  * @param sv: SV to convert
1642  * @param value: (input/output) destination
1643  * @returns: TRUE on success
1644  */
1645 static gboolean
1646 set_gvalue_from_sv(SV *sv, GValue *value)
1647 {
1648     GType fundamental = G_TYPE_FUNDAMENTAL(G_VALUE_TYPE(value));
1649
1650     /* if we got a string, use g_value_set_from_string to parse any funny
1651      * values or suffixes */
1652     if (SvPOK(sv)) {
1653         if (g_value_set_from_string(value, SvPV_nolen(sv)))
1654             return TRUE;
1655     }
1656
1657     /* otherwise, handle numeric types with SvIV, SvNV, or the amglue_* functions */
1658     switch (fundamental) {
1659         case G_TYPE_BOOLEAN:
1660             g_value_set_boolean(value, SvIV(sv));
1661             return TRUE;
1662
1663         case G_TYPE_CHAR:
1664             g_value_set_char(value, amglue_SvI8(sv));
1665             return TRUE;
1666
1667         case G_TYPE_UCHAR:
1668             g_value_set_uchar(value, amglue_SvU8(sv));
1669             return TRUE;
1670
1671         case G_TYPE_INT:
1672             g_value_set_int(value, amglue_SvI32(sv));
1673             return TRUE;
1674
1675         case G_TYPE_UINT:
1676             g_value_set_uint(value, amglue_SvU32(sv));
1677             return TRUE;
1678
1679         case G_TYPE_LONG:
1680             g_value_set_int64(value, amglue_SvI64(sv));
1681             return TRUE;
1682
1683         case G_TYPE_ULONG:
1684             g_value_set_uint64(value, amglue_SvU64(sv));
1685             return TRUE;
1686
1687         case G_TYPE_INT64:
1688             g_value_set_int64(value, amglue_SvI64(sv));
1689             return TRUE;
1690
1691         case G_TYPE_UINT64:
1692             g_value_set_uint64(value, amglue_SvU64(sv));
1693             return TRUE;
1694
1695         case G_TYPE_FLOAT:
1696             g_value_set_float(value, SvNV(sv));
1697             return TRUE;
1698
1699         case G_TYPE_DOUBLE:
1700             g_value_set_double(value, SvNV(sv));
1701             return TRUE;
1702
1703         case G_TYPE_ENUM:
1704             g_value_set_enum(value, SvIV(sv));
1705             return TRUE;
1706
1707         case G_TYPE_FLAGS:
1708             g_value_set_flags(value, SvIV(sv));
1709             return TRUE;
1710
1711         default:
1712             /* for anything else, let perl stringify it for us and try parsing it */
1713             return g_value_set_from_string(value, SvPV_nolen(sv));
1714     }
1715 }
1716
1717
1718 SWIGINTERN void delete_DirectTCPConnection(DirectTCPConnection *self){
1719             g_object_unref(self);
1720         }
1721 SWIGINTERN char *DirectTCPConnection_close(DirectTCPConnection *self){
1722             return directtcp_connection_close(self);
1723         }
1724
1725 SWIGINTERNINLINE SV *
1726 SWIG_FromCharPtrAndSize(const char* carray, size_t size)
1727 {
1728   SV *obj = sv_newmortal();
1729   if (carray) {
1730     sv_setpvn(obj, carray, size);
1731   } else {
1732     sv_setsv(obj, &PL_sv_undef);
1733   }
1734   return obj;
1735 }
1736
1737
1738 SWIGINTERNINLINE SV * 
1739 SWIG_FromCharPtr(const char *cptr)
1740
1741   return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0));
1742 }
1743
1744
1745 SWIGINTERN swig_type_info*
1746 SWIG_pchar_descriptor(void)
1747 {
1748   static int init = 0;
1749   static swig_type_info* info = 0;
1750   if (!init) {
1751     info = SWIG_TypeQuery("_p_char");
1752     init = 1;
1753   }
1754   return info;
1755 }
1756
1757
1758 SWIGINTERN int
1759 SWIG_AsCharPtrAndSize(SV *obj, char** cptr, size_t* psize, int *alloc)
1760 {
1761   if (SvMAGICAL(obj)) {
1762      SV *tmp = sv_newmortal();
1763      SvSetSV(tmp, obj);
1764      obj = tmp;
1765   }
1766   if (SvPOK(obj)) {
1767     STRLEN len = 0;
1768     char *cstr = SvPV(obj, len); 
1769     size_t size = len + 1;
1770     if (cptr)  {
1771       if (alloc) {
1772         if (*alloc == SWIG_NEWOBJ) {
1773           *cptr = (char *)memcpy((char *)malloc((size)*sizeof(char)), cstr, sizeof(char)*(size));
1774         } else {
1775           *cptr = cstr;
1776           *alloc = SWIG_OLDOBJ;
1777         }
1778       }
1779     }
1780     if (psize) *psize = size;
1781     return SWIG_OK;
1782   } else {
1783     swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
1784     if (pchar_descriptor) {
1785       char* vptr = 0; 
1786       if (SWIG_ConvertPtr(obj, (void**)&vptr, pchar_descriptor, 0) == SWIG_OK) {
1787         if (cptr) *cptr = vptr;
1788         if (psize) *psize = vptr ? (strlen(vptr) + 1) : 0;
1789         if (alloc) *alloc = SWIG_OLDOBJ;
1790         return SWIG_OK;
1791       }
1792     }
1793   }
1794   return SWIG_TypeError;
1795 }
1796
1797
1798
1799
1800 SWIGINTERN Device *new_Device(char *device_name){
1801             return device_open(device_name);
1802         }
1803 SWIGINTERN void delete_Device(Device *self){
1804             g_object_unref(self);
1805         }
1806
1807 #include <limits.h>
1808 #if !defined(SWIG_NO_LLONG_MAX)
1809 # if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__)
1810 #   define LLONG_MAX __LONG_LONG_MAX__
1811 #   define LLONG_MIN (-LLONG_MAX - 1LL)
1812 #   define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
1813 # endif
1814 #endif
1815
1816
1817 SWIGINTERN int
1818 SWIG_AsVal_double SWIG_PERL_DECL_ARGS_2(SV *obj, double *val)
1819 {
1820   if (SvNIOK(obj)) {
1821     if (val) *val = SvNV(obj);
1822     return SWIG_OK;
1823   } else if (SvIOK(obj)) {
1824     if (val) *val = (double) SvIV(obj);
1825     return SWIG_AddCast(SWIG_OK);
1826   } else {
1827     const char *nptr = SvPV_nolen(obj);
1828     if (nptr) {
1829       char *endptr;
1830       double v = strtod(nptr, &endptr);
1831       if (errno == ERANGE) {
1832         errno = 0;
1833         return SWIG_OverflowError;
1834       } else {
1835         if (*endptr == '\0') {
1836           if (val) *val = v;
1837           return SWIG_Str2NumCast(SWIG_OK);
1838         }
1839       }
1840     }
1841   }
1842   return SWIG_TypeError;
1843 }
1844
1845
1846 #include <float.h>
1847
1848
1849 #include <math.h>
1850
1851
1852 SWIGINTERNINLINE int
1853 SWIG_CanCastAsInteger(double *d, double min, double max) {
1854   double x = *d;
1855   if ((min <= x && x <= max)) {
1856    double fx = floor(x);
1857    double cx = ceil(x);
1858    double rd =  ((x - fx) < 0.5) ? fx : cx; /* simple rint */
1859    if ((errno == EDOM) || (errno == ERANGE)) {
1860      errno = 0;
1861    } else {
1862      double summ, reps, diff;
1863      if (rd < x) {
1864        diff = x - rd;
1865      } else if (rd > x) {
1866        diff = rd - x;
1867      } else {
1868        return 1;
1869      }
1870      summ = rd + x;
1871      reps = diff/summ;
1872      if (reps < 8*DBL_EPSILON) {
1873        *d = rd;
1874        return 1;
1875      }
1876    }
1877   }
1878   return 0;
1879 }
1880
1881
1882 SWIGINTERN int
1883 SWIG_AsVal_long SWIG_PERL_DECL_ARGS_2(SV *obj, long* val)
1884 {
1885   if (SvIOK(obj)) {
1886     if (val) *val = SvIV(obj);
1887     return SWIG_OK;
1888   } else {
1889     int dispatch = 0;
1890     const char *nptr = SvPV_nolen(obj);
1891     if (nptr) {
1892       char *endptr;
1893       long v;
1894       errno = 0;
1895       v = strtol(nptr, &endptr,0);
1896       if (errno == ERANGE) {
1897         errno = 0;
1898         return SWIG_OverflowError;
1899       } else {
1900         if (*endptr == '\0') {
1901           if (val) *val = v;
1902           return SWIG_Str2NumCast(SWIG_OK);
1903         }
1904       }
1905     }
1906     if (!dispatch) {
1907       double d;
1908       int res = SWIG_AddCast(SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(obj,&d));
1909       if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) {
1910         if (val) *val = (long)(d);
1911         return res;
1912       }
1913     }
1914   }
1915   return SWIG_TypeError;
1916 }
1917
1918
1919 SWIGINTERN int
1920 SWIG_AsVal_int SWIG_PERL_DECL_ARGS_2(SV * obj, int *val)
1921 {
1922   long v;
1923   int res = SWIG_AsVal_long SWIG_PERL_CALL_ARGS_2(obj, &v);
1924   if (SWIG_IsOK(res)) {
1925     if ((v < INT_MIN || v > INT_MAX)) {
1926       return SWIG_OverflowError;
1927     } else {
1928       if (val) *val = (int)(v);
1929     }
1930   }  
1931   return res;
1932 }
1933
1934 SWIGINTERN gboolean Device_configure(Device *self,gboolean use_global_config){
1935             return device_configure(self, use_global_config);
1936         }
1937 SWIGINTERN char *Device_error(Device *self){
1938             return device_error(self);
1939         }
1940 SWIGINTERN char *Device_status_error(Device *self){
1941             return device_status_error(self);
1942         }
1943 SWIGINTERN char *Device_error_or_status(Device *self){
1944             return device_error_or_status(self);
1945         }
1946 SWIGINTERN DeviceStatusFlags Device_read_label(Device *self){
1947             return device_read_label(self);
1948         }
1949 SWIGINTERN gboolean Device_start(Device *self,DeviceAccessMode mode,char *label,char *timestamp){
1950             return device_start(self, mode, label, timestamp);
1951         }
1952 SWIGINTERN gboolean Device_finish(Device *self){
1953             return device_finish(self);
1954         }
1955 SWIGINTERN gboolean Device_start_file(Device *self,dumpfile_t *jobInfo){
1956             return device_start_file(self, jobInfo);
1957         }
1958 SWIGINTERN gboolean Device_write_block(Device *self,guint size,gpointer data){
1959             return device_write_block(self, size, data);
1960         }
1961 SWIGINTERN gboolean Device_finish_file(Device *self){
1962             return device_finish_file(self);
1963         }
1964 SWIGINTERN dumpfile_t *Device_seek_file(Device *self,guint file){
1965             return device_seek_file(self, file);
1966         }
1967 SWIGINTERN gboolean Device_seek_block(Device *self,guint64 block){
1968             return device_seek_block(self, block);
1969         }
1970 SWIGINTERN int Device_read_block(Device *self,gpointer buffer,int *size){
1971             return device_read_block(self, buffer, size);
1972         }
1973 SWIGINTERN gboolean Device_erase(Device *self){
1974             return device_erase(self);
1975         }
1976 SWIGINTERN gboolean Device_eject(Device *self){
1977             return device_eject(self);
1978         }
1979 SWIGINTERN gboolean Device_directtcp_supported(Device *self){
1980             return device_directtcp_supported(self);
1981         }
1982 SWIGINTERN void Device_listen(Device *self,gboolean for_writing,DirectTCPAddr **addrs){
1983             /* ensure that the addresses are empty if there was an error */
1984             if (!device_listen(self, for_writing, addrs))
1985                 *addrs = NULL;
1986         }
1987 SWIGINTERN DirectTCPConnection *Device_accept(Device *self){
1988             DirectTCPConnection *conn = NULL;
1989             gboolean rv;
1990
1991             rv = device_accept(self, &conn, NULL, NULL);
1992             if (!rv && conn) {
1993                 /* conn is ref'd for our convenience, but we don't want it */
1994                 g_object_unref(conn);
1995                 conn = NULL;
1996             }
1997             return conn;
1998         }
1999 SWIGINTERN DirectTCPConnection *Device_connect(Device *self,gboolean for_writing,DirectTCPAddr *addrs){
2000             DirectTCPConnection *conn = NULL;
2001             gboolean rv;
2002
2003             rv = device_connect(self, for_writing, addrs, &conn, NULL, NULL);
2004             if (!rv && conn) {
2005                 /* conn is ref'd for our convenience, but we don't want it */
2006                 g_object_unref(conn);
2007                 conn = NULL;
2008             }
2009             return conn;
2010         }
2011 SWIGINTERN gboolean Device_use_connection(Device *self,DirectTCPConnection *conn){
2012             return device_use_connection(self, conn);
2013         }
2014 SWIGINTERN gboolean Device_write_from_connection(Device *self,guint64 size,guint64 *actual_size){
2015             return device_write_from_connection(self, size, actual_size);
2016         }
2017 SWIGINTERN gboolean Device_read_to_connection(Device *self,guint64 size,guint64 *actual_size){
2018             return device_read_to_connection(self, size, actual_size);
2019         }
2020 SWIGINTERN GSList const *Device_property_list(Device *self){
2021             return device_property_get_list(self);
2022         }
2023 SWIGINTERN void Device_property_get(Device *self,DevicePropertyBase *pbase,GValue *out_val,PropertySurety *surety,PropertySource *source,gboolean *val_found){
2024             if (pbase) {
2025                 *val_found = device_property_get_ex(self, pbase->ID, out_val, surety, source);
2026             } else {
2027                 *val_found = FALSE;
2028             }
2029         }
2030 SWIGINTERN gboolean Device_property_set(Device *self,DevicePropertyBase *pbase,SV *sv){
2031             GValue gval;
2032             memset(&gval, 0, sizeof(gval));
2033             g_value_init(&gval, pbase->type);
2034             if (!set_gvalue_from_sv(sv, &gval))
2035                 goto fail;
2036
2037             if (!device_property_set(self, pbase->ID, &gval))
2038                 goto fail;
2039
2040             g_value_unset(&gval);
2041             return TRUE;
2042         fail:
2043             g_value_unset(&gval);
2044             return FALSE;
2045         }
2046 SWIGINTERN gboolean Device_property_set_ex(Device *self,DevicePropertyBase *pbase,SV *sv,PropertySurety surety,PropertySource source){
2047             GValue gval;
2048             memset(&gval, 0, sizeof(gval));
2049             g_value_init(&gval, pbase->type);
2050             if (!set_gvalue_from_sv(sv, &gval))
2051                 goto fail;
2052
2053             if (!device_property_set_ex(self, pbase->ID, &gval, surety, source))
2054                 goto fail;
2055
2056             g_value_unset(&gval);
2057             return TRUE;
2058         fail:
2059             g_value_unset(&gval);
2060             return FALSE;
2061         }
2062 SWIGINTERN gboolean Device_recycle_file(Device *self,guint filenum){
2063             return device_recycle_file(self, filenum);
2064         }
2065 SWIGINTERN int Device_file(Device *self){ return self->file; }
2066 SWIGINTERN guint64 Device_block(Device *self){ return self->block; }
2067 SWIGINTERN gboolean Device_in_file(Device *self){ return self->in_file; }
2068 SWIGINTERN char *Device_device_name(Device *self){ return self->device_name; }
2069 SWIGINTERN DeviceAccessMode Device_access_mode(Device *self){ return self->access_mode; }
2070 SWIGINTERN gboolean Device_is_eof(Device *self){ return self->is_eof; }
2071 SWIGINTERN gboolean Device_is_eom(Device *self){ return self->is_eom; }
2072 SWIGINTERN char *Device_volume_label(Device *self){ return self->volume_label; }
2073 SWIGINTERN char *Device_volume_time(Device *self){ return self->volume_time; }
2074 SWIGINTERN DeviceStatusFlags Device_status(Device *self){ return self->status; }
2075 SWIGINTERN gsize Device_min_block_size(Device *self){ return self->min_block_size; }
2076 SWIGINTERN gsize Device_max_block_size(Device *self){ return self->max_block_size; }
2077 SWIGINTERN gsize Device_block_size(Device *self){ return self->block_size; }
2078 SWIGINTERN dumpfile_t *Device_volume_header(Device *self){ return self->volume_header; }
2079
2080
2081 /* write LENGTH bytes of random data to FILENAME, seeded with SEED */
2082 gboolean
2083 write_random_to_device(guint32 seed, size_t length, Device *device) {
2084     simpleprng_state_t prng;
2085     char *buf;
2086     gsize block_size = device->block_size;
2087     g_assert(block_size < G_MAXUINT);
2088
2089     buf = g_malloc(block_size);
2090     simpleprng_seed(&prng, seed);
2091
2092     while (length) {
2093         size_t to_write = min(block_size, length);
2094
2095         simpleprng_fill_buffer(&prng, buf, to_write);
2096         if (!device_write_block(device, (guint)block_size, buf)) {
2097             g_free(buf);
2098             return FALSE;
2099         }
2100         length -= to_write;
2101     }
2102
2103     g_free(buf);
2104     return TRUE;
2105 }
2106
2107 /* read LENGTH bytes of random data from FILENAME verifying it against
2108  * a PRNG seeded with SEED.  Sends any error messages to stderr.
2109  */
2110 gboolean
2111 verify_random_from_device(guint32 seed, size_t length, Device *device) {
2112     simpleprng_state_t prng;
2113     char *buf = NULL; /* first device_read_block will get the size */
2114     int block_size = 0;
2115
2116     simpleprng_seed(&prng, seed);
2117
2118     while (length) {
2119         int bytes_read;
2120         int size = block_size;
2121
2122         bytes_read = device_read_block(device, buf, &size);
2123         if (bytes_read == 0 && size > block_size) {
2124             g_free(buf);
2125             block_size = size;
2126             buf = g_malloc(block_size);
2127             continue;
2128         }
2129         if (bytes_read == -1) {
2130             if (device->status == DEVICE_STATUS_SUCCESS) {
2131                 g_assert(device->is_eof);
2132                 g_debug("verify_random_from_device got unexpected EOF");
2133             }
2134             goto error;
2135         }
2136
2137         /* strip padding */
2138         bytes_read = min(bytes_read, length);
2139
2140         if (!simpleprng_verify_buffer(&prng, buf, bytes_read))
2141             goto error;
2142
2143         length -= bytes_read;
2144     }
2145
2146     g_free(buf);
2147     return TRUE;
2148
2149 error:
2150     g_free(buf);
2151     return FALSE;
2152 }
2153
2154
2155 SWIGINTERN int
2156 SWIG_AsVal_unsigned_SS_long SWIG_PERL_DECL_ARGS_2(SV *obj, unsigned long *val) 
2157 {
2158   if (SvUOK(obj)) {
2159     if (val) *val = SvUV(obj);
2160     return SWIG_OK;
2161   } else  if (SvIOK(obj)) {
2162     long v = SvIV(obj);
2163     if (v >= 0) {
2164       if (val) *val = v;
2165       return SWIG_OK;
2166     } else {
2167       return SWIG_OverflowError;
2168     }
2169   } else {
2170     int dispatch = 0;
2171     const char *nptr = SvPV_nolen(obj);
2172     if (nptr) {
2173       char *endptr;
2174       unsigned long v;
2175       errno = 0;
2176       v = strtoul(nptr, &endptr,0);
2177       if (errno == ERANGE) {
2178         errno = 0;
2179         return SWIG_OverflowError;
2180       } else {
2181         if (*endptr == '\0') {
2182           if (val) *val = v;
2183           return SWIG_Str2NumCast(SWIG_OK);
2184         }
2185       }
2186     }
2187     if (!dispatch) {
2188       double d;
2189       int res = SWIG_AddCast(SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(obj,&d));
2190       if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, 0, ULONG_MAX)) {
2191         if (val) *val = (unsigned long)(d);
2192         return res;
2193       }
2194     }
2195   }
2196   return SWIG_TypeError;
2197 }
2198
2199
2200 SWIGINTERNINLINE int
2201 SWIG_AsVal_size_t SWIG_PERL_DECL_ARGS_2(SV * obj, size_t *val)
2202 {
2203   unsigned long v;
2204   int res = SWIG_AsVal_unsigned_SS_long SWIG_PERL_CALL_ARGS_2(obj, val ? &v : 0);
2205   if (SWIG_IsOK(res) && val) *val = (size_t)(v);
2206   return res;
2207 }
2208
2209
2210 SWIGINTERNINLINE SV *
2211 SWIG_From_long  SWIG_PERL_DECL_ARGS_1(long value)
2212 {    
2213   SV *obj = sv_newmortal();
2214   sv_setiv(obj, (IV) value);
2215   return obj;
2216 }
2217
2218
2219 SWIGINTERNINLINE SV *
2220 SWIG_From_int  SWIG_PERL_DECL_ARGS_1(int value)
2221 {    
2222   return SWIG_From_long  SWIG_PERL_CALL_ARGS_1(value);
2223 }
2224
2225 #ifdef __cplusplus
2226 extern "C" {
2227 #endif
2228
2229 #ifdef PERL_OBJECT
2230 #define MAGIC_CLASS _wrap_Amanda__Device_var::
2231 class _wrap_Amanda__Device_var : public CPerlObj {
2232 public:
2233 #else
2234 #define MAGIC_CLASS
2235 #endif
2236 SWIGCLASS_STATIC int swig_magic_readonly(pTHX_ SV *SWIGUNUSEDPARM(sv), MAGIC *SWIGUNUSEDPARM(mg)) {
2237     MAGIC_PPERL
2238     croak("Value is read-only.");
2239     return 0;
2240 }
2241
2242
2243 #ifdef PERL_OBJECT
2244 };
2245 #endif
2246
2247 #ifdef __cplusplus
2248 }
2249 #endif
2250
2251 #ifdef __cplusplus
2252 extern "C" {
2253 #endif
2254 XS(_wrap_delete_DirectTCPConnection) {
2255   {
2256     DirectTCPConnection *arg1 = (DirectTCPConnection *) 0 ;
2257     void *argp1 = 0 ;
2258     int res1 = 0 ;
2259     int argvi = 0;
2260     dXSARGS;
2261     
2262     if ((items < 1) || (items > 1)) {
2263       SWIG_croak("Usage: delete_DirectTCPConnection(self);");
2264     }
2265     res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_DirectTCPConnection, SWIG_POINTER_DISOWN |  0 );
2266     if (!SWIG_IsOK(res1)) {
2267       SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_DirectTCPConnection" "', argument " "1"" of type '" "DirectTCPConnection *""'"); 
2268     }
2269     arg1 = (DirectTCPConnection *)(argp1);
2270     delete_DirectTCPConnection(arg1);
2271     ST(argvi) = sv_newmortal();
2272     
2273     XSRETURN(argvi);
2274   fail:
2275     
2276     SWIG_croak_null();
2277   }
2278 }
2279
2280
2281 XS(_wrap_DirectTCPConnection_close) {
2282   {
2283     DirectTCPConnection *arg1 = (DirectTCPConnection *) 0 ;
2284     void *argp1 = 0 ;
2285     int res1 = 0 ;
2286     int argvi = 0;
2287     char *result = 0 ;
2288     dXSARGS;
2289     
2290     if ((items < 1) || (items > 1)) {
2291       SWIG_croak("Usage: DirectTCPConnection_close(self);");
2292     }
2293     res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_DirectTCPConnection, 0 |  0 );
2294     if (!SWIG_IsOK(res1)) {
2295       SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DirectTCPConnection_close" "', argument " "1"" of type '" "DirectTCPConnection *""'"); 
2296     }
2297     arg1 = (DirectTCPConnection *)(argp1);
2298     result = (char *)DirectTCPConnection_close(arg1);
2299     ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
2300     
2301     free((char*)result);
2302     XSRETURN(argvi);
2303   fail:
2304     
2305     SWIG_croak_null();
2306   }
2307 }
2308
2309
2310 XS(_wrap_new_DirectTCPConnection) {
2311   {
2312     int argvi = 0;
2313     DirectTCPConnection *result = 0 ;
2314     dXSARGS;
2315     
2316     if ((items < 0) || (items > 0)) {
2317       SWIG_croak("Usage: new_DirectTCPConnection();");
2318     }
2319     result = (DirectTCPConnection *)calloc(1, sizeof(DirectTCPConnection));
2320     ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_DirectTCPConnection, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
2321     XSRETURN(argvi);
2322   fail:
2323     SWIG_croak_null();
2324   }
2325 }
2326
2327
2328 XS(_wrap_unaliased_name) {
2329   {
2330     char *arg1 = (char *) 0 ;
2331     int res1 ;
2332     char *buf1 = 0 ;
2333     int alloc1 = 0 ;
2334     int argvi = 0;
2335     char *result = 0 ;
2336     dXSARGS;
2337     
2338     if ((items < 1) || (items > 1)) {
2339       SWIG_croak("Usage: unaliased_name(char *);");
2340     }
2341     res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
2342     if (!SWIG_IsOK(res1)) {
2343       SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "unaliased_name" "', argument " "1"" of type '" "char *""'");
2344     }
2345     arg1 = (char *)(buf1);
2346     result = (char *)device_unaliased_name(arg1);
2347     ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
2348     if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
2349     XSRETURN(argvi);
2350   fail:
2351     if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
2352     SWIG_croak_null();
2353   }
2354 }
2355
2356
2357 XS(_wrap_new_Device) {
2358   {
2359     char *arg1 = (char *) 0 ;
2360     int res1 ;
2361     char *buf1 = 0 ;
2362     int alloc1 = 0 ;
2363     int argvi = 0;
2364     Device *result = 0 ;
2365     dXSARGS;
2366     
2367     if ((items < 1) || (items > 1)) {
2368       SWIG_croak("Usage: new_Device(device_name);");
2369     }
2370     res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
2371     if (!SWIG_IsOK(res1)) {
2372       SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Device" "', argument " "1"" of type '" "char *""'");
2373     }
2374     arg1 = (char *)(buf1);
2375     result = (Device *)new_Device(arg1);
2376     ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Device, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
2377     if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
2378     XSRETURN(argvi);
2379   fail:
2380     if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
2381     SWIG_croak_null();
2382   }
2383 }
2384
2385
2386 XS(_wrap_delete_Device) {
2387   {
2388     Device *arg1 = (Device *) 0 ;
2389     void *argp1 = 0 ;
2390     int res1 = 0 ;
2391     int argvi = 0;
2392     dXSARGS;
2393     
2394     if ((items < 1) || (items > 1)) {
2395       SWIG_croak("Usage: delete_Device(self);");
2396     }
2397     res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, SWIG_POINTER_DISOWN |  0 );
2398     if (!SWIG_IsOK(res1)) {
2399       SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Device" "', argument " "1"" of type '" "Device *""'"); 
2400     }
2401     arg1 = (Device *)(argp1);
2402     delete_Device(arg1);
2403     ST(argvi) = sv_newmortal();
2404     
2405     XSRETURN(argvi);
2406   fail:
2407     
2408     SWIG_croak_null();
2409   }
2410 }
2411
2412
2413 XS(_wrap_Device_configure) {
2414   {
2415     Device *arg1 = (Device *) 0 ;
2416     gboolean arg2 ;
2417     void *argp1 = 0 ;
2418     int res1 = 0 ;
2419     int argvi = 0;
2420     gboolean result;
2421     dXSARGS;
2422     
2423     if ((items < 2) || (items > 2)) {
2424       SWIG_croak("Usage: Device_configure(self,use_global_config);");
2425     }
2426     res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
2427     if (!SWIG_IsOK(res1)) {
2428       SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_configure" "', argument " "1"" of type '" "Device *""'"); 
2429     }
2430     arg1 = (Device *)(argp1);
2431     {
2432       arg2 = SvTRUE(ST(1));
2433     }
2434     result = (gboolean)Device_configure(arg1,arg2);
2435     {
2436       if (result)
2437       ST(argvi) = &PL_sv_yes;
2438       else
2439       ST(argvi) = &PL_sv_no;
2440       argvi++;
2441     }
2442     
2443     
2444     XSRETURN(argvi);
2445   fail:
2446     
2447     
2448     SWIG_croak_null();
2449   }
2450 }
2451
2452
2453 XS(_wrap_Device_error) {
2454   {
2455     Device *arg1 = (Device *) 0 ;
2456     void *argp1 = 0 ;
2457     int res1 = 0 ;
2458     int argvi = 0;
2459     char *result = 0 ;
2460     dXSARGS;
2461     
2462     if ((items < 1) || (items > 1)) {
2463       SWIG_croak("Usage: Device_error(self);");
2464     }
2465     res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
2466     if (!SWIG_IsOK(res1)) {
2467       SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_error" "', argument " "1"" of type '" "Device *""'"); 
2468     }
2469     arg1 = (Device *)(argp1);
2470     result = (char *)Device_error(arg1);
2471     ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
2472     
2473     XSRETURN(argvi);
2474   fail:
2475     
2476     SWIG_croak_null();
2477   }
2478 }
2479
2480
2481 XS(_wrap_Device_status_error) {
2482   {
2483     Device *arg1 = (Device *) 0 ;
2484     void *argp1 = 0 ;
2485     int res1 = 0 ;
2486     int argvi = 0;
2487     char *result = 0 ;
2488     dXSARGS;
2489     
2490     if ((items < 1) || (items > 1)) {
2491       SWIG_croak("Usage: Device_status_error(self);");
2492     }
2493     res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
2494     if (!SWIG_IsOK(res1)) {
2495       SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_status_error" "', argument " "1"" of type '" "Device *""'"); 
2496     }
2497     arg1 = (Device *)(argp1);
2498     result = (char *)Device_status_error(arg1);
2499     ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
2500     
2501     XSRETURN(argvi);
2502   fail:
2503     
2504     SWIG_croak_null();
2505   }
2506 }
2507
2508
2509 XS(_wrap_Device_error_or_status) {
2510   {
2511     Device *arg1 = (Device *) 0 ;
2512     void *argp1 = 0 ;
2513     int res1 = 0 ;
2514     int argvi = 0;
2515     char *result = 0 ;
2516     dXSARGS;
2517     
2518     if ((items < 1) || (items > 1)) {
2519       SWIG_croak("Usage: Device_error_or_status(self);");
2520     }
2521     res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
2522     if (!SWIG_IsOK(res1)) {
2523       SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_error_or_status" "', argument " "1"" of type '" "Device *""'"); 
2524     }
2525     arg1 = (Device *)(argp1);
2526     result = (char *)Device_error_or_status(arg1);
2527     ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
2528     
2529     XSRETURN(argvi);
2530   fail:
2531     
2532     SWIG_croak_null();
2533   }
2534 }
2535
2536
2537 XS(_wrap_Device_read_label) {
2538   {
2539     Device *arg1 = (Device *) 0 ;
2540     void *argp1 = 0 ;
2541     int res1 = 0 ;
2542     int argvi = 0;
2543     DeviceStatusFlags result;
2544     dXSARGS;
2545     
2546     if ((items < 1) || (items > 1)) {
2547       SWIG_croak("Usage: Device_read_label(self);");
2548     }
2549     res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
2550     if (!SWIG_IsOK(res1)) {
2551       SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_read_label" "', argument " "1"" of type '" "Device *""'"); 
2552     }
2553     arg1 = (Device *)(argp1);
2554     result = (DeviceStatusFlags)Device_read_label(arg1);
2555     {
2556       SV *for_stack;
2557       SP += argvi; PUTBACK;
2558       for_stack = sv_2mortal(amglue_newSVi64(result));
2559       SPAGAIN; SP -= argvi;
2560       ST(argvi) = for_stack;
2561       argvi++;
2562     }
2563     
2564     XSRETURN(argvi);
2565   fail:
2566     
2567     SWIG_croak_null();
2568   }
2569 }
2570
2571
2572 XS(_wrap_Device_start) {
2573   {
2574     Device *arg1 = (Device *) 0 ;
2575     DeviceAccessMode arg2 ;
2576     char *arg3 = (char *) 0 ;
2577     char *arg4 = (char *) 0 ;
2578     void *argp1 = 0 ;
2579     int res1 = 0 ;
2580     int res3 ;
2581     char *buf3 = 0 ;
2582     int alloc3 = 0 ;
2583     int res4 ;
2584     char *buf4 = 0 ;
2585     int alloc4 = 0 ;
2586     int argvi = 0;
2587     gboolean result;
2588     dXSARGS;
2589     
2590     if ((items < 4) || (items > 4)) {
2591       SWIG_croak("Usage: Device_start(self,mode,label,timestamp);");
2592     }
2593     res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
2594     if (!SWIG_IsOK(res1)) {
2595       SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_start" "', argument " "1"" of type '" "Device *""'"); 
2596     }
2597     arg1 = (Device *)(argp1);
2598     {
2599       if (sizeof(signed int) == 1) {
2600         arg2 = amglue_SvI8(ST(1));
2601       } else if (sizeof(signed int) == 2) {
2602         arg2 = amglue_SvI16(ST(1));
2603       } else if (sizeof(signed int) == 4) {
2604         arg2 = amglue_SvI32(ST(1));
2605       } else if (sizeof(signed int) == 8) {
2606         arg2 = amglue_SvI64(ST(1));
2607       } else {
2608         g_critical("Unexpected signed int >64 bits?"); /* should be optimized out unless sizeof(signed int) > 8 */
2609       }
2610     }
2611     res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
2612     if (!SWIG_IsOK(res3)) {
2613       SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Device_start" "', argument " "3"" of type '" "char *""'");
2614     }
2615     arg3 = (char *)(buf3);
2616     res4 = SWIG_AsCharPtrAndSize(ST(3), &buf4, NULL, &alloc4);
2617     if (!SWIG_IsOK(res4)) {
2618       SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "Device_start" "', argument " "4"" of type '" "char *""'");
2619     }
2620     arg4 = (char *)(buf4);
2621     result = (gboolean)Device_start(arg1,arg2,arg3,arg4);
2622     {
2623       if (result)
2624       ST(argvi) = &PL_sv_yes;
2625       else
2626       ST(argvi) = &PL_sv_no;
2627       argvi++;
2628     }
2629     
2630     
2631     if (alloc3 == SWIG_NEWOBJ) free((char*)buf3);
2632     if (alloc4 == SWIG_NEWOBJ) free((char*)buf4);
2633     XSRETURN(argvi);
2634   fail:
2635     
2636     
2637     if (alloc3 == SWIG_NEWOBJ) free((char*)buf3);
2638     if (alloc4 == SWIG_NEWOBJ) free((char*)buf4);
2639     SWIG_croak_null();
2640   }
2641 }
2642
2643
2644 XS(_wrap_Device_finish) {
2645   {
2646     Device *arg1 = (Device *) 0 ;
2647     void *argp1 = 0 ;
2648     int res1 = 0 ;
2649     int argvi = 0;
2650     gboolean result;
2651     dXSARGS;
2652     
2653     if ((items < 1) || (items > 1)) {
2654       SWIG_croak("Usage: Device_finish(self);");
2655     }
2656     res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
2657     if (!SWIG_IsOK(res1)) {
2658       SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_finish" "', argument " "1"" of type '" "Device *""'"); 
2659     }
2660     arg1 = (Device *)(argp1);
2661     result = (gboolean)Device_finish(arg1);
2662     {
2663       if (result)
2664       ST(argvi) = &PL_sv_yes;
2665       else
2666       ST(argvi) = &PL_sv_no;
2667       argvi++;
2668     }
2669     
2670     XSRETURN(argvi);
2671   fail:
2672     
2673     SWIG_croak_null();
2674   }
2675 }
2676
2677
2678 XS(_wrap_Device_start_file) {
2679   {
2680     Device *arg1 = (Device *) 0 ;
2681     dumpfile_t *arg2 = (dumpfile_t *) 0 ;
2682     void *argp1 = 0 ;
2683     int res1 = 0 ;
2684     void *argp2 = 0 ;
2685     int res2 = 0 ;
2686     int argvi = 0;
2687     gboolean result;
2688     dXSARGS;
2689     
2690     if ((items < 2) || (items > 2)) {
2691       SWIG_croak("Usage: Device_start_file(self,jobInfo);");
2692     }
2693     res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
2694     if (!SWIG_IsOK(res1)) {
2695       SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_start_file" "', argument " "1"" of type '" "Device *""'"); 
2696     }
2697     arg1 = (Device *)(argp1);
2698     res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_dumpfile_t, 0 |  0 );
2699     if (!SWIG_IsOK(res2)) {
2700       SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Device_start_file" "', argument " "2"" of type '" "dumpfile_t *""'"); 
2701     }
2702     arg2 = (dumpfile_t *)(argp2);
2703     result = (gboolean)Device_start_file(arg1,arg2);
2704     {
2705       if (result)
2706       ST(argvi) = &PL_sv_yes;
2707       else
2708       ST(argvi) = &PL_sv_no;
2709       argvi++;
2710     }
2711     
2712     
2713     XSRETURN(argvi);
2714   fail:
2715     
2716     
2717     SWIG_croak_null();
2718   }
2719 }
2720
2721
2722 XS(_wrap_Device_write_block) {
2723   {
2724     Device *arg1 = (Device *) 0 ;
2725     guint arg2 ;
2726     gpointer arg3 = (gpointer) 0 ;
2727     void *argp1 = 0 ;
2728     int res1 = 0 ;
2729     int res3 ;
2730     int argvi = 0;
2731     gboolean result;
2732     dXSARGS;
2733     
2734     if ((items < 3) || (items > 3)) {
2735       SWIG_croak("Usage: Device_write_block(self,size,data);");
2736     }
2737     res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
2738     if (!SWIG_IsOK(res1)) {
2739       SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_write_block" "', argument " "1"" of type '" "Device *""'"); 
2740     }
2741     arg1 = (Device *)(argp1);
2742     {
2743       if (sizeof(guint) == 1) {
2744         arg2 = amglue_SvU8(ST(1));
2745       } else if (sizeof(guint) == 2) {
2746         arg2 = amglue_SvU16(ST(1));
2747       } else if (sizeof(guint) == 4) {
2748         arg2 = amglue_SvU32(ST(1));
2749       } else if (sizeof(guint) == 8) {
2750         arg2 = amglue_SvU64(ST(1));
2751       } else {
2752         croak("Unexpected guint >64 bits?"); /* should be optimized out unless sizeof(guint) > 8 */
2753       }
2754     }
2755     res3 = SWIG_ConvertPtr(ST(2),SWIG_as_voidptrptr(&arg3), 0, 0);
2756     if (!SWIG_IsOK(res3)) {
2757       SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Device_write_block" "', argument " "3"" of type '" "gpointer""'"); 
2758     }
2759     result = (gboolean)Device_write_block(arg1,arg2,arg3);
2760     {
2761       if (result)
2762       ST(argvi) = &PL_sv_yes;
2763       else
2764       ST(argvi) = &PL_sv_no;
2765       argvi++;
2766     }
2767     
2768     
2769     XSRETURN(argvi);
2770   fail:
2771     
2772     
2773     SWIG_croak_null();
2774   }
2775 }
2776
2777
2778 XS(_wrap_Device_finish_file) {
2779   {
2780     Device *arg1 = (Device *) 0 ;
2781     void *argp1 = 0 ;
2782     int res1 = 0 ;
2783     int argvi = 0;
2784     gboolean result;
2785     dXSARGS;
2786     
2787     if ((items < 1) || (items > 1)) {
2788       SWIG_croak("Usage: Device_finish_file(self);");
2789     }
2790     res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
2791     if (!SWIG_IsOK(res1)) {
2792       SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_finish_file" "', argument " "1"" of type '" "Device *""'"); 
2793     }
2794     arg1 = (Device *)(argp1);
2795     result = (gboolean)Device_finish_file(arg1);
2796     {
2797       if (result)
2798       ST(argvi) = &PL_sv_yes;
2799       else
2800       ST(argvi) = &PL_sv_no;
2801       argvi++;
2802     }
2803     
2804     XSRETURN(argvi);
2805   fail:
2806     
2807     SWIG_croak_null();
2808   }
2809 }
2810
2811
2812 XS(_wrap_Device_seek_file) {
2813   {
2814     Device *arg1 = (Device *) 0 ;
2815     guint arg2 ;
2816     void *argp1 = 0 ;
2817     int res1 = 0 ;
2818     int argvi = 0;
2819     dumpfile_t *result = 0 ;
2820     dXSARGS;
2821     
2822     if ((items < 2) || (items > 2)) {
2823       SWIG_croak("Usage: Device_seek_file(self,file);");
2824     }
2825     res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
2826     if (!SWIG_IsOK(res1)) {
2827       SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_seek_file" "', argument " "1"" of type '" "Device *""'"); 
2828     }
2829     arg1 = (Device *)(argp1);
2830     {
2831       if (sizeof(guint) == 1) {
2832         arg2 = amglue_SvU8(ST(1));
2833       } else if (sizeof(guint) == 2) {
2834         arg2 = amglue_SvU16(ST(1));
2835       } else if (sizeof(guint) == 4) {
2836         arg2 = amglue_SvU32(ST(1));
2837       } else if (sizeof(guint) == 8) {
2838         arg2 = amglue_SvU64(ST(1));
2839       } else {
2840         croak("Unexpected guint >64 bits?"); /* should be optimized out unless sizeof(guint) > 8 */
2841       }
2842     }
2843     result = (dumpfile_t *)Device_seek_file(arg1,arg2);
2844     ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_dumpfile_t, 0 | SWIG_SHADOW); argvi++ ;
2845     
2846     XSRETURN(argvi);
2847   fail:
2848     
2849     SWIG_croak_null();
2850   }
2851 }
2852
2853
2854 XS(_wrap_Device_seek_block) {
2855   {
2856     Device *arg1 = (Device *) 0 ;
2857     guint64 arg2 ;
2858     void *argp1 = 0 ;
2859     int res1 = 0 ;
2860     int argvi = 0;
2861     gboolean result;
2862     dXSARGS;
2863     
2864     if ((items < 2) || (items > 2)) {
2865       SWIG_croak("Usage: Device_seek_block(self,block);");
2866     }
2867     res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
2868     if (!SWIG_IsOK(res1)) {
2869       SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_seek_block" "', argument " "1"" of type '" "Device *""'"); 
2870     }
2871     arg1 = (Device *)(argp1);
2872     {
2873       arg2 = amglue_SvU64(ST(1));
2874     }
2875     result = (gboolean)Device_seek_block(arg1,arg2);
2876     {
2877       if (result)
2878       ST(argvi) = &PL_sv_yes;
2879       else
2880       ST(argvi) = &PL_sv_no;
2881       argvi++;
2882     }
2883     
2884     XSRETURN(argvi);
2885   fail:
2886     
2887     SWIG_croak_null();
2888   }
2889 }
2890
2891
2892 XS(_wrap_Device_read_block) {
2893   {
2894     Device *arg1 = (Device *) 0 ;
2895     gpointer arg2 = (gpointer) 0 ;
2896     int *arg3 = (int *) 0 ;
2897     void *argp1 = 0 ;
2898     int res1 = 0 ;
2899     int res2 ;
2900     void *argp3 = 0 ;
2901     int res3 = 0 ;
2902     int argvi = 0;
2903     int result;
2904     dXSARGS;
2905     
2906     if ((items < 3) || (items > 3)) {
2907       SWIG_croak("Usage: Device_read_block(self,buffer,size);");
2908     }
2909     res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
2910     if (!SWIG_IsOK(res1)) {
2911       SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_read_block" "', argument " "1"" of type '" "Device *""'"); 
2912     }
2913     arg1 = (Device *)(argp1);
2914     res2 = SWIG_ConvertPtr(ST(1),SWIG_as_voidptrptr(&arg2), 0, 0);
2915     if (!SWIG_IsOK(res2)) {
2916       SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Device_read_block" "', argument " "2"" of type '" "gpointer""'"); 
2917     }
2918     res3 = SWIG_ConvertPtr(ST(2), &argp3,SWIGTYPE_p_int, 0 |  0 );
2919     if (!SWIG_IsOK(res3)) {
2920       SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Device_read_block" "', argument " "3"" of type '" "int *""'"); 
2921     }
2922     arg3 = (int *)(argp3);
2923     result = (int)Device_read_block(arg1,arg2,arg3);
2924     {
2925       SV *for_stack;
2926       SP += argvi; PUTBACK;
2927       for_stack = sv_2mortal(amglue_newSVi64(result));
2928       SPAGAIN; SP -= argvi;
2929       ST(argvi) = for_stack;
2930       argvi++;
2931     }
2932     
2933     
2934     
2935     XSRETURN(argvi);
2936   fail:
2937     
2938     
2939     
2940     SWIG_croak_null();
2941   }
2942 }
2943
2944
2945 XS(_wrap_Device_erase) {
2946   {
2947     Device *arg1 = (Device *) 0 ;
2948     void *argp1 = 0 ;
2949     int res1 = 0 ;
2950     int argvi = 0;
2951     gboolean result;
2952     dXSARGS;
2953     
2954     if ((items < 1) || (items > 1)) {
2955       SWIG_croak("Usage: Device_erase(self);");
2956     }
2957     res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
2958     if (!SWIG_IsOK(res1)) {
2959       SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_erase" "', argument " "1"" of type '" "Device *""'"); 
2960     }
2961     arg1 = (Device *)(argp1);
2962     result = (gboolean)Device_erase(arg1);
2963     {
2964       if (result)
2965       ST(argvi) = &PL_sv_yes;
2966       else
2967       ST(argvi) = &PL_sv_no;
2968       argvi++;
2969     }
2970     
2971     XSRETURN(argvi);
2972   fail:
2973     
2974     SWIG_croak_null();
2975   }
2976 }
2977
2978
2979 XS(_wrap_Device_eject) {
2980   {
2981     Device *arg1 = (Device *) 0 ;
2982     void *argp1 = 0 ;
2983     int res1 = 0 ;
2984     int argvi = 0;
2985     gboolean result;
2986     dXSARGS;
2987     
2988     if ((items < 1) || (items > 1)) {
2989       SWIG_croak("Usage: Device_eject(self);");
2990     }
2991     res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
2992     if (!SWIG_IsOK(res1)) {
2993       SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_eject" "', argument " "1"" of type '" "Device *""'"); 
2994     }
2995     arg1 = (Device *)(argp1);
2996     result = (gboolean)Device_eject(arg1);
2997     {
2998       if (result)
2999       ST(argvi) = &PL_sv_yes;
3000       else
3001       ST(argvi) = &PL_sv_no;
3002       argvi++;
3003     }
3004     
3005     XSRETURN(argvi);
3006   fail:
3007     
3008     SWIG_croak_null();
3009   }
3010 }
3011
3012
3013 XS(_wrap_Device_directtcp_supported) {
3014   {
3015     Device *arg1 = (Device *) 0 ;
3016     void *argp1 = 0 ;
3017     int res1 = 0 ;
3018     int argvi = 0;
3019     gboolean result;
3020     dXSARGS;
3021     
3022     if ((items < 1) || (items > 1)) {
3023       SWIG_croak("Usage: Device_directtcp_supported(self);");
3024     }
3025     res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
3026     if (!SWIG_IsOK(res1)) {
3027       SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_directtcp_supported" "', argument " "1"" of type '" "Device *""'"); 
3028     }
3029     arg1 = (Device *)(argp1);
3030     result = (gboolean)Device_directtcp_supported(arg1);
3031     {
3032       if (result)
3033       ST(argvi) = &PL_sv_yes;
3034       else
3035       ST(argvi) = &PL_sv_no;
3036       argvi++;
3037     }
3038     
3039     XSRETURN(argvi);
3040   fail:
3041     
3042     SWIG_croak_null();
3043   }
3044 }
3045
3046
3047 XS(_wrap_Device_listen) {
3048   {
3049     Device *arg1 = (Device *) 0 ;
3050     gboolean arg2 ;
3051     DirectTCPAddr **arg3 = (DirectTCPAddr **) 0 ;
3052     void *argp1 = 0 ;
3053     int res1 = 0 ;
3054     DirectTCPAddr *addrs3 ;
3055     int argvi = 0;
3056     dXSARGS;
3057     
3058     {
3059       addrs3 = NULL;
3060       arg3 = &addrs3;
3061     }
3062     if ((items < 2) || (items > 2)) {
3063       SWIG_croak("Usage: Device_listen(self,for_writing);");
3064     }
3065     res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
3066     if (!SWIG_IsOK(res1)) {
3067       SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_listen" "', argument " "1"" of type '" "Device *""'"); 
3068     }
3069     arg1 = (Device *)(argp1);
3070     {
3071       arg2 = SvTRUE(ST(1));
3072     }
3073     Device_listen(arg1,arg2,arg3);
3074     ST(argvi) = sv_newmortal();
3075     {
3076       if (arg3 && *arg3) {
3077         DirectTCPAddr *iter = *arg3;
3078         AV *av = newAV();
3079         int i = 0;
3080         
3081         while (iter && iter->ipv4) {
3082           struct in_addr in;
3083           char *addr;
3084           AV *tuple = newAV();
3085           
3086           in.s_addr = htonl(iter->ipv4);
3087           addr = inet_ntoa(in);
3088           g_assert(NULL != av_store(tuple, 0,
3089               newSVpv(addr, 0)));
3090           g_assert(NULL != av_store(tuple, 1, newSViv(iter->port)));
3091           g_assert(NULL != av_store(av, i++, newRV_noinc((SV *)tuple)));
3092           iter++;
3093         }
3094         
3095         ST(argvi) = newRV_noinc((SV *)av);
3096         argvi++;
3097       }
3098     }
3099     
3100     
3101     
3102     XSRETURN(argvi);
3103   fail:
3104     
3105     
3106     
3107     SWIG_croak_null();
3108   }
3109 }
3110
3111
3112 XS(_wrap_Device_accept) {
3113   {
3114     Device *arg1 = (Device *) 0 ;
3115     void *argp1 = 0 ;
3116     int res1 = 0 ;
3117     int argvi = 0;
3118     DirectTCPConnection *result = 0 ;
3119     dXSARGS;
3120     
3121     if ((items < 1) || (items > 1)) {
3122       SWIG_croak("Usage: Device_accept(self);");
3123     }
3124     res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
3125     if (!SWIG_IsOK(res1)) {
3126       SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_accept" "', argument " "1"" of type '" "Device *""'"); 
3127     }
3128     arg1 = (Device *)(argp1);
3129     result = (DirectTCPConnection *)Device_accept(arg1);
3130     ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_DirectTCPConnection, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
3131     
3132     XSRETURN(argvi);
3133   fail:
3134     
3135     SWIG_croak_null();
3136   }
3137 }
3138
3139
3140 XS(_wrap_Device_connect) {
3141   {
3142     Device *arg1 = (Device *) 0 ;
3143     gboolean arg2 ;
3144     DirectTCPAddr *arg3 = (DirectTCPAddr *) 0 ;
3145     void *argp1 = 0 ;
3146     int res1 = 0 ;
3147     int argvi = 0;
3148     DirectTCPConnection *result = 0 ;
3149     dXSARGS;
3150     
3151     if ((items < 3) || (items > 3)) {
3152       SWIG_croak("Usage: Device_connect(self,for_writing,addrs);");
3153     }
3154     res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
3155     if (!SWIG_IsOK(res1)) {
3156       SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_connect" "', argument " "1"" of type '" "Device *""'"); 
3157     }
3158     arg1 = (Device *)(argp1);
3159     {
3160       arg2 = SvTRUE(ST(1));
3161     }
3162     {
3163       AV *addrs_av;
3164       int num_addrs, i;
3165       
3166       if (!SvROK(ST(2)) || SvTYPE(SvRV(ST(2))) != SVt_PVAV) {
3167         SWIG_exception_fail(SWIG_TypeError, "must provide an arrayref of DirectTCPAddrs");
3168       }
3169       addrs_av = (AV *)SvRV(ST(2));
3170       num_addrs = av_len(addrs_av)+1;
3171       
3172       arg3 = g_new0(DirectTCPAddr, num_addrs+1);
3173       
3174       for (i = 0; i < num_addrs; i++) {
3175         SV **svp = av_fetch(addrs_av, i, 0);
3176         AV *addr_av;
3177         struct in_addr addr;
3178         IV port;
3179         
3180         if (!svp || !SvROK(*svp) || SvTYPE(SvRV(*svp)) != SVt_PVAV
3181           || av_len((AV *)SvRV(*svp))+1 != 2) {
3182           SWIG_exception_fail(SWIG_TypeError, "each DirectTCPAddr must be a 2-element arrayref");
3183         }
3184         
3185         addr_av = (AV *)SvRV(*svp);
3186         
3187         /* get address */
3188         svp = av_fetch(addr_av, 0, 0);
3189         if (!svp || !SvPOK(*svp) || !inet_aton(SvPV_nolen(*svp), &addr)) {
3190           SWIG_exception_fail(SWIG_TypeError, "invalid IPv4 addr in address");
3191         }
3192         arg3[i].ipv4 = ntohl(addr.s_addr);
3193         
3194         /* get port */
3195         svp = av_fetch(addr_av, 1, 0);
3196         if (!svp || !SvIOK(*svp) || (port = SvIV(*svp)) <= 0 || port >= 65536) {
3197           SWIG_exception_fail(SWIG_TypeError, "invalid port in address");
3198         }
3199         arg3[i].port = (guint16)port;
3200       }
3201     }
3202     result = (DirectTCPConnection *)Device_connect(arg1,arg2,arg3);
3203     ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_DirectTCPConnection, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
3204     
3205     
3206     
3207     XSRETURN(argvi);
3208   fail:
3209     
3210     
3211     
3212     SWIG_croak_null();
3213   }
3214 }
3215
3216
3217 XS(_wrap_Device_use_connection) {
3218   {
3219     Device *arg1 = (Device *) 0 ;
3220     DirectTCPConnection *arg2 = (DirectTCPConnection *) 0 ;
3221     void *argp1 = 0 ;
3222     int res1 = 0 ;
3223     void *argp2 = 0 ;
3224     int res2 = 0 ;
3225     int argvi = 0;
3226     gboolean result;
3227     dXSARGS;
3228     
3229     if ((items < 2) || (items > 2)) {
3230       SWIG_croak("Usage: Device_use_connection(self,conn);");
3231     }
3232     res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
3233     if (!SWIG_IsOK(res1)) {
3234       SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_use_connection" "', argument " "1"" of type '" "Device *""'"); 
3235     }
3236     arg1 = (Device *)(argp1);
3237     res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_DirectTCPConnection, 0 |  0 );
3238     if (!SWIG_IsOK(res2)) {
3239       SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Device_use_connection" "', argument " "2"" of type '" "DirectTCPConnection *""'"); 
3240     }
3241     arg2 = (DirectTCPConnection *)(argp2);
3242     result = (gboolean)Device_use_connection(arg1,arg2);
3243     {
3244       if (result)
3245       ST(argvi) = &PL_sv_yes;
3246       else
3247       ST(argvi) = &PL_sv_no;
3248       argvi++;
3249     }
3250     
3251     
3252     XSRETURN(argvi);
3253   fail:
3254     
3255     
3256     SWIG_croak_null();
3257   }
3258 }
3259
3260
3261 XS(_wrap_Device_write_from_connection) {
3262   {
3263     Device *arg1 = (Device *) 0 ;
3264     guint64 arg2 ;
3265     guint64 *arg3 = (guint64 *) 0 ;
3266     void *argp1 = 0 ;
3267     int res1 = 0 ;
3268     guint64 sz3 ;
3269     int argvi = 0;
3270     gboolean result;
3271     dXSARGS;
3272     
3273     {
3274       sz3 = 0;
3275       arg3 = &sz3;
3276     }
3277     if ((items < 2) || (items > 2)) {
3278       SWIG_croak("Usage: Device_write_from_connection(self,size);");
3279     }
3280     res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
3281     if (!SWIG_IsOK(res1)) {
3282       SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_write_from_connection" "', argument " "1"" of type '" "Device *""'"); 
3283     }
3284     arg1 = (Device *)(argp1);
3285     {
3286       arg2 = amglue_SvU64(ST(1));
3287     }
3288     result = (gboolean)Device_write_from_connection(arg1,arg2,arg3);
3289     {
3290       if (result)
3291       ST(argvi) = &PL_sv_yes;
3292       else
3293       ST(argvi) = &PL_sv_no;
3294       argvi++;
3295     }
3296     {
3297       SP += argvi; PUTBACK;
3298       ST(argvi) = sv_2mortal(amglue_newSVu64(*arg3));
3299       SPAGAIN; SP -= argvi; argvi++;
3300     }
3301     
3302     
3303     XSRETURN(argvi);
3304   fail:
3305     
3306     
3307     SWIG_croak_null();
3308   }
3309 }
3310
3311
3312 XS(_wrap_Device_read_to_connection) {
3313   {
3314     Device *arg1 = (Device *) 0 ;
3315     guint64 arg2 ;
3316     guint64 *arg3 = (guint64 *) 0 ;
3317     void *argp1 = 0 ;
3318     int res1 = 0 ;
3319     guint64 sz3 ;
3320     int argvi = 0;
3321     gboolean result;
3322     dXSARGS;
3323     
3324     {
3325       sz3 = 0;
3326       arg3 = &sz3;
3327     }
3328     if ((items < 2) || (items > 2)) {
3329       SWIG_croak("Usage: Device_read_to_connection(self,size);");
3330     }
3331     res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
3332     if (!SWIG_IsOK(res1)) {
3333       SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_read_to_connection" "', argument " "1"" of type '" "Device *""'"); 
3334     }
3335     arg1 = (Device *)(argp1);
3336     {
3337       arg2 = amglue_SvU64(ST(1));
3338     }
3339     result = (gboolean)Device_read_to_connection(arg1,arg2,arg3);
3340     {
3341       if (result)
3342       ST(argvi) = &PL_sv_yes;
3343       else
3344       ST(argvi) = &PL_sv_no;
3345       argvi++;
3346     }
3347     {
3348       SP += argvi; PUTBACK;
3349       ST(argvi) = sv_2mortal(amglue_newSVu64(*arg3));
3350       SPAGAIN; SP -= argvi; argvi++;
3351     }
3352     
3353     
3354     XSRETURN(argvi);
3355   fail:
3356     
3357     
3358     SWIG_croak_null();
3359   }
3360 }
3361
3362
3363 XS(_wrap_Device_property_list) {
3364   {
3365     Device *arg1 = (Device *) 0 ;
3366     void *argp1 = 0 ;
3367     int res1 = 0 ;
3368     int argvi = 0;
3369     GSList *result = 0 ;
3370     dXSARGS;
3371     
3372     if ((items < 1) || (items > 1)) {
3373       SWIG_croak("Usage: Device_property_list(self);");
3374     }
3375     res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
3376     if (!SWIG_IsOK(res1)) {
3377       SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_property_list" "', argument " "1"" of type '" "Device *""'"); 
3378     }
3379     arg1 = (Device *)(argp1);
3380     result = (GSList *)Device_property_list(arg1);
3381     {
3382       GSList *iter;
3383       
3384       /* Count the DeviceProperties */
3385       EXTEND(SP, g_slist_length(result)); /* make room for return values */
3386       
3387       /* Note that we set ST(argvi) several times. the nature of
3388              * SWIG's wrapping is such that incrementing argvi points
3389              * ST(argvi) to the next location in perl's argument stack.
3390                    */
3391       
3392       for (iter = result; iter; iter = g_slist_next(iter)) {
3393         DeviceProperty *prop = iter->data;
3394         HV *hash = newHV();
3395         SV *rv = newRV_noinc((SV *)hash);
3396         
3397         hv_store(hash, "name", 4,
3398           newSVpv(prop->base->name, 0), 0);
3399         hv_store(hash, "description", 11,
3400           newSVpv(prop->base->description, 0), 0);
3401         hv_store(hash, "access", 6,
3402           newSViv(prop->access), 0);
3403         ST(argvi) = sv_2mortal(rv);
3404         argvi++;
3405       }
3406     }
3407     
3408     XSRETURN(argvi);
3409   fail:
3410     
3411     SWIG_croak_null();
3412   }
3413 }
3414
3415
3416 XS(_wrap_Device_property_get) {
3417   {
3418     Device *arg1 = (Device *) 0 ;
3419     DevicePropertyBase *arg2 = (DevicePropertyBase *) 0 ;
3420     GValue *arg3 = (GValue *) 0 ;
3421     PropertySurety *arg4 = (PropertySurety *) 0 ;
3422     PropertySource *arg5 = (PropertySource *) 0 ;
3423     gboolean *arg6 = (gboolean *) 0 ;
3424     void *argp1 = 0 ;
3425     int res1 = 0 ;
3426     GValue val3 ;
3427     PropertySurety surety3 ;
3428     PropertySource source3 ;
3429     gboolean found3 ;
3430     int argvi = 0;
3431     dXSARGS;
3432     
3433     {
3434       memset(&val3, 0, sizeof(val3));
3435       arg3 = &val3;
3436       if (GIMME_V == G_ARRAY) {
3437         arg4 = &surety3;
3438         arg5 = &source3;
3439       }
3440       arg6 = &found3;
3441     }
3442     if ((items < 2) || (items > 2)) {
3443       SWIG_croak("Usage: Device_property_get(self,pbase,surety,source,val_found);");
3444     }
3445     res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
3446     if (!SWIG_IsOK(res1)) {
3447       SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_property_get" "', argument " "1"" of type '" "Device *""'"); 
3448     }
3449     arg1 = (Device *)(argp1);
3450     {
3451       char *pname = NULL;
3452       
3453       if (SvPOK(ST(1)))
3454       pname = SvPV_nolen(ST(1));
3455       
3456       if (pname)
3457       arg2 = (DevicePropertyBase *)device_property_get_by_name(pname);
3458       else
3459       arg2 = NULL;
3460     }
3461     Device_property_get(arg1,arg2,arg3,arg4,arg5,arg6);
3462     ST(argvi) = sv_newmortal();
3463     {
3464       /* if the result is valid */
3465       if (*arg6) {
3466         /* move data from arg3 to ST(argvi), somehow, being careful to
3467                          * save the perl stack while doing so */
3468         SP += argvi; PUTBACK;
3469         ST(argvi) = set_sv_from_gvalue(arg3);
3470         SPAGAIN; SP -= argvi; argvi++;
3471         
3472         /* free any memory for the GValue */
3473         g_value_unset(arg3);
3474         
3475         if (GIMME_V == G_ARRAY) {
3476           ST(argvi) = newSViv(*arg4);
3477           argvi++;
3478           ST(argvi) = newSViv(*arg5);
3479           argvi++;
3480         }
3481       }
3482       /* otherwise, return nothing */
3483     }
3484     
3485     
3486     XSRETURN(argvi);
3487   fail:
3488     
3489     
3490     SWIG_croak_null();
3491   }
3492 }
3493
3494
3495 XS(_wrap_Device_property_set) {
3496   {
3497     Device *arg1 = (Device *) 0 ;
3498     DevicePropertyBase *arg2 = (DevicePropertyBase *) 0 ;
3499     SV *arg3 = (SV *) 0 ;
3500     void *argp1 = 0 ;
3501     int res1 = 0 ;
3502     int argvi = 0;
3503     gboolean result;
3504     dXSARGS;
3505     
3506     if ((items < 3) || (items > 3)) {
3507       SWIG_croak("Usage: Device_property_set(self,pbase,sv);");
3508     }
3509     res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
3510     if (!SWIG_IsOK(res1)) {
3511       SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_property_set" "', argument " "1"" of type '" "Device *""'"); 
3512     }
3513     arg1 = (Device *)(argp1);
3514     {
3515       char *pname = NULL;
3516       
3517       if (SvPOK(ST(1)))
3518       pname = SvPV_nolen(ST(1));
3519       
3520       if (pname)
3521       arg2 = (DevicePropertyBase *)device_property_get_by_name(pname);
3522       else
3523       arg2 = NULL;
3524     }
3525     arg3 = ST(2);
3526     result = (gboolean)Device_property_set(arg1,arg2,arg3);
3527     {
3528       if (result)
3529       ST(argvi) = &PL_sv_yes;
3530       else
3531       ST(argvi) = &PL_sv_no;
3532       argvi++;
3533     }
3534     
3535     
3536     
3537     XSRETURN(argvi);
3538   fail:
3539     
3540     
3541     
3542     SWIG_croak_null();
3543   }
3544 }
3545
3546
3547 XS(_wrap_Device_property_set_ex) {
3548   {
3549     Device *arg1 = (Device *) 0 ;
3550     DevicePropertyBase *arg2 = (DevicePropertyBase *) 0 ;
3551     SV *arg3 = (SV *) 0 ;
3552     PropertySurety arg4 ;
3553     PropertySource arg5 ;
3554     void *argp1 = 0 ;
3555     int res1 = 0 ;
3556     int argvi = 0;
3557     gboolean result;
3558     dXSARGS;
3559     
3560     if ((items < 5) || (items > 5)) {
3561       SWIG_croak("Usage: Device_property_set_ex(self,pbase,sv,surety,source);");
3562     }
3563     res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
3564     if (!SWIG_IsOK(res1)) {
3565       SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_property_set_ex" "', argument " "1"" of type '" "Device *""'"); 
3566     }
3567     arg1 = (Device *)(argp1);
3568     {
3569       char *pname = NULL;
3570       
3571       if (SvPOK(ST(1)))
3572       pname = SvPV_nolen(ST(1));
3573       
3574       if (pname)
3575       arg2 = (DevicePropertyBase *)device_property_get_by_name(pname);
3576       else
3577       arg2 = NULL;
3578     }
3579     arg3 = ST(2);
3580     {
3581       if (sizeof(signed int) == 1) {
3582         arg4 = amglue_SvI8(ST(3));
3583       } else if (sizeof(signed int) == 2) {
3584         arg4 = amglue_SvI16(ST(3));
3585       } else if (sizeof(signed int) == 4) {
3586         arg4 = amglue_SvI32(ST(3));
3587       } else if (sizeof(signed int) == 8) {
3588         arg4 = amglue_SvI64(ST(3));
3589       } else {
3590         g_critical("Unexpected signed int >64 bits?"); /* should be optimized out unless sizeof(signed int) > 8 */
3591       }
3592     }
3593     {
3594       if (sizeof(signed int) == 1) {
3595         arg5 = amglue_SvI8(ST(4));
3596       } else if (sizeof(signed int) == 2) {
3597         arg5 = amglue_SvI16(ST(4));
3598       } else if (sizeof(signed int) == 4) {
3599         arg5 = amglue_SvI32(ST(4));
3600       } else if (sizeof(signed int) == 8) {
3601         arg5 = amglue_SvI64(ST(4));
3602       } else {
3603         g_critical("Unexpected signed int >64 bits?"); /* should be optimized out unless sizeof(signed int) > 8 */
3604       }
3605     }
3606     result = (gboolean)Device_property_set_ex(arg1,arg2,arg3,arg4,arg5);
3607     {
3608       if (result)
3609       ST(argvi) = &PL_sv_yes;
3610       else
3611       ST(argvi) = &PL_sv_no;
3612       argvi++;
3613     }
3614     
3615     
3616     
3617     
3618     
3619     XSRETURN(argvi);
3620   fail:
3621     
3622     
3623     
3624     
3625     
3626     SWIG_croak_null();
3627   }
3628 }
3629
3630
3631 XS(_wrap_Device_recycle_file) {
3632   {
3633     Device *arg1 = (Device *) 0 ;
3634     guint arg2 ;
3635     void *argp1 = 0 ;
3636     int res1 = 0 ;
3637     int argvi = 0;
3638     gboolean result;
3639     dXSARGS;
3640     
3641     if ((items < 2) || (items > 2)) {
3642       SWIG_croak("Usage: Device_recycle_file(self,filenum);");
3643     }
3644     res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
3645     if (!SWIG_IsOK(res1)) {
3646       SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_recycle_file" "', argument " "1"" of type '" "Device *""'"); 
3647     }
3648     arg1 = (Device *)(argp1);
3649     {
3650       if (sizeof(guint) == 1) {
3651         arg2 = amglue_SvU8(ST(1));
3652       } else if (sizeof(guint) == 2) {
3653         arg2 = amglue_SvU16(ST(1));
3654       } else if (sizeof(guint) == 4) {
3655         arg2 = amglue_SvU32(ST(1));
3656       } else if (sizeof(guint) == 8) {
3657         arg2 = amglue_SvU64(ST(1));
3658       } else {
3659         croak("Unexpected guint >64 bits?"); /* should be optimized out unless sizeof(guint) > 8 */
3660       }
3661     }
3662     result = (gboolean)Device_recycle_file(arg1,arg2);
3663     {
3664       if (result)
3665       ST(argvi) = &PL_sv_yes;
3666       else
3667       ST(argvi) = &PL_sv_no;
3668       argvi++;
3669     }
3670     
3671     XSRETURN(argvi);
3672   fail:
3673     
3674     SWIG_croak_null();
3675   }
3676 }
3677
3678
3679 XS(_wrap_Device_file) {
3680   {
3681     Device *arg1 = (Device *) 0 ;
3682     void *argp1 = 0 ;
3683     int res1 = 0 ;
3684     int argvi = 0;
3685     int result;
3686     dXSARGS;
3687     
3688     if ((items < 1) || (items > 1)) {
3689       SWIG_croak("Usage: Device_file(self);");
3690     }
3691     res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
3692     if (!SWIG_IsOK(res1)) {
3693       SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_file" "', argument " "1"" of type '" "Device *""'"); 
3694     }
3695     arg1 = (Device *)(argp1);
3696     result = (int)Device_file(arg1);
3697     {
3698       SV *for_stack;
3699       SP += argvi; PUTBACK;
3700       for_stack = sv_2mortal(amglue_newSVi64(result));
3701       SPAGAIN; SP -= argvi;
3702       ST(argvi) = for_stack;
3703       argvi++;
3704     }
3705     
3706     XSRETURN(argvi);
3707   fail:
3708     
3709     SWIG_croak_null();
3710   }
3711 }
3712
3713
3714 XS(_wrap_Device_block) {
3715   {
3716     Device *arg1 = (Device *) 0 ;
3717     void *argp1 = 0 ;
3718     int res1 = 0 ;
3719     int argvi = 0;
3720     guint64 result;
3721     dXSARGS;
3722     
3723     if ((items < 1) || (items > 1)) {
3724       SWIG_croak("Usage: Device_block(self);");
3725     }
3726     res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
3727     if (!SWIG_IsOK(res1)) {
3728       SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_block" "', argument " "1"" of type '" "Device *""'"); 
3729     }
3730     arg1 = (Device *)(argp1);
3731     result = Device_block(arg1);
3732     {
3733       SV *for_stack;
3734       SP += argvi; PUTBACK;
3735       for_stack = sv_2mortal(amglue_newSVu64(result));
3736       SPAGAIN; SP -= argvi;
3737       ST(argvi) = for_stack;
3738       argvi++;
3739     }
3740     
3741     XSRETURN(argvi);
3742   fail:
3743     
3744     SWIG_croak_null();
3745   }
3746 }
3747
3748
3749 XS(_wrap_Device_in_file) {
3750   {
3751     Device *arg1 = (Device *) 0 ;
3752     void *argp1 = 0 ;
3753     int res1 = 0 ;
3754     int argvi = 0;
3755     gboolean result;
3756     dXSARGS;
3757     
3758     if ((items < 1) || (items > 1)) {
3759       SWIG_croak("Usage: Device_in_file(self);");
3760     }
3761     res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
3762     if (!SWIG_IsOK(res1)) {
3763       SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_in_file" "', argument " "1"" of type '" "Device *""'"); 
3764     }
3765     arg1 = (Device *)(argp1);
3766     result = (gboolean)Device_in_file(arg1);
3767     {
3768       if (result)
3769       ST(argvi) = &PL_sv_yes;
3770       else
3771       ST(argvi) = &PL_sv_no;
3772       argvi++;
3773     }
3774     
3775     XSRETURN(argvi);
3776   fail:
3777     
3778     SWIG_croak_null();
3779   }
3780 }
3781
3782
3783 XS(_wrap_Device_device_name) {
3784   {
3785     Device *arg1 = (Device *) 0 ;
3786     void *argp1 = 0 ;
3787     int res1 = 0 ;
3788     int argvi = 0;
3789     char *result = 0 ;
3790     dXSARGS;
3791     
3792     if ((items < 1) || (items > 1)) {
3793       SWIG_croak("Usage: Device_device_name(self);");
3794     }
3795     res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
3796     if (!SWIG_IsOK(res1)) {
3797       SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_device_name" "', argument " "1"" of type '" "Device *""'"); 
3798     }
3799     arg1 = (Device *)(argp1);
3800     result = (char *)Device_device_name(arg1);
3801     ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
3802     
3803     XSRETURN(argvi);
3804   fail:
3805     
3806     SWIG_croak_null();
3807   }
3808 }
3809
3810
3811 XS(_wrap_Device_access_mode) {
3812   {
3813     Device *arg1 = (Device *) 0 ;
3814     void *argp1 = 0 ;
3815     int res1 = 0 ;
3816     int argvi = 0;
3817     DeviceAccessMode result;
3818     dXSARGS;
3819     
3820     if ((items < 1) || (items > 1)) {
3821       SWIG_croak("Usage: Device_access_mode(self);");
3822     }
3823     res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
3824     if (!SWIG_IsOK(res1)) {
3825       SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_access_mode" "', argument " "1"" of type '" "Device *""'"); 
3826     }
3827     arg1 = (Device *)(argp1);
3828     result = (DeviceAccessMode)Device_access_mode(arg1);
3829     {
3830       SV *for_stack;
3831       SP += argvi; PUTBACK;
3832       for_stack = sv_2mortal(amglue_newSVi64(result));
3833       SPAGAIN; SP -= argvi;
3834       ST(argvi) = for_stack;
3835       argvi++;
3836     }
3837     
3838     XSRETURN(argvi);
3839   fail:
3840     
3841     SWIG_croak_null();
3842   }
3843 }
3844
3845
3846 XS(_wrap_Device_is_eof) {
3847   {
3848     Device *arg1 = (Device *) 0 ;
3849     void *argp1 = 0 ;
3850     int res1 = 0 ;
3851     int argvi = 0;
3852     gboolean result;
3853     dXSARGS;
3854     
3855     if ((items < 1) || (items > 1)) {
3856       SWIG_croak("Usage: Device_is_eof(self);");
3857     }
3858     res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
3859     if (!SWIG_IsOK(res1)) {
3860       SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_is_eof" "', argument " "1"" of type '" "Device *""'"); 
3861     }
3862     arg1 = (Device *)(argp1);
3863     result = (gboolean)Device_is_eof(arg1);
3864     {
3865       if (result)
3866       ST(argvi) = &PL_sv_yes;
3867       else
3868       ST(argvi) = &PL_sv_no;
3869       argvi++;
3870     }
3871     
3872     XSRETURN(argvi);
3873   fail:
3874     
3875     SWIG_croak_null();
3876   }
3877 }
3878
3879
3880 XS(_wrap_Device_is_eom) {
3881   {
3882     Device *arg1 = (Device *) 0 ;
3883     void *argp1 = 0 ;
3884     int res1 = 0 ;
3885     int argvi = 0;
3886     gboolean result;
3887     dXSARGS;
3888     
3889     if ((items < 1) || (items > 1)) {
3890       SWIG_croak("Usage: Device_is_eom(self);");
3891     }
3892     res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
3893     if (!SWIG_IsOK(res1)) {
3894       SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_is_eom" "', argument " "1"" of type '" "Device *""'"); 
3895     }
3896     arg1 = (Device *)(argp1);
3897     result = (gboolean)Device_is_eom(arg1);
3898     {
3899       if (result)
3900       ST(argvi) = &PL_sv_yes;
3901       else
3902       ST(argvi) = &PL_sv_no;
3903       argvi++;
3904     }
3905     
3906     XSRETURN(argvi);
3907   fail:
3908     
3909     SWIG_croak_null();
3910   }
3911 }
3912
3913
3914 XS(_wrap_Device_volume_label) {
3915   {
3916     Device *arg1 = (Device *) 0 ;
3917     void *argp1 = 0 ;
3918     int res1 = 0 ;
3919     int argvi = 0;
3920     char *result = 0 ;
3921     dXSARGS;
3922     
3923     if ((items < 1) || (items > 1)) {
3924       SWIG_croak("Usage: Device_volume_label(self);");
3925     }
3926     res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
3927     if (!SWIG_IsOK(res1)) {
3928       SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_volume_label" "', argument " "1"" of type '" "Device *""'"); 
3929     }
3930     arg1 = (Device *)(argp1);
3931     result = (char *)Device_volume_label(arg1);
3932     ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
3933     
3934     XSRETURN(argvi);
3935   fail:
3936     
3937     SWIG_croak_null();
3938   }
3939 }
3940
3941
3942 XS(_wrap_Device_volume_time) {
3943   {
3944     Device *arg1 = (Device *) 0 ;
3945     void *argp1 = 0 ;
3946     int res1 = 0 ;
3947     int argvi = 0;
3948     char *result = 0 ;
3949     dXSARGS;
3950     
3951     if ((items < 1) || (items > 1)) {
3952       SWIG_croak("Usage: Device_volume_time(self);");
3953     }
3954     res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
3955     if (!SWIG_IsOK(res1)) {
3956       SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_volume_time" "', argument " "1"" of type '" "Device *""'"); 
3957     }
3958     arg1 = (Device *)(argp1);
3959     result = (char *)Device_volume_time(arg1);
3960     ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
3961     
3962     XSRETURN(argvi);
3963   fail:
3964     
3965     SWIG_croak_null();
3966   }
3967 }
3968
3969
3970 XS(_wrap_Device_status) {
3971   {
3972     Device *arg1 = (Device *) 0 ;
3973     void *argp1 = 0 ;
3974     int res1 = 0 ;
3975     int argvi = 0;
3976     DeviceStatusFlags result;
3977     dXSARGS;
3978     
3979     if ((items < 1) || (items > 1)) {
3980       SWIG_croak("Usage: Device_status(self);");
3981     }
3982     res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
3983     if (!SWIG_IsOK(res1)) {
3984       SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_status" "', argument " "1"" of type '" "Device *""'"); 
3985     }
3986     arg1 = (Device *)(argp1);
3987     result = (DeviceStatusFlags)Device_status(arg1);
3988     {
3989       SV *for_stack;
3990       SP += argvi; PUTBACK;
3991       for_stack = sv_2mortal(amglue_newSVi64(result));
3992       SPAGAIN; SP -= argvi;
3993       ST(argvi) = for_stack;
3994       argvi++;
3995     }
3996     
3997     XSRETURN(argvi);
3998   fail:
3999     
4000     SWIG_croak_null();
4001   }
4002 }
4003
4004
4005 XS(_wrap_Device_min_block_size) {
4006   {
4007     Device *arg1 = (Device *) 0 ;
4008     void *argp1 = 0 ;
4009     int res1 = 0 ;
4010     int argvi = 0;
4011     gsize result;
4012     dXSARGS;
4013     
4014     if ((items < 1) || (items > 1)) {
4015       SWIG_croak("Usage: Device_min_block_size(self);");
4016     }
4017     res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
4018     if (!SWIG_IsOK(res1)) {
4019       SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_min_block_size" "', argument " "1"" of type '" "Device *""'"); 
4020     }
4021     arg1 = (Device *)(argp1);
4022     result = Device_min_block_size(arg1);
4023     {
4024       SV *for_stack;
4025       SP += argvi; PUTBACK;
4026       for_stack = sv_2mortal(amglue_newSVu64(result));
4027       SPAGAIN; SP -= argvi;
4028       ST(argvi) = for_stack;
4029       argvi++;
4030     }
4031     
4032     XSRETURN(argvi);
4033   fail:
4034     
4035     SWIG_croak_null();
4036   }
4037 }
4038
4039
4040 XS(_wrap_Device_max_block_size) {
4041   {
4042     Device *arg1 = (Device *) 0 ;
4043     void *argp1 = 0 ;
4044     int res1 = 0 ;
4045     int argvi = 0;
4046     gsize result;
4047     dXSARGS;
4048     
4049     if ((items < 1) || (items > 1)) {
4050       SWIG_croak("Usage: Device_max_block_size(self);");
4051     }
4052     res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
4053     if (!SWIG_IsOK(res1)) {
4054       SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_max_block_size" "', argument " "1"" of type '" "Device *""'"); 
4055     }
4056     arg1 = (Device *)(argp1);
4057     result = Device_max_block_size(arg1);
4058     {
4059       SV *for_stack;
4060       SP += argvi; PUTBACK;
4061       for_stack = sv_2mortal(amglue_newSVu64(result));
4062       SPAGAIN; SP -= argvi;
4063       ST(argvi) = for_stack;
4064       argvi++;
4065     }
4066     
4067     XSRETURN(argvi);
4068   fail:
4069     
4070     SWIG_croak_null();
4071   }
4072 }
4073
4074
4075 XS(_wrap_Device_block_size) {
4076   {
4077     Device *arg1 = (Device *) 0 ;
4078     void *argp1 = 0 ;
4079     int res1 = 0 ;
4080     int argvi = 0;
4081     gsize result;
4082     dXSARGS;
4083     
4084     if ((items < 1) || (items > 1)) {
4085       SWIG_croak("Usage: Device_block_size(self);");
4086     }
4087     res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
4088     if (!SWIG_IsOK(res1)) {
4089       SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_block_size" "', argument " "1"" of type '" "Device *""'"); 
4090     }
4091     arg1 = (Device *)(argp1);
4092     result = Device_block_size(arg1);
4093     {
4094       SV *for_stack;
4095       SP += argvi; PUTBACK;
4096       for_stack = sv_2mortal(amglue_newSVu64(result));
4097       SPAGAIN; SP -= argvi;
4098       ST(argvi) = for_stack;
4099       argvi++;
4100     }
4101     
4102     XSRETURN(argvi);
4103   fail:
4104     
4105     SWIG_croak_null();
4106   }
4107 }
4108
4109
4110 XS(_wrap_Device_volume_header) {
4111   {
4112     Device *arg1 = (Device *) 0 ;
4113     void *argp1 = 0 ;
4114     int res1 = 0 ;
4115     int argvi = 0;
4116     dumpfile_t *result = 0 ;
4117     dXSARGS;
4118     
4119     if ((items < 1) || (items > 1)) {
4120       SWIG_croak("Usage: Device_volume_header(self);");
4121     }
4122     res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
4123     if (!SWIG_IsOK(res1)) {
4124       SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_volume_header" "', argument " "1"" of type '" "Device *""'"); 
4125     }
4126     arg1 = (Device *)(argp1);
4127     result = (dumpfile_t *)Device_volume_header(arg1);
4128     ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_dumpfile_t, 0 | SWIG_SHADOW); argvi++ ;
4129     
4130     XSRETURN(argvi);
4131   fail:
4132     
4133     SWIG_croak_null();
4134   }
4135 }
4136
4137
4138 XS(_wrap_rait_device_open_from_children) {
4139   {
4140     GSList *arg1 = (GSList *) 0 ;
4141     int argvi = 0;
4142     Device *result = 0 ;
4143     dXSARGS;
4144     
4145     if ((items < 1) || (items > 1)) {
4146       SWIG_croak("Usage: rait_device_open_from_children(child_devices);");
4147     }
4148     {
4149       AV *av;
4150       int i, len;
4151       
4152       if (!SvROK(ST(0)) || SvTYPE(SvRV(ST(0))) != SVt_PVAV) {
4153         SWIG_exception(SWIG_TypeError, "Expected an arrayref");
4154       }
4155       av = (AV *)SvRV(ST(0));
4156       
4157       arg1 = NULL;
4158       len = av_len(av);
4159       for (i = 0; i <= len; i++) {
4160         SV **elt = av_fetch(av, i, 0);
4161         Device *d;
4162         
4163         if (elt && !SvOK(*elt)) {
4164           arg1 = g_slist_append(arg1, NULL); /* 'undef' => NULL */
4165         } else if (!elt || SWIG_ConvertPtr(*elt, (void **)&d, SWIGTYPE_p_Device, 0) == -1) {
4166           SWIG_exception(SWIG_TypeError, "array member is not a Device");
4167         } else {
4168           arg1 = g_slist_append(arg1, d);
4169         }
4170       }
4171     }
4172     result = (Device *)rait_device_open_from_children(arg1);
4173     ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Device, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
4174     {
4175       g_slist_free(arg1);
4176     }
4177     XSRETURN(argvi);
4178   fail:
4179     {
4180       g_slist_free(arg1);
4181     }
4182     SWIG_croak_null();
4183   }
4184 }
4185
4186
4187 XS(_wrap_write_random_to_device) {
4188   {
4189     guint32 arg1 ;
4190     size_t arg2 ;
4191     Device *arg3 = (Device *) 0 ;
4192     void *argp3 = 0 ;
4193     int res3 = 0 ;
4194     int argvi = 0;
4195     gboolean result;
4196     dXSARGS;
4197     
4198     if ((items < 3) || (items > 3)) {
4199       SWIG_croak("Usage: write_random_to_device(seed,length,device);");
4200     }
4201     {
4202       arg1 = amglue_SvU32(ST(0));
4203     }
4204     {
4205       if (sizeof(size_t) == 1) {
4206         arg2 = amglue_SvU8(ST(1));
4207       } else if (sizeof(size_t) == 2) {
4208         arg2 = amglue_SvU16(ST(1));
4209       } else if (sizeof(size_t) == 4) {
4210         arg2 = amglue_SvU32(ST(1));
4211       } else if (sizeof(size_t) == 8) {
4212         arg2 = amglue_SvU64(ST(1));
4213       } else {
4214         croak("Unexpected size_t >64 bits?"); /* should be optimized out unless sizeof(size_t) > 8 */
4215       }
4216     }
4217     res3 = SWIG_ConvertPtr(ST(2), &argp3,SWIGTYPE_p_Device, 0 |  0 );
4218     if (!SWIG_IsOK(res3)) {
4219       SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "write_random_to_device" "', argument " "3"" of type '" "Device *""'"); 
4220     }
4221     arg3 = (Device *)(argp3);
4222     result = (gboolean)write_random_to_device(arg1,arg2,arg3);
4223     {
4224       if (result)
4225       ST(argvi) = &PL_sv_yes;
4226       else
4227       ST(argvi) = &PL_sv_no;
4228       argvi++;
4229     }
4230     
4231     
4232     XSRETURN(argvi);
4233   fail:
4234     
4235     
4236     SWIG_croak_null();
4237   }
4238 }
4239
4240
4241 XS(_wrap_verify_random_from_device) {
4242   {
4243     guint32 arg1 ;
4244     size_t arg2 ;
4245     Device *arg3 = (Device *) 0 ;
4246     void *argp3 = 0 ;
4247     int res3 = 0 ;
4248     int argvi = 0;
4249     gboolean result;
4250     dXSARGS;
4251     
4252     if ((items < 3) || (items > 3)) {
4253       SWIG_croak("Usage: verify_random_from_device(seed,length,device);");
4254     }
4255     {
4256       arg1 = amglue_SvU32(ST(0));
4257     }
4258     {
4259       if (sizeof(size_t) == 1) {
4260         arg2 = amglue_SvU8(ST(1));
4261       } else if (sizeof(size_t) == 2) {
4262         arg2 = amglue_SvU16(ST(1));
4263       } else if (sizeof(size_t) == 4) {
4264         arg2 = amglue_SvU32(ST(1));
4265       } else if (sizeof(size_t) == 8) {
4266         arg2 = amglue_SvU64(ST(1));
4267       } else {
4268         croak("Unexpected size_t >64 bits?"); /* should be optimized out unless sizeof(size_t) > 8 */
4269       }
4270     }
4271     res3 = SWIG_ConvertPtr(ST(2), &argp3,SWIGTYPE_p_Device, 0 |  0 );
4272     if (!SWIG_IsOK(res3)) {
4273       SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "verify_random_from_device" "', argument " "3"" of type '" "Device *""'"); 
4274     }
4275     arg3 = (Device *)(argp3);
4276     result = (gboolean)verify_random_from_device(arg1,arg2,arg3);
4277     {
4278       if (result)
4279       ST(argvi) = &PL_sv_yes;
4280       else
4281       ST(argvi) = &PL_sv_no;
4282       argvi++;
4283     }
4284     
4285     
4286     XSRETURN(argvi);
4287   fail:
4288     
4289     
4290     SWIG_croak_null();
4291   }
4292 }
4293
4294
4295 XS(_wrap_IS_WRITABLE_ACCESS_MODE) {
4296   {
4297     DeviceAccessMode arg1 ;
4298     int argvi = 0;
4299     gboolean result;
4300     dXSARGS;
4301     
4302     if ((items < 1) || (items > 1)) {
4303       SWIG_croak("Usage: IS_WRITABLE_ACCESS_MODE(mode);");
4304     }
4305     {
4306       if (sizeof(signed int) == 1) {
4307         arg1 = amglue_SvI8(ST(0));
4308       } else if (sizeof(signed int) == 2) {
4309         arg1 = amglue_SvI16(ST(0));
4310       } else if (sizeof(signed int) == 4) {
4311         arg1 = amglue_SvI32(ST(0));
4312       } else if (sizeof(signed int) == 8) {
4313         arg1 = amglue_SvI64(ST(0));
4314       } else {
4315         g_critical("Unexpected signed int >64 bits?"); /* should be optimized out unless sizeof(signed int) > 8 */
4316       }
4317     }
4318     result = (gboolean)IS_WRITABLE_ACCESS_MODE(arg1);
4319     {
4320       if (result)
4321       ST(argvi) = &PL_sv_yes;
4322       else
4323       ST(argvi) = &PL_sv_no;
4324       argvi++;
4325     }
4326     
4327     XSRETURN(argvi);
4328   fail:
4329     
4330     SWIG_croak_null();
4331   }
4332 }
4333
4334
4335
4336 /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
4337
4338 static swig_type_info _swigt__p_Device = {"_p_Device", "struct Device *|Device *", 0, 0, (void*)"Amanda::Device::Device", 0};
4339 static swig_type_info _swigt__p_DevicePropertyBase = {"_p_DevicePropertyBase", "DevicePropertyBase *", 0, 0, (void*)0, 0};
4340 static swig_type_info _swigt__p_DirectTCPAddr = {"_p_DirectTCPAddr", "DirectTCPAddr *", 0, 0, (void*)0, 0};
4341 static swig_type_info _swigt__p_DirectTCPConnection = {"_p_DirectTCPConnection", "struct DirectTCPConnection *|DirectTCPConnection *", 0, 0, (void*)"Amanda::Device::DirectTCPConnection", 0};
4342 static swig_type_info _swigt__p_GSList = {"_p_GSList", "GSList *", 0, 0, (void*)0, 0};
4343 static swig_type_info _swigt__p_GValue = {"_p_GValue", "GValue *", 0, 0, (void*)0, 0};
4344 static swig_type_info _swigt__p_a_STRMAX__char = {"_p_a_STRMAX__char", "char (*)[STRMAX]|string_t *", 0, 0, (void*)0, 0};
4345 static swig_type_info _swigt__p_char = {"_p_char", "gchar *|char *", 0, 0, (void*)0, 0};
4346 static swig_type_info _swigt__p_double = {"_p_double", "double *|gdouble *", 0, 0, (void*)0, 0};
4347 static swig_type_info _swigt__p_dumpfile_t = {"_p_dumpfile_t", "dumpfile_t *", 0, 0, (void*)"Amanda::Header::Header", 0};
4348 static swig_type_info _swigt__p_float = {"_p_float", "float *|gfloat *", 0, 0, (void*)0, 0};
4349 static swig_type_info _swigt__p_guint = {"_p_guint", "guint *", 0, 0, (void*)0, 0};
4350 static swig_type_info _swigt__p_guint32 = {"_p_guint32", "guint32 *", 0, 0, (void*)0, 0};
4351 static swig_type_info _swigt__p_guint64 = {"_p_guint64", "guint64 *", 0, 0, (void*)0, 0};
4352 static swig_type_info _swigt__p_int = {"_p_int", "int *|PropertySurety *|ConcurrencyParadigm *|filetype_t *|PropertySource *|StreamingRequirement *|gboolean *|DeviceAccessMode *|MediaAccessMode *|DeviceStatusFlags *|PropertyPhaseFlags *|PropertyAccessFlags *", 0, 0, (void*)0, 0};
4353 static swig_type_info _swigt__p_p_DirectTCPAddr = {"_p_p_DirectTCPAddr", "DirectTCPAddr **", 0, 0, (void*)0, 0};
4354 static swig_type_info _swigt__p_unsigned_char = {"_p_unsigned_char", "guchar *|unsigned char *", 0, 0, (void*)0, 0};
4355
4356 static swig_type_info *swig_type_initial[] = {
4357   &_swigt__p_Device,
4358   &_swigt__p_DevicePropertyBase,
4359   &_swigt__p_DirectTCPAddr,
4360   &_swigt__p_DirectTCPConnection,
4361   &_swigt__p_GSList,
4362   &_swigt__p_GValue,
4363   &_swigt__p_a_STRMAX__char,
4364   &_swigt__p_char,
4365   &_swigt__p_double,
4366   &_swigt__p_dumpfile_t,
4367   &_swigt__p_float,
4368   &_swigt__p_guint,
4369   &_swigt__p_guint32,
4370   &_swigt__p_guint64,
4371   &_swigt__p_int,
4372   &_swigt__p_p_DirectTCPAddr,
4373   &_swigt__p_unsigned_char,
4374 };
4375
4376 static swig_cast_info _swigc__p_Device[] = {  {&_swigt__p_Device, 0, 0, 0},{0, 0, 0, 0}};
4377 static swig_cast_info _swigc__p_DevicePropertyBase[] = {  {&_swigt__p_DevicePropertyBase, 0, 0, 0},{0, 0, 0, 0}};
4378 static swig_cast_info _swigc__p_DirectTCPAddr[] = {  {&_swigt__p_DirectTCPAddr, 0, 0, 0},{0, 0, 0, 0}};
4379 static swig_cast_info _swigc__p_DirectTCPConnection[] = {  {&_swigt__p_DirectTCPConnection, 0, 0, 0},{0, 0, 0, 0}};
4380 static swig_cast_info _swigc__p_GSList[] = {  {&_swigt__p_GSList, 0, 0, 0},{0, 0, 0, 0}};
4381 static swig_cast_info _swigc__p_GValue[] = {  {&_swigt__p_GValue, 0, 0, 0},{0, 0, 0, 0}};
4382 static swig_cast_info _swigc__p_a_STRMAX__char[] = {  {&_swigt__p_a_STRMAX__char, 0, 0, 0},{0, 0, 0, 0}};
4383 static swig_cast_info _swigc__p_char[] = {  {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
4384 static swig_cast_info _swigc__p_double[] = {  {&_swigt__p_double, 0, 0, 0},{0, 0, 0, 0}};
4385 static swig_cast_info _swigc__p_dumpfile_t[] = {  {&_swigt__p_dumpfile_t, 0, 0, 0},{0, 0, 0, 0}};
4386 static swig_cast_info _swigc__p_float[] = {  {&_swigt__p_float, 0, 0, 0},{0, 0, 0, 0}};
4387 static swig_cast_info _swigc__p_guint[] = {  {&_swigt__p_guint, 0, 0, 0},{0, 0, 0, 0}};
4388 static swig_cast_info _swigc__p_guint32[] = {  {&_swigt__p_guint32, 0, 0, 0},{0, 0, 0, 0}};
4389 static swig_cast_info _swigc__p_guint64[] = {  {&_swigt__p_guint64, 0, 0, 0},{0, 0, 0, 0}};
4390 static swig_cast_info _swigc__p_int[] = {  {&_swigt__p_int, 0, 0, 0},{0, 0, 0, 0}};
4391 static swig_cast_info _swigc__p_p_DirectTCPAddr[] = {  {&_swigt__p_p_DirectTCPAddr, 0, 0, 0},{0, 0, 0, 0}};
4392 static swig_cast_info _swigc__p_unsigned_char[] = {  {&_swigt__p_unsigned_char, 0, 0, 0},{0, 0, 0, 0}};
4393
4394 static swig_cast_info *swig_cast_initial[] = {
4395   _swigc__p_Device,
4396   _swigc__p_DevicePropertyBase,
4397   _swigc__p_DirectTCPAddr,
4398   _swigc__p_DirectTCPConnection,
4399   _swigc__p_GSList,
4400   _swigc__p_GValue,
4401   _swigc__p_a_STRMAX__char,
4402   _swigc__p_char,
4403   _swigc__p_double,
4404   _swigc__p_dumpfile_t,
4405   _swigc__p_float,
4406   _swigc__p_guint,
4407   _swigc__p_guint32,
4408   _swigc__p_guint64,
4409   _swigc__p_int,
4410   _swigc__p_p_DirectTCPAddr,
4411   _swigc__p_unsigned_char,
4412 };
4413
4414
4415 /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
4416
4417 static swig_constant_info swig_constants[] = {
4418 {0,0,0,0,0,0}
4419 };
4420 #ifdef __cplusplus
4421 }
4422 #endif
4423 static swig_variable_info swig_variables[] = {
4424 {0,0,0,0}
4425 };
4426 static swig_command_info swig_commands[] = {
4427 {"Amanda::Devicec::delete_DirectTCPConnection", _wrap_delete_DirectTCPConnection},
4428 {"Amanda::Devicec::DirectTCPConnection_close", _wrap_DirectTCPConnection_close},
4429 {"Amanda::Devicec::new_DirectTCPConnection", _wrap_new_DirectTCPConnection},
4430 {"Amanda::Devicec::unaliased_name", _wrap_unaliased_name},
4431 {"Amanda::Devicec::new_Device", _wrap_new_Device},
4432 {"Amanda::Devicec::delete_Device", _wrap_delete_Device},
4433 {"Amanda::Devicec::Device_configure", _wrap_Device_configure},
4434 {"Amanda::Devicec::Device_error", _wrap_Device_error},
4435 {"Amanda::Devicec::Device_status_error", _wrap_Device_status_error},
4436 {"Amanda::Devicec::Device_error_or_status", _wrap_Device_error_or_status},
4437 {"Amanda::Devicec::Device_read_label", _wrap_Device_read_label},
4438 {"Amanda::Devicec::Device_start", _wrap_Device_start},
4439 {"Amanda::Devicec::Device_finish", _wrap_Device_finish},
4440 {"Amanda::Devicec::Device_start_file", _wrap_Device_start_file},
4441 {"Amanda::Devicec::Device_write_block", _wrap_Device_write_block},
4442 {"Amanda::Devicec::Device_finish_file", _wrap_Device_finish_file},
4443 {"Amanda::Devicec::Device_seek_file", _wrap_Device_seek_file},
4444 {"Amanda::Devicec::Device_seek_block", _wrap_Device_seek_block},
4445 {"Amanda::Devicec::Device_read_block", _wrap_Device_read_block},
4446 {"Amanda::Devicec::Device_erase", _wrap_Device_erase},
4447 {"Amanda::Devicec::Device_eject", _wrap_Device_eject},
4448 {"Amanda::Devicec::Device_directtcp_supported", _wrap_Device_directtcp_supported},
4449 {"Amanda::Devicec::Device_listen", _wrap_Device_listen},
4450 {"Amanda::Devicec::Device_accept", _wrap_Device_accept},
4451 {"Amanda::Devicec::Device_connect", _wrap_Device_connect},
4452 {"Amanda::Devicec::Device_use_connection", _wrap_Device_use_connection},
4453 {"Amanda::Devicec::Device_write_from_connection", _wrap_Device_write_from_connection},
4454 {"Amanda::Devicec::Device_read_to_connection", _wrap_Device_read_to_connection},
4455 {"Amanda::Devicec::Device_property_list", _wrap_Device_property_list},
4456 {"Amanda::Devicec::Device_property_get", _wrap_Device_property_get},
4457 {"Amanda::Devicec::Device_property_set", _wrap_Device_property_set},
4458 {"Amanda::Devicec::Device_property_set_ex", _wrap_Device_property_set_ex},
4459 {"Amanda::Devicec::Device_recycle_file", _wrap_Device_recycle_file},
4460 {"Amanda::Devicec::Device_file", _wrap_Device_file},
4461 {"Amanda::Devicec::Device_block", _wrap_Device_block},
4462 {"Amanda::Devicec::Device_in_file", _wrap_Device_in_file},
4463 {"Amanda::Devicec::Device_device_name", _wrap_Device_device_name},
4464 {"Amanda::Devicec::Device_access_mode", _wrap_Device_access_mode},
4465 {"Amanda::Devicec::Device_is_eof", _wrap_Device_is_eof},
4466 {"Amanda::Devicec::Device_is_eom", _wrap_Device_is_eom},
4467 {"Amanda::Devicec::Device_volume_label", _wrap_Device_volume_label},
4468 {"Amanda::Devicec::Device_volume_time", _wrap_Device_volume_time},
4469 {"Amanda::Devicec::Device_status", _wrap_Device_status},
4470 {"Amanda::Devicec::Device_min_block_size", _wrap_Device_min_block_size},
4471 {"Amanda::Devicec::Device_max_block_size", _wrap_Device_max_block_size},
4472 {"Amanda::Devicec::Device_block_size", _wrap_Device_block_size},
4473 {"Amanda::Devicec::Device_volume_header", _wrap_Device_volume_header},
4474 {"Amanda::Devicec::rait_device_open_from_children", _wrap_rait_device_open_from_children},
4475 {"Amanda::Devicec::write_random_to_device", _wrap_write_random_to_device},
4476 {"Amanda::Devicec::verify_random_from_device", _wrap_verify_random_from_device},
4477 {"Amanda::Devicec::IS_WRITABLE_ACCESS_MODE", _wrap_IS_WRITABLE_ACCESS_MODE},
4478 {0,0}
4479 };
4480 /* -----------------------------------------------------------------------------
4481  * Type initialization:
4482  * This problem is tough by the requirement that no dynamic 
4483  * memory is used. Also, since swig_type_info structures store pointers to 
4484  * swig_cast_info structures and swig_cast_info structures store pointers back
4485  * to swig_type_info structures, we need some lookup code at initialization. 
4486  * The idea is that swig generates all the structures that are needed. 
4487  * The runtime then collects these partially filled structures. 
4488  * The SWIG_InitializeModule function takes these initial arrays out of 
4489  * swig_module, and does all the lookup, filling in the swig_module.types
4490  * array with the correct data and linking the correct swig_cast_info
4491  * structures together.
4492  *
4493  * The generated swig_type_info structures are assigned staticly to an initial 
4494  * array. We just loop through that array, and handle each type individually.
4495  * First we lookup if this type has been already loaded, and if so, use the
4496  * loaded structure instead of the generated one. Then we have to fill in the
4497  * cast linked list. The cast data is initially stored in something like a
4498  * two-dimensional array. Each row corresponds to a type (there are the same
4499  * number of rows as there are in the swig_type_initial array). Each entry in
4500  * a column is one of the swig_cast_info structures for that type.
4501  * The cast_initial array is actually an array of arrays, because each row has
4502  * a variable number of columns. So to actually build the cast linked list,
4503  * we find the array of casts associated with the type, and loop through it 
4504  * adding the casts to the list. The one last trick we need to do is making
4505  * sure the type pointer in the swig_cast_info struct is correct.
4506  *
4507  * First off, we lookup the cast->type name to see if it is already loaded. 
4508  * There are three cases to handle:
4509  *  1) If the cast->type has already been loaded AND the type we are adding
4510  *     casting info to has not been loaded (it is in this module), THEN we
4511  *     replace the cast->type pointer with the type pointer that has already
4512  *     been loaded.
4513  *  2) If BOTH types (the one we are adding casting info to, and the 
4514  *     cast->type) are loaded, THEN the cast info has already been loaded by
4515  *     the previous module so we just ignore it.
4516  *  3) Finally, if cast->type has not already been loaded, then we add that
4517  *     swig_cast_info to the linked list (because the cast->type) pointer will
4518  *     be correct.
4519  * ----------------------------------------------------------------------------- */
4520
4521 #ifdef __cplusplus
4522 extern "C" {
4523 #if 0
4524 } /* c-mode */
4525 #endif
4526 #endif
4527
4528 #if 0
4529 #define SWIGRUNTIME_DEBUG
4530 #endif
4531
4532
4533 SWIGRUNTIME void
4534 SWIG_InitializeModule(void *clientdata) {
4535   size_t i;
4536   swig_module_info *module_head, *iter;
4537   int found, init;
4538   
4539   clientdata = clientdata;
4540   
4541   /* check to see if the circular list has been setup, if not, set it up */
4542   if (swig_module.next==0) {
4543     /* Initialize the swig_module */
4544     swig_module.type_initial = swig_type_initial;
4545     swig_module.cast_initial = swig_cast_initial;
4546     swig_module.next = &swig_module;
4547     init = 1;
4548   } else {
4549     init = 0;
4550   }
4551   
4552   /* Try and load any already created modules */
4553   module_head = SWIG_GetModule(clientdata);
4554   if (!module_head) {
4555     /* This is the first module loaded for this interpreter */
4556     /* so set the swig module into the interpreter */
4557     SWIG_SetModule(clientdata, &swig_module);
4558     module_head = &swig_module;
4559   } else {
4560     /* the interpreter has loaded a SWIG module, but has it loaded this one? */
4561     found=0;
4562     iter=module_head;
4563     do {
4564       if (iter==&swig_module) {
4565         found=1;
4566         break;
4567       }
4568       iter=iter->next;
4569     } while (iter!= module_head);
4570     
4571     /* if the is found in the list, then all is done and we may leave */
4572     if (found) return;
4573     /* otherwise we must add out module into the list */
4574     swig_module.next = module_head->next;
4575     module_head->next = &swig_module;
4576   }
4577   
4578   /* When multiple interpeters are used, a module could have already been initialized in
4579        a different interpreter, but not yet have a pointer in this interpreter.
4580        In this case, we do not want to continue adding types... everything should be
4581        set up already */
4582   if (init == 0) return;
4583   
4584   /* Now work on filling in swig_module.types */
4585 #ifdef SWIGRUNTIME_DEBUG
4586   printf("SWIG_InitializeModule: size %d\n", swig_module.size);
4587 #endif
4588   for (i = 0; i < swig_module.size; ++i) {
4589     swig_type_info *type = 0;
4590     swig_type_info *ret;
4591     swig_cast_info *cast;
4592     
4593 #ifdef SWIGRUNTIME_DEBUG
4594     printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
4595 #endif
4596     
4597     /* if there is another module already loaded */
4598     if (swig_module.next != &swig_module) {
4599       type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
4600     }
4601     if (type) {
4602       /* Overwrite clientdata field */
4603 #ifdef SWIGRUNTIME_DEBUG
4604       printf("SWIG_InitializeModule: found type %s\n", type->name);
4605 #endif
4606       if (swig_module.type_initial[i]->clientdata) {
4607         type->clientdata = swig_module.type_initial[i]->clientdata;
4608 #ifdef SWIGRUNTIME_DEBUG
4609         printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
4610 #endif
4611       }
4612     } else {
4613       type = swig_module.type_initial[i];
4614     }
4615     
4616     /* Insert casting types */
4617     cast = swig_module.cast_initial[i];
4618     while (cast->type) {
4619       /* Don't need to add information already in the list */
4620       ret = 0;
4621 #ifdef SWIGRUNTIME_DEBUG
4622       printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
4623 #endif
4624       if (swig_module.next != &swig_module) {
4625         ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
4626 #ifdef SWIGRUNTIME_DEBUG
4627         if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
4628 #endif
4629       }
4630       if (ret) {
4631         if (type == swig_module.type_initial[i]) {
4632 #ifdef SWIGRUNTIME_DEBUG
4633           printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
4634 #endif
4635           cast->type = ret;
4636           ret = 0;
4637         } else {
4638           /* Check for casting already in the list */
4639           swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
4640 #ifdef SWIGRUNTIME_DEBUG
4641           if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
4642 #endif
4643           if (!ocast) ret = 0;
4644         }
4645       }
4646       
4647       if (!ret) {
4648 #ifdef SWIGRUNTIME_DEBUG
4649         printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
4650 #endif
4651         if (type->cast) {
4652           type->cast->prev = cast;
4653           cast->next = type->cast;
4654         }
4655         type->cast = cast;
4656       }
4657       cast++;
4658     }
4659     /* Set entry in modules->types array equal to the type */
4660     swig_module.types[i] = type;
4661   }
4662   swig_module.types[i] = 0;
4663   
4664 #ifdef SWIGRUNTIME_DEBUG
4665   printf("**** SWIG_InitializeModule: Cast List ******\n");
4666   for (i = 0; i < swig_module.size; ++i) {
4667     int j = 0;
4668     swig_cast_info *cast = swig_module.cast_initial[i];
4669     printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
4670     while (cast->type) {
4671       printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
4672       cast++;
4673       ++j;
4674     }
4675     printf("---- Total casts: %d\n",j);
4676   }
4677   printf("**** SWIG_InitializeModule: Cast List ******\n");
4678 #endif
4679 }
4680
4681 /* This function will propagate the clientdata field of type to
4682 * any new swig_type_info structures that have been added into the list
4683 * of equivalent types.  It is like calling
4684 * SWIG_TypeClientData(type, clientdata) a second time.
4685 */
4686 SWIGRUNTIME void
4687 SWIG_PropagateClientData(void) {
4688   size_t i;
4689   swig_cast_info *equiv;
4690   static int init_run = 0;
4691   
4692   if (init_run) return;
4693   init_run = 1;
4694   
4695   for (i = 0; i < swig_module.size; i++) {
4696     if (swig_module.types[i]->clientdata) {
4697       equiv = swig_module.types[i]->cast;
4698       while (equiv) {
4699         if (!equiv->converter) {
4700           if (equiv->type && !equiv->type->clientdata)
4701           SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
4702         }
4703         equiv = equiv->next;
4704       }
4705     }
4706   }
4707 }
4708
4709 #ifdef __cplusplus
4710 #if 0
4711 {
4712   /* c-mode */
4713 #endif
4714 }
4715 #endif
4716
4717
4718
4719 #ifdef __cplusplus
4720 extern "C"
4721 #endif
4722
4723 XS(SWIG_init) {
4724   dXSARGS;
4725   int i;
4726   
4727   SWIG_InitializeModule(0);
4728   
4729   /* Install commands */
4730   for (i = 0; swig_commands[i].name; i++) {
4731     newXS((char*) swig_commands[i].name,swig_commands[i].wrapper, (char*)__FILE__);
4732   }
4733   
4734   /* Install variables */
4735   for (i = 0; swig_variables[i].name; i++) {
4736     SV *sv;
4737     sv = get_sv((char*) swig_variables[i].name, TRUE | 0x2 | GV_ADDMULTI);
4738     if (swig_variables[i].type) {
4739       SWIG_MakePtr(sv,(void *)1, *swig_variables[i].type,0);
4740     } else {
4741       sv_setiv(sv,(IV) 0);
4742     }
4743     swig_create_magic(sv, (char *) swig_variables[i].name, swig_variables[i].set, swig_variables[i].get); 
4744   }
4745   
4746   /* Install constant */
4747   for (i = 0; swig_constants[i].type; i++) {
4748     SV *sv;
4749     sv = get_sv((char*)swig_constants[i].name, TRUE | 0x2 | GV_ADDMULTI);
4750     switch(swig_constants[i].type) {
4751     case SWIG_INT:
4752       sv_setiv(sv, (IV) swig_constants[i].lvalue);
4753       break;
4754     case SWIG_FLOAT:
4755       sv_setnv(sv, (double) swig_constants[i].dvalue);
4756       break;
4757     case SWIG_STRING:
4758       sv_setpv(sv, (char *) swig_constants[i].pvalue);
4759       break;
4760     case SWIG_POINTER:
4761       SWIG_MakePtr(sv, swig_constants[i].pvalue, *(swig_constants[i].ptype),0);
4762       break;
4763     case SWIG_BINARY:
4764       SWIG_MakePackedObj(sv, swig_constants[i].pvalue, swig_constants[i].lvalue, *(swig_constants[i].ptype));
4765       break;
4766     default:
4767       break;
4768     }
4769     SvREADONLY_on(sv);
4770   }
4771   
4772   
4773   /* Initialize the Device API on load */
4774   device_api_init();
4775   
4776   SWIG_TypeClientData(SWIGTYPE_p_DirectTCPConnection, (void*) "Amanda::Device::DirectTCPConnection");
4777   SWIG_TypeClientData(SWIGTYPE_p_Device, (void*) "Amanda::Device::Device");
4778   /*@SWIG:/usr/share/swig/1.3.39/perl5/perltypemaps.swg,65,%set_constant@*/ do {
4779     SV *sv = get_sv((char*) SWIG_prefix "ACCESS_NULL", TRUE | 0x2 | GV_ADDMULTI);
4780     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(ACCESS_NULL)));
4781     SvREADONLY_on(sv);
4782   } while(0) /*@SWIG@*/;
4783   /*@SWIG:/usr/share/swig/1.3.39/perl5/perltypemaps.swg,65,%set_constant@*/ do {
4784     SV *sv = get_sv((char*) SWIG_prefix "ACCESS_READ", TRUE | 0x2 | GV_ADDMULTI);
4785     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(ACCESS_READ)));
4786     SvREADONLY_on(sv);
4787   } while(0) /*@SWIG@*/;
4788   /*@SWIG:/usr/share/swig/1.3.39/perl5/perltypemaps.swg,65,%set_constant@*/ do {
4789     SV *sv = get_sv((char*) SWIG_prefix "ACCESS_WRITE", TRUE | 0x2 | GV_ADDMULTI);
4790     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(ACCESS_WRITE)));
4791     SvREADONLY_on(sv);
4792   } while(0) /*@SWIG@*/;
4793   /*@SWIG:/usr/share/swig/1.3.39/perl5/perltypemaps.swg,65,%set_constant@*/ do {
4794     SV *sv = get_sv((char*) SWIG_prefix "ACCESS_APPEND", TRUE | 0x2 | GV_ADDMULTI);
4795     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(ACCESS_APPEND)));
4796     SvREADONLY_on(sv);
4797   } while(0) /*@SWIG@*/;
4798   /*@SWIG:/usr/share/swig/1.3.39/perl5/perltypemaps.swg,65,%set_constant@*/ do {
4799     SV *sv = get_sv((char*) SWIG_prefix "DEVICE_STATUS_SUCCESS", TRUE | 0x2 | GV_ADDMULTI);
4800     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(DEVICE_STATUS_SUCCESS)));
4801     SvREADONLY_on(sv);
4802   } while(0) /*@SWIG@*/;
4803   /*@SWIG:/usr/share/swig/1.3.39/perl5/perltypemaps.swg,65,%set_constant@*/ do {
4804     SV *sv = get_sv((char*) SWIG_prefix "DEVICE_STATUS_DEVICE_ERROR", TRUE | 0x2 | GV_ADDMULTI);
4805     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(DEVICE_STATUS_DEVICE_ERROR)));
4806     SvREADONLY_on(sv);
4807   } while(0) /*@SWIG@*/;
4808   /*@SWIG:/usr/share/swig/1.3.39/perl5/perltypemaps.swg,65,%set_constant@*/ do {
4809     SV *sv = get_sv((char*) SWIG_prefix "DEVICE_STATUS_DEVICE_BUSY", TRUE | 0x2 | GV_ADDMULTI);
4810     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(DEVICE_STATUS_DEVICE_BUSY)));
4811     SvREADONLY_on(sv);
4812   } while(0) /*@SWIG@*/;
4813   /*@SWIG:/usr/share/swig/1.3.39/perl5/perltypemaps.swg,65,%set_constant@*/ do {
4814     SV *sv = get_sv((char*) SWIG_prefix "DEVICE_STATUS_VOLUME_MISSING", TRUE | 0x2 | GV_ADDMULTI);
4815     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(DEVICE_STATUS_VOLUME_MISSING)));
4816     SvREADONLY_on(sv);
4817   } while(0) /*@SWIG@*/;
4818   /*@SWIG:/usr/share/swig/1.3.39/perl5/perltypemaps.swg,65,%set_constant@*/ do {
4819     SV *sv = get_sv((char*) SWIG_prefix "DEVICE_STATUS_VOLUME_UNLABELED", TRUE | 0x2 | GV_ADDMULTI);
4820     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(DEVICE_STATUS_VOLUME_UNLABELED)));
4821     SvREADONLY_on(sv);
4822   } while(0) /*@SWIG@*/;
4823   /*@SWIG:/usr/share/swig/1.3.39/perl5/perltypemaps.swg,65,%set_constant@*/ do {
4824     SV *sv = get_sv((char*) SWIG_prefix "DEVICE_STATUS_VOLUME_ERROR", TRUE | 0x2 | GV_ADDMULTI);
4825     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(DEVICE_STATUS_VOLUME_ERROR)));
4826     SvREADONLY_on(sv);
4827   } while(0) /*@SWIG@*/;
4828   /*@SWIG:/usr/share/swig/1.3.39/perl5/perltypemaps.swg,65,%set_constant@*/ do {
4829     SV *sv = get_sv((char*) SWIG_prefix "DEVICE_STATUS_FLAGS_MAX", TRUE | 0x2 | GV_ADDMULTI);
4830     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(DEVICE_STATUS_FLAGS_MAX)));
4831     SvREADONLY_on(sv);
4832   } while(0) /*@SWIG@*/;
4833   /*@SWIG:/usr/share/swig/1.3.39/perl5/perltypemaps.swg,65,%set_constant@*/ do {
4834     SV *sv = get_sv((char*) SWIG_prefix "PROPERTY_PHASE_BEFORE_START", TRUE | 0x2 | GV_ADDMULTI);
4835     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(PROPERTY_PHASE_BEFORE_START)));
4836     SvREADONLY_on(sv);
4837   } while(0) /*@SWIG@*/;
4838   /*@SWIG:/usr/share/swig/1.3.39/perl5/perltypemaps.swg,65,%set_constant@*/ do {
4839     SV *sv = get_sv((char*) SWIG_prefix "PROPERTY_PHASE_BETWEEN_FILE_WRITE", TRUE | 0x2 | GV_ADDMULTI);
4840     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(PROPERTY_PHASE_BETWEEN_FILE_WRITE)));
4841     SvREADONLY_on(sv);
4842   } while(0) /*@SWIG@*/;
4843   /*@SWIG:/usr/share/swig/1.3.39/perl5/perltypemaps.swg,65,%set_constant@*/ do {
4844     SV *sv = get_sv((char*) SWIG_prefix "PROPERTY_PHASE_INSIDE_FILE_WRITE", TRUE | 0x2 | GV_ADDMULTI);
4845     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(PROPERTY_PHASE_INSIDE_FILE_WRITE)));
4846     SvREADONLY_on(sv);
4847   } while(0) /*@SWIG@*/;
4848   /*@SWIG:/usr/share/swig/1.3.39/perl5/perltypemaps.swg,65,%set_constant@*/ do {
4849     SV *sv = get_sv((char*) SWIG_prefix "PROPERTY_PHASE_BETWEEN_FILE_READ", TRUE | 0x2 | GV_ADDMULTI);
4850     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(PROPERTY_PHASE_BETWEEN_FILE_READ)));
4851     SvREADONLY_on(sv);
4852   } while(0) /*@SWIG@*/;
4853   /*@SWIG:/usr/share/swig/1.3.39/perl5/perltypemaps.swg,65,%set_constant@*/ do {
4854     SV *sv = get_sv((char*) SWIG_prefix "PROPERTY_PHASE_INSIDE_FILE_READ", TRUE | 0x2 | GV_ADDMULTI);
4855     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(PROPERTY_PHASE_INSIDE_FILE_READ)));
4856     SvREADONLY_on(sv);
4857   } while(0) /*@SWIG@*/;
4858   /*@SWIG:/usr/share/swig/1.3.39/perl5/perltypemaps.swg,65,%set_constant@*/ do {
4859     SV *sv = get_sv((char*) SWIG_prefix "PROPERTY_PHASE_MAX", TRUE | 0x2 | GV_ADDMULTI);
4860     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(PROPERTY_PHASE_MAX)));
4861     SvREADONLY_on(sv);
4862   } while(0) /*@SWIG@*/;
4863   /*@SWIG:/usr/share/swig/1.3.39/perl5/perltypemaps.swg,65,%set_constant@*/ do {
4864     SV *sv = get_sv((char*) SWIG_prefix "PROPERTY_PHASE_MASK", TRUE | 0x2 | GV_ADDMULTI);
4865     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(PROPERTY_PHASE_MASK)));
4866     SvREADONLY_on(sv);
4867   } while(0) /*@SWIG@*/;
4868   /*@SWIG:/usr/share/swig/1.3.39/perl5/perltypemaps.swg,65,%set_constant@*/ do {
4869     SV *sv = get_sv((char*) SWIG_prefix "PROPERTY_PHASE_SHIFT", TRUE | 0x2 | GV_ADDMULTI);
4870     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(PROPERTY_PHASE_SHIFT)));
4871     SvREADONLY_on(sv);
4872   } while(0) /*@SWIG@*/;
4873   /*@SWIG:/usr/share/swig/1.3.39/perl5/perltypemaps.swg,65,%set_constant@*/ do {
4874     SV *sv = get_sv((char*) SWIG_prefix "PROPERTY_ACCESS_GET_BEFORE_START", TRUE | 0x2 | GV_ADDMULTI);
4875     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(PROPERTY_ACCESS_GET_BEFORE_START)));
4876     SvREADONLY_on(sv);
4877   } while(0) /*@SWIG@*/;
4878   /*@SWIG:/usr/share/swig/1.3.39/perl5/perltypemaps.swg,65,%set_constant@*/ do {
4879     SV *sv = get_sv((char*) SWIG_prefix "PROPERTY_ACCESS_GET_BETWEEN_FILE_WRITE", TRUE | 0x2 | GV_ADDMULTI);
4880     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(PROPERTY_ACCESS_GET_BETWEEN_FILE_WRITE)));
4881     SvREADONLY_on(sv);
4882   } while(0) /*@SWIG@*/;
4883   /*@SWIG:/usr/share/swig/1.3.39/perl5/perltypemaps.swg,65,%set_constant@*/ do {
4884     SV *sv = get_sv((char*) SWIG_prefix "PROPERTY_ACCESS_GET_INSIDE_FILE_WRITE", TRUE | 0x2 | GV_ADDMULTI);
4885     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(PROPERTY_ACCESS_GET_INSIDE_FILE_WRITE)));
4886     SvREADONLY_on(sv);
4887   } while(0) /*@SWIG@*/;
4888   /*@SWIG:/usr/share/swig/1.3.39/perl5/perltypemaps.swg,65,%set_constant@*/ do {
4889     SV *sv = get_sv((char*) SWIG_prefix "PROPERTY_ACCESS_GET_BETWEEN_FILE_READ", TRUE | 0x2 | GV_ADDMULTI);
4890     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(PROPERTY_ACCESS_GET_BETWEEN_FILE_READ)));
4891     SvREADONLY_on(sv);
4892   } while(0) /*@SWIG@*/;
4893   /*@SWIG:/usr/share/swig/1.3.39/perl5/perltypemaps.swg,65,%set_constant@*/ do {
4894     SV *sv = get_sv((char*) SWIG_prefix "PROPERTY_ACCESS_GET_INSIDE_FILE_READ", TRUE | 0x2 | GV_ADDMULTI);
4895     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(PROPERTY_ACCESS_GET_INSIDE_FILE_READ)));
4896     SvREADONLY_on(sv);
4897   } while(0) /*@SWIG@*/;
4898   /*@SWIG:/usr/share/swig/1.3.39/perl5/perltypemaps.swg,65,%set_constant@*/ do {
4899     SV *sv = get_sv((char*) SWIG_prefix "PROPERTY_ACCESS_SET_BEFORE_START", TRUE | 0x2 | GV_ADDMULTI);
4900     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(PROPERTY_ACCESS_SET_BEFORE_START)));
4901     SvREADONLY_on(sv);
4902   } while(0) /*@SWIG@*/;
4903   /*@SWIG:/usr/share/swig/1.3.39/perl5/perltypemaps.swg,65,%set_constant@*/ do {
4904     SV *sv = get_sv((char*) SWIG_prefix "PROPERTY_ACCESS_SET_BETWEEN_FILE_WRITE", TRUE | 0x2 | GV_ADDMULTI);
4905     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(PROPERTY_ACCESS_SET_BETWEEN_FILE_WRITE)));
4906     SvREADONLY_on(sv);
4907   } while(0) /*@SWIG@*/;
4908   /*@SWIG:/usr/share/swig/1.3.39/perl5/perltypemaps.swg,65,%set_constant@*/ do {
4909     SV *sv = get_sv((char*) SWIG_prefix "PROPERTY_ACCESS_SET_INSIDE_FILE_WRITE", TRUE | 0x2 | GV_ADDMULTI);
4910     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(PROPERTY_ACCESS_SET_INSIDE_FILE_WRITE)));
4911     SvREADONLY_on(sv);
4912   } while(0) /*@SWIG@*/;
4913   /*@SWIG:/usr/share/swig/1.3.39/perl5/perltypemaps.swg,65,%set_constant@*/ do {
4914     SV *sv = get_sv((char*) SWIG_prefix "PROPERTY_ACCESS_SET_BETWEEN_FILE_READ", TRUE | 0x2 | GV_ADDMULTI);
4915     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(PROPERTY_ACCESS_SET_BETWEEN_FILE_READ)));
4916     SvREADONLY_on(sv);
4917   } while(0) /*@SWIG@*/;
4918   /*@SWIG:/usr/share/swig/1.3.39/perl5/perltypemaps.swg,65,%set_constant@*/ do {
4919     SV *sv = get_sv((char*) SWIG_prefix "PROPERTY_ACCESS_SET_INSIDE_FILE_READ", TRUE | 0x2 | GV_ADDMULTI);
4920     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(PROPERTY_ACCESS_SET_INSIDE_FILE_READ)));
4921     SvREADONLY_on(sv);
4922   } while(0) /*@SWIG@*/;
4923   /*@SWIG:/usr/share/swig/1.3.39/perl5/perltypemaps.swg,65,%set_constant@*/ do {
4924     SV *sv = get_sv((char*) SWIG_prefix "PROPERTY_ACCESS_GET_MASK", TRUE | 0x2 | GV_ADDMULTI);
4925     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(PROPERTY_ACCESS_GET_MASK)));
4926     SvREADONLY_on(sv);
4927   } while(0) /*@SWIG@*/;
4928   /*@SWIG:/usr/share/swig/1.3.39/perl5/perltypemaps.swg,65,%set_constant@*/ do {
4929     SV *sv = get_sv((char*) SWIG_prefix "PROPERTY_ACCESS_SET_MASK", TRUE | 0x2 | GV_ADDMULTI);
4930     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(PROPERTY_ACCESS_SET_MASK)));
4931     SvREADONLY_on(sv);
4932   } while(0) /*@SWIG@*/;
4933   /*@SWIG:/usr/share/swig/1.3.39/perl5/perltypemaps.swg,65,%set_constant@*/ do {
4934     SV *sv = get_sv((char*) SWIG_prefix "CONCURRENCY_PARADIGM_EXCLUSIVE", TRUE | 0x2 | GV_ADDMULTI);
4935     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CONCURRENCY_PARADIGM_EXCLUSIVE)));
4936     SvREADONLY_on(sv);
4937   } while(0) /*@SWIG@*/;
4938   /*@SWIG:/usr/share/swig/1.3.39/perl5/perltypemaps.swg,65,%set_constant@*/ do {
4939     SV *sv = get_sv((char*) SWIG_prefix "CONCURRENCY_PARADIGM_SHARED_READ", TRUE | 0x2 | GV_ADDMULTI);
4940     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CONCURRENCY_PARADIGM_SHARED_READ)));
4941     SvREADONLY_on(sv);
4942   } while(0) /*@SWIG@*/;
4943   /*@SWIG:/usr/share/swig/1.3.39/perl5/perltypemaps.swg,65,%set_constant@*/ do {
4944     SV *sv = get_sv((char*) SWIG_prefix "CONCURRENCY_PARADIGM_RANDOM_ACCESS", TRUE | 0x2 | GV_ADDMULTI);
4945     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CONCURRENCY_PARADIGM_RANDOM_ACCESS)));
4946     SvREADONLY_on(sv);
4947   } while(0) /*@SWIG@*/;
4948   /*@SWIG:/usr/share/swig/1.3.39/perl5/perltypemaps.swg,65,%set_constant@*/ do {
4949     SV *sv = get_sv((char*) SWIG_prefix "STREAMING_REQUIREMENT_NONE", TRUE | 0x2 | GV_ADDMULTI);
4950     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(STREAMING_REQUIREMENT_NONE)));
4951     SvREADONLY_on(sv);
4952   } while(0) /*@SWIG@*/;
4953   /*@SWIG:/usr/share/swig/1.3.39/perl5/perltypemaps.swg,65,%set_constant@*/ do {
4954     SV *sv = get_sv((char*) SWIG_prefix "STREAMING_REQUIREMENT_DESIRED", TRUE | 0x2 | GV_ADDMULTI);
4955     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(STREAMING_REQUIREMENT_DESIRED)));
4956     SvREADONLY_on(sv);
4957   } while(0) /*@SWIG@*/;
4958   /*@SWIG:/usr/share/swig/1.3.39/perl5/perltypemaps.swg,65,%set_constant@*/ do {
4959     SV *sv = get_sv((char*) SWIG_prefix "STREAMING_REQUIREMENT_REQUIRED", TRUE | 0x2 | GV_ADDMULTI);
4960     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(STREAMING_REQUIREMENT_REQUIRED)));
4961     SvREADONLY_on(sv);
4962   } while(0) /*@SWIG@*/;
4963   /*@SWIG:/usr/share/swig/1.3.39/perl5/perltypemaps.swg,65,%set_constant@*/ do {
4964     SV *sv = get_sv((char*) SWIG_prefix "MEDIA_ACCESS_MODE_READ_ONLY", TRUE | 0x2 | GV_ADDMULTI);
4965     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(MEDIA_ACCESS_MODE_READ_ONLY)));
4966     SvREADONLY_on(sv);
4967   } while(0) /*@SWIG@*/;
4968   /*@SWIG:/usr/share/swig/1.3.39/perl5/perltypemaps.swg,65,%set_constant@*/ do {
4969     SV *sv = get_sv((char*) SWIG_prefix "MEDIA_ACCESS_MODE_WORM", TRUE | 0x2 | GV_ADDMULTI);
4970     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(MEDIA_ACCESS_MODE_WORM)));
4971     SvREADONLY_on(sv);
4972   } while(0) /*@SWIG@*/;
4973   /*@SWIG:/usr/share/swig/1.3.39/perl5/perltypemaps.swg,65,%set_constant@*/ do {
4974     SV *sv = get_sv((char*) SWIG_prefix "MEDIA_ACCESS_MODE_READ_WRITE", TRUE | 0x2 | GV_ADDMULTI);
4975     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(MEDIA_ACCESS_MODE_READ_WRITE)));
4976     SvREADONLY_on(sv);
4977   } while(0) /*@SWIG@*/;
4978   /*@SWIG:/usr/share/swig/1.3.39/perl5/perltypemaps.swg,65,%set_constant@*/ do {
4979     SV *sv = get_sv((char*) SWIG_prefix "MEDIA_ACCESS_MODE_WRITE_ONLY", TRUE | 0x2 | GV_ADDMULTI);
4980     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(MEDIA_ACCESS_MODE_WRITE_ONLY)));
4981     SvREADONLY_on(sv);
4982   } while(0) /*@SWIG@*/;
4983   /*@SWIG:/usr/share/swig/1.3.39/perl5/perltypemaps.swg,65,%set_constant@*/ do {
4984     SV *sv = get_sv((char*) SWIG_prefix "PROPERTY_SURETY_BAD", TRUE | 0x2 | GV_ADDMULTI);
4985     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(PROPERTY_SURETY_BAD)));
4986     SvREADONLY_on(sv);
4987   } while(0) /*@SWIG@*/;
4988   /*@SWIG:/usr/share/swig/1.3.39/perl5/perltypemaps.swg,65,%set_constant@*/ do {
4989     SV *sv = get_sv((char*) SWIG_prefix "PROPERTY_SURETY_GOOD", TRUE | 0x2 | GV_ADDMULTI);
4990     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(PROPERTY_SURETY_GOOD)));
4991     SvREADONLY_on(sv);
4992   } while(0) /*@SWIG@*/;
4993   /*@SWIG:/usr/share/swig/1.3.39/perl5/perltypemaps.swg,65,%set_constant@*/ do {
4994     SV *sv = get_sv((char*) SWIG_prefix "PROPERTY_SOURCE_DEFAULT", TRUE | 0x2 | GV_ADDMULTI);
4995     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(PROPERTY_SOURCE_DEFAULT)));
4996     SvREADONLY_on(sv);
4997   } while(0) /*@SWIG@*/;
4998   /*@SWIG:/usr/share/swig/1.3.39/perl5/perltypemaps.swg,65,%set_constant@*/ do {
4999     SV *sv = get_sv((char*) SWIG_prefix "PROPERTY_SOURCE_DETECTED", TRUE | 0x2 | GV_ADDMULTI);
5000     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(PROPERTY_SOURCE_DETECTED)));
5001     SvREADONLY_on(sv);
5002   } while(0) /*@SWIG@*/;
5003   /*@SWIG:/usr/share/swig/1.3.39/perl5/perltypemaps.swg,65,%set_constant@*/ do {
5004     SV *sv = get_sv((char*) SWIG_prefix "PROPERTY_SOURCE_USER", TRUE | 0x2 | GV_ADDMULTI);
5005     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(PROPERTY_SOURCE_USER)));
5006     SvREADONLY_on(sv);
5007   } while(0) /*@SWIG@*/;
5008   ST(0) = &PL_sv_yes;
5009   XSRETURN(1);
5010 }
5011