xrootd
XrdClientAdmin_c.hh
Go to the documentation of this file.
1 /******************************************************************************/
2 /* */
3 /* X r d C l i e n t A d m i n _ c . h h */
4 /* */
5 /* 2004 Produced by Alvise Dorigo & Fabrizio Furano for INFN padova */
6 /* */
7 /* This file is part of the XRootD software suite. */
8 /* */
9 /* XRootD is free software: you can redistribute it and/or modify it under */
10 /* the terms of the GNU Lesser General Public License as published by the */
11 /* Free Software Foundation, either version 3 of the License, or (at your */
12 /* option) any later version. */
13 /* */
14 /* XRootD is distributed in the hope that it will be useful, but WITHOUT */
15 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
16 /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
17 /* License for more details. */
18 /* */
19 /* You should have received a copy of the GNU Lesser General Public License */
20 /* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
21 /* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
22 /* */
23 /* The copyright holder's institutional names and contributor's names may not */
24 /* be used to endorse or promote products derived from this software without */
25 /* specific prior written permission of the institution or contributor. */
26 /******************************************************************************/
27 
28 /********************************************************************************/
29 /* A C wrapper for XTNetAdmin functionalities */
30 /********************************************************************************/
31 
32 #ifdef SWIG
33 %module XrdClientAdmin
34 %include typemaps.i // Load the typemaps librayr
35 
36  // This tells SWIG to treat an char * argument with name res as
37  // an output value.
38 
39 %typemap(argout) char *OUTPUT {
40  $result = sv_newmortal();
41  sv_setnv($result, arg2);
42  argvi++; /* Increment return count -- important! */
43 }
44 
45 // We don't care what the input value is. Ignore, but set to a temporary variable
46 
47 %typemap(in,numinputs=0) char *OUTPUT(char junk) {
48  $1 = &junk;
49 }
50 
51 %apply char *OUTPUT { char *ans };
52 
53 // For the stat function to return an array containing the
54 // various fields of the answer
55 %apply long *OUTPUT {long *id}; // Make "result" an output parameter
56 %apply long long *OUTPUT {long long *size}; // Make "result" an output parameter
57 %apply long *OUTPUT {long *flags}; // Make "result" an output parameter
58 %apply long *OUTPUT {long *modtime}; // Make "result" an output parameter
59 
60 %{
62  %}
63 
64 #endif
65 
66 extern "C" {
67  // Some prototypes to wrap ctor and dtor
68  // In this version we support only one instance to be handled
69  // by this wrapper. Supporting more than one instance should be no
70  // problem.
71  bool XrdInitialize(const char *url, const char *EnvValues);
72  bool XrdTerminate();
73 
74  // The other functions, slightly modified from the originals
75  char *XrdSysStatX(const char *paths_list);
76 
77  char *XrdExistFiles(const char *filepaths);
78  char *XrdExistDirs(const char *filepaths);
79  char *XrdIsFileOnline(const char *filepaths);
80 
81  bool XrdMv(const char *fileSrc, const char *fileDest);
82  bool XrdMkdir(const char *dir, int user, int group, int other);
83  bool XrdChmod(const char *file, int user, int group, int other);
84  bool XrdRm(const char *file);
85  bool XrdRmdir(const char *path);
86  bool XrdPrepare(const char *filepaths, unsigned char opts, unsigned char prty);
87  char *XrdDirList(const char *dir);
88  char *XrdGetChecksum(const char *path);
89  char *XrdGetCurrentHost();
90 
91  bool XrdStat(const char *fname, long *id, long long *size, long *flags, long *modtime);
92 }