// @(#)root/netx:$Id$
/*************************************************************************
 * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

////////////////////////////////////////////////////////////////////////////////
//                                                                            //
// TNetXNGSystem                                                              //
//                                                                            //
// Authors: Justin Salmon, Lukasz Janyst                                      //
//          CERN, 2013                                                        //
//                                                                            //
// Enables access to XRootD filesystem interface using the new client.        //
//                                                                            //
////////////////////////////////////////////////////////////////////////////////

#include "TNetXNGSystem.h"
#include "TFileStager.h"
#include "Rtypes.h"
#include "TList.h"
#include "TUrl.h"
#include <XrdCl/XrdClFileSystem.hh>
#include <XrdCl/XrdClXRootDResponses.hh>

ClassImp(TNetXNGSystem);

namespace
{
   struct DirectoryInfo {
      XrdCl::URL                     *fUrl;         // Path of this directory
      XrdCl::DirectoryList           *fDirList;     // Directory listing
      XrdCl::DirectoryList::Iterator *fDirListIter; // Iterator for this listing

   public:
      DirectoryInfo(const char *dir) : fUrl(new XrdCl::URL(dir)), fDirList(0), fDirListIter(0) {}

      ~DirectoryInfo() {
        delete fUrl;
        delete fDirList;
      }
   };
}

//______________________________________________________________________________
TNetXNGSystem::TNetXNGSystem(Bool_t /*owner*/) :
   TSystem("-root", "Net file Helper System"), fUrl(0), fFileSystem(0)
{
   // Constructor: Create system class without connecting to server
   //
   // param owner: (unused)

   // Name must start with '-' to bypass the TSystem singleton check, then
   // be changed to "root"
   SetName("root");
}

//______________________________________________________________________________
TNetXNGSystem::TNetXNGSystem(const char *url, Bool_t /*owner*/) :
   TSystem("-root", "Net file Helper System")
{
   // Constructor: Create system class and connect to server
   //
   // param url:   URL of the entry-point server to be contacted
   // param owner: (unused)

   using namespace XrdCl;

   // Name must start with '-' to bypass the TSystem singleton check
   SetName("root");
   fUrl        = new URL(std::string(url));
   fFileSystem = new FileSystem(fUrl->GetURL());
}

//______________________________________________________________________________
TNetXNGSystem::~TNetXNGSystem()
{
   // Destructor

   delete fFileSystem;
   delete fUrl;
}

//______________________________________________________________________________
void* TNetXNGSystem::OpenDirectory(const char *dir)
{
   // Open a directory
   //
   // param dir: the name of the directory to open
   // returns:   a non-zero pointer (with no special purpose) in case of
   //            success, 0 in case of error

   using namespace XrdCl;

   DirectoryInfo *dirInfo = new DirectoryInfo(dir);
   fDirPtrs.insert( (void*)dirInfo );
   return (void *) dirInfo;
}

//______________________________________________________________________________
Int_t TNetXNGSystem::MakeDirectory(const char *dir)
{
   // Create a directory
   //
   // param dir: the directory name
   // returns:   0 on success, -1 otherwise

   using namespace XrdCl;
   URL url(dir);
   XRootDStatus st = fFileSystem->MkDir(url.GetPath(), MkDirFlags::MakePath,
                                        Access::None);
   if (!st.IsOK()) {
      Error("MakeDirectory", "%s", st.GetErrorMessage().c_str());
      return -1;
   }

   return 0;
}

//______________________________________________________________________________----
void TNetXNGSystem::FreeDirectory(void *dirp)
{
   // Free a directory
   //
   // param dirp: the pointer to the directory to be freed

   fDirPtrs.erase( dirp );
   delete (DirectoryInfo *) dirp;
}

//______________________________________________________________________________
const char* TNetXNGSystem::GetDirEntry(void *dirp)
{
   // Get a directory entry.
   //
   // param dirp: the directory pointer
   // returns:    0 in case there are no more entries

   using namespace XrdCl;
   DirectoryInfo *dirInfo = (DirectoryInfo *) dirp;

   if (!dirInfo->fDirList) {
      XRootDStatus st = fFileSystem->DirList(dirInfo->fUrl->GetPath(),
                                             DirListFlags::Locate,
                                             dirInfo->fDirList);
      if (!st.IsOK()) {
         Error("GetDirEntry", "%s", st.GetErrorMessage().c_str());
         return 0;
      }
      dirInfo->fDirListIter = new DirectoryList::Iterator(dirInfo->fDirList->Begin());
   }

   if (*(dirInfo->fDirListIter) != dirInfo->fDirList->End()) {
      const char *filename = (**(dirInfo->fDirListIter))->GetName().c_str();
      (*(dirInfo->fDirListIter))++;
      return filename;

   } else {
      return 0;
   }
}

//______________________________________________________________________________
Int_t TNetXNGSystem::GetPathInfo(const char *path, FileStat_t &buf)
{
   // Get info about a file (stat)
   //
   // param path: the path of the file to stat (in)
   // param buf:  structure that will hold the stat info (out)
   // returns:    0 if success, 1 if the file could not be stat'ed

   using namespace XrdCl;
   StatInfo *info = 0;
   URL target(path);
   XRootDStatus st = fFileSystem->Stat(target.GetPath(), info);

   if (!st.IsOK()) {

      Error("GetPathInfo", "Error: %s", st.GetErrorMessage().c_str());
      delete info;
      return 1;

   } else {

      // Flag offline files
      if (info->TestFlags(StatInfo::Offline)) {
         buf.fMode = kS_IFOFF;
      } else {
         std::stringstream sstr(info->GetId());
         Long64_t id;
         sstr >> id;

         buf.fDev    = (id >> 32);
         buf.fIno    = (id & 0x00000000FFFFFFFF);
         buf.fUid    = -1;  // not available
         buf.fGid    = -1;  // not available
         buf.fIsLink = 0;   // not available
         buf.fSize   = info->GetSize();
         buf.fMtime  = info->GetModTime();

         if (info->TestFlags(StatInfo::XBitSet))
            buf.fMode = (kS_IFREG | kS_IXUSR | kS_IXGRP | kS_IXOTH);
         if (info->GetFlags() == 0)                 buf.fMode = kS_IFREG;
         if (info->TestFlags(StatInfo::IsDir))      buf.fMode = kS_IFDIR;
         if (info->TestFlags(StatInfo::Other))      buf.fMode = kS_IFSOCK;
         if (info->TestFlags(StatInfo::IsReadable)) buf.fMode |= kS_IRUSR;
         if (info->TestFlags(StatInfo::IsWritable)) buf.fMode |= kS_IWUSR;
      }
   }

   delete info;
   return 0;
}

//______________________________________________________________________________
Bool_t TNetXNGSystem::ConsistentWith(const char *path, void *dirptr)
{
   // Check consistency of this helper with the one required by 'path' or
   // 'dirptr'
   //
   // param path:   the path to check
   // param dirptr: the directory pointer to check

   using namespace XrdCl;

   if( path )
   {
      URL url(path);

      if( gDebug > 1 )
         Info("ConsistentWith", "Protocol: '%s' (%s), Username: '%s' (%s), "
              "Password: '%s' (%s), Hostname: '%s' (%s), Port: %d (%d)",
               fUrl->GetProtocol().c_str(), url.GetProtocol().c_str(),
               fUrl->GetUserName().c_str(), url.GetUserName().c_str(),
               fUrl->GetPassword().c_str(), url.GetPassword().c_str(),
               fUrl->GetHostName().c_str(), url.GetHostName().c_str(),
               fUrl->GetPort(), url.GetPort());

      // Require match of protocol, user, password, host and port
      if( fUrl->GetProtocol() == url.GetProtocol() &&
          fUrl->GetUserName() == url.GetUserName() &&
          fUrl->GetPassword() == url.GetPassword() &&
          fUrl->GetHostName() == url.GetHostName() &&
          fUrl->GetPort() == url.GetPort())
         return kTRUE;
   }

   if( dirptr )
      return fDirPtrs.find( dirptr ) != fDirPtrs.end();

   return kFALSE;
}

//______________________________________________________________________________
int TNetXNGSystem::Unlink(const char *path)
{
   // Unlink a file on the remote server
   //
   // param path: the path of the file to unlink
   // returns:    0 on success, -1 otherwise

   using namespace XrdCl;
   StatInfo *info;
   URL url(path);

   // Stat the path to find out if it's a file or a directory
   XRootDStatus st = fFileSystem->Stat(url.GetPath(), info);
   if (!st.IsOK()) {
      Error("Unlink", "%s", st.GetErrorMessage().c_str());
      delete info;
      return -1;
   }

   if (info->TestFlags(StatInfo::IsDir))
      st = fFileSystem->RmDir(url.GetPath());
   else
      st = fFileSystem->Rm(url.GetPath());
   delete info;

   if (!st.IsOK()) {
      Error("Unlink", "%s", st.GetErrorMessage().c_str());
      return -1;
   }

   return 0;
}

//______________________________________________________________________________
Bool_t TNetXNGSystem::IsPathLocal(const char *path)
{
   // Is this path a local path?
   //
   // param path: the URL of the path to check
   // returns:    kTRUE if the path is local, kFALSE otherwise

   return TSystem::IsPathLocal(path);
}

//______________________________________________________________________________
Int_t TNetXNGSystem::Locate(const char *path, TString &endurl)
{
   // Get the endpoint URL of a file.
   //
   // param path:   the entry-point URL of the file (in)
   // param endurl: the endpoint URL of the file (out)
   // returns:      0 in case of success and 1 if the file could not be
   //               stat'ed.

   using namespace XrdCl;
   LocationInfo *info = 0;
   URL pathUrl(path);

   // Locate the file
   XRootDStatus st = fFileSystem->Locate(pathUrl.GetPath(), OpenFlags::None,
                                         info);
   if (!st.IsOK()) {
      Error("Locate", "%s", st.GetErrorMessage().c_str());
      delete info;
      return 1;
   }

   // Return the first address
   endurl = info->Begin()->GetAddress();
   delete info;
   return 0;
}

//______________________________________________________________________________
Int_t TNetXNGSystem::Stage(const char* path, UChar_t priority)
{
   // Issue a stage request for a single file
   //
   // param path: the path of the file to stage
   // param opt:  defines 'option' and 'priority' for 'Prepare': the format is
   //             opt = "option=o priority=p"
   // returns:    0 for success, -1 for error

   TList *files = new TList();
   files->Add((TObject *) new TUrl(path));
   return Stage((TCollection *) files, priority);
}

//______________________________________________________________________________
Int_t TNetXNGSystem::Stage(TCollection *files, UChar_t priority)
{
   // Issue stage requests for multiple files
   //
   // param pathlist: list of paths of files to stage
   // param opt:      defines 'option' and 'priority' for 'Prepare': the
   //                 format is opt = "option=o priority=p"
   // returns:        0 for success, -1 for error

   using namespace XrdCl;
   std::vector<std::string> fileList;
   TIter it(files);
   TObject *object = 0;

   while ((object = (TObject *) it.Next())) {

      TString path = TFileStager::GetPathName(object);
      if (path == "") {
         Warning("Stage", "object is of unexpected type %s - ignoring",
               object->ClassName());
         continue;
      }

      fileList.push_back(std::string(URL(path.Data()).GetPath()));
   }

   Buffer *response;
   XRootDStatus st = fFileSystem->Prepare(fileList, PrepareFlags::Stage,
                                          (uint8_t) priority, response);
   if (!st.IsOK()) {
      Error("Stage", "%s", st.GetErrorMessage().c_str());
      return -1;
   }

   return 0;
}

 TNetXNGSystem.cxx:1
 TNetXNGSystem.cxx:2
 TNetXNGSystem.cxx:3
 TNetXNGSystem.cxx:4
 TNetXNGSystem.cxx:5
 TNetXNGSystem.cxx:6
 TNetXNGSystem.cxx:7
 TNetXNGSystem.cxx:8
 TNetXNGSystem.cxx:9
 TNetXNGSystem.cxx:10
 TNetXNGSystem.cxx:11
 TNetXNGSystem.cxx:12
 TNetXNGSystem.cxx:13
 TNetXNGSystem.cxx:14
 TNetXNGSystem.cxx:15
 TNetXNGSystem.cxx:16
 TNetXNGSystem.cxx:17
 TNetXNGSystem.cxx:18
 TNetXNGSystem.cxx:19
 TNetXNGSystem.cxx:20
 TNetXNGSystem.cxx:21
 TNetXNGSystem.cxx:22
 TNetXNGSystem.cxx:23
 TNetXNGSystem.cxx:24
 TNetXNGSystem.cxx:25
 TNetXNGSystem.cxx:26
 TNetXNGSystem.cxx:27
 TNetXNGSystem.cxx:28
 TNetXNGSystem.cxx:29
 TNetXNGSystem.cxx:30
 TNetXNGSystem.cxx:31
 TNetXNGSystem.cxx:32
 TNetXNGSystem.cxx:33
 TNetXNGSystem.cxx:34
 TNetXNGSystem.cxx:35
 TNetXNGSystem.cxx:36
 TNetXNGSystem.cxx:37
 TNetXNGSystem.cxx:38
 TNetXNGSystem.cxx:39
 TNetXNGSystem.cxx:40
 TNetXNGSystem.cxx:41
 TNetXNGSystem.cxx:42
 TNetXNGSystem.cxx:43
 TNetXNGSystem.cxx:44
 TNetXNGSystem.cxx:45
 TNetXNGSystem.cxx:46
 TNetXNGSystem.cxx:47
 TNetXNGSystem.cxx:48
 TNetXNGSystem.cxx:49
 TNetXNGSystem.cxx:50
 TNetXNGSystem.cxx:51
 TNetXNGSystem.cxx:52
 TNetXNGSystem.cxx:53
 TNetXNGSystem.cxx:54
 TNetXNGSystem.cxx:55
 TNetXNGSystem.cxx:56
 TNetXNGSystem.cxx:57
 TNetXNGSystem.cxx:58
 TNetXNGSystem.cxx:59
 TNetXNGSystem.cxx:60
 TNetXNGSystem.cxx:61
 TNetXNGSystem.cxx:62
 TNetXNGSystem.cxx:63
 TNetXNGSystem.cxx:64
 TNetXNGSystem.cxx:65
 TNetXNGSystem.cxx:66
 TNetXNGSystem.cxx:67
 TNetXNGSystem.cxx:68
 TNetXNGSystem.cxx:69
 TNetXNGSystem.cxx:70
 TNetXNGSystem.cxx:71
 TNetXNGSystem.cxx:72
 TNetXNGSystem.cxx:73
 TNetXNGSystem.cxx:74
 TNetXNGSystem.cxx:75
 TNetXNGSystem.cxx:76
 TNetXNGSystem.cxx:77
 TNetXNGSystem.cxx:78
 TNetXNGSystem.cxx:79
 TNetXNGSystem.cxx:80
 TNetXNGSystem.cxx:81
 TNetXNGSystem.cxx:82
 TNetXNGSystem.cxx:83
 TNetXNGSystem.cxx:84
 TNetXNGSystem.cxx:85
 TNetXNGSystem.cxx:86
 TNetXNGSystem.cxx:87
 TNetXNGSystem.cxx:88
 TNetXNGSystem.cxx:89
 TNetXNGSystem.cxx:90
 TNetXNGSystem.cxx:91
 TNetXNGSystem.cxx:92
 TNetXNGSystem.cxx:93
 TNetXNGSystem.cxx:94
 TNetXNGSystem.cxx:95
 TNetXNGSystem.cxx:96
 TNetXNGSystem.cxx:97
 TNetXNGSystem.cxx:98
 TNetXNGSystem.cxx:99
 TNetXNGSystem.cxx:100
 TNetXNGSystem.cxx:101
 TNetXNGSystem.cxx:102
 TNetXNGSystem.cxx:103
 TNetXNGSystem.cxx:104
 TNetXNGSystem.cxx:105
 TNetXNGSystem.cxx:106
 TNetXNGSystem.cxx:107
 TNetXNGSystem.cxx:108
 TNetXNGSystem.cxx:109
 TNetXNGSystem.cxx:110
 TNetXNGSystem.cxx:111
 TNetXNGSystem.cxx:112
 TNetXNGSystem.cxx:113
 TNetXNGSystem.cxx:114
 TNetXNGSystem.cxx:115
 TNetXNGSystem.cxx:116
 TNetXNGSystem.cxx:117
 TNetXNGSystem.cxx:118
 TNetXNGSystem.cxx:119
 TNetXNGSystem.cxx:120
 TNetXNGSystem.cxx:121
 TNetXNGSystem.cxx:122
 TNetXNGSystem.cxx:123
 TNetXNGSystem.cxx:124
 TNetXNGSystem.cxx:125
 TNetXNGSystem.cxx:126
 TNetXNGSystem.cxx:127
 TNetXNGSystem.cxx:128
 TNetXNGSystem.cxx:129
 TNetXNGSystem.cxx:130
 TNetXNGSystem.cxx:131
 TNetXNGSystem.cxx:132
 TNetXNGSystem.cxx:133
 TNetXNGSystem.cxx:134
 TNetXNGSystem.cxx:135
 TNetXNGSystem.cxx:136
 TNetXNGSystem.cxx:137
 TNetXNGSystem.cxx:138
 TNetXNGSystem.cxx:139
 TNetXNGSystem.cxx:140
 TNetXNGSystem.cxx:141
 TNetXNGSystem.cxx:142
 TNetXNGSystem.cxx:143
 TNetXNGSystem.cxx:144
 TNetXNGSystem.cxx:145
 TNetXNGSystem.cxx:146
 TNetXNGSystem.cxx:147
 TNetXNGSystem.cxx:148
 TNetXNGSystem.cxx:149
 TNetXNGSystem.cxx:150
 TNetXNGSystem.cxx:151
 TNetXNGSystem.cxx:152
 TNetXNGSystem.cxx:153
 TNetXNGSystem.cxx:154
 TNetXNGSystem.cxx:155
 TNetXNGSystem.cxx:156
 TNetXNGSystem.cxx:157
 TNetXNGSystem.cxx:158
 TNetXNGSystem.cxx:159
 TNetXNGSystem.cxx:160
 TNetXNGSystem.cxx:161
 TNetXNGSystem.cxx:162
 TNetXNGSystem.cxx:163
 TNetXNGSystem.cxx:164
 TNetXNGSystem.cxx:165
 TNetXNGSystem.cxx:166
 TNetXNGSystem.cxx:167
 TNetXNGSystem.cxx:168
 TNetXNGSystem.cxx:169
 TNetXNGSystem.cxx:170
 TNetXNGSystem.cxx:171
 TNetXNGSystem.cxx:172
 TNetXNGSystem.cxx:173
 TNetXNGSystem.cxx:174
 TNetXNGSystem.cxx:175
 TNetXNGSystem.cxx:176
 TNetXNGSystem.cxx:177
 TNetXNGSystem.cxx:178
 TNetXNGSystem.cxx:179
 TNetXNGSystem.cxx:180
 TNetXNGSystem.cxx:181
 TNetXNGSystem.cxx:182
 TNetXNGSystem.cxx:183
 TNetXNGSystem.cxx:184
 TNetXNGSystem.cxx:185
 TNetXNGSystem.cxx:186
 TNetXNGSystem.cxx:187
 TNetXNGSystem.cxx:188
 TNetXNGSystem.cxx:189
 TNetXNGSystem.cxx:190
 TNetXNGSystem.cxx:191
 TNetXNGSystem.cxx:192
 TNetXNGSystem.cxx:193
 TNetXNGSystem.cxx:194
 TNetXNGSystem.cxx:195
 TNetXNGSystem.cxx:196
 TNetXNGSystem.cxx:197
 TNetXNGSystem.cxx:198
 TNetXNGSystem.cxx:199
 TNetXNGSystem.cxx:200
 TNetXNGSystem.cxx:201
 TNetXNGSystem.cxx:202
 TNetXNGSystem.cxx:203
 TNetXNGSystem.cxx:204
 TNetXNGSystem.cxx:205
 TNetXNGSystem.cxx:206
 TNetXNGSystem.cxx:207
 TNetXNGSystem.cxx:208
 TNetXNGSystem.cxx:209
 TNetXNGSystem.cxx:210
 TNetXNGSystem.cxx:211
 TNetXNGSystem.cxx:212
 TNetXNGSystem.cxx:213
 TNetXNGSystem.cxx:214
 TNetXNGSystem.cxx:215
 TNetXNGSystem.cxx:216
 TNetXNGSystem.cxx:217
 TNetXNGSystem.cxx:218
 TNetXNGSystem.cxx:219
 TNetXNGSystem.cxx:220
 TNetXNGSystem.cxx:221
 TNetXNGSystem.cxx:222
 TNetXNGSystem.cxx:223
 TNetXNGSystem.cxx:224
 TNetXNGSystem.cxx:225
 TNetXNGSystem.cxx:226
 TNetXNGSystem.cxx:227
 TNetXNGSystem.cxx:228
 TNetXNGSystem.cxx:229
 TNetXNGSystem.cxx:230
 TNetXNGSystem.cxx:231
 TNetXNGSystem.cxx:232
 TNetXNGSystem.cxx:233
 TNetXNGSystem.cxx:234
 TNetXNGSystem.cxx:235
 TNetXNGSystem.cxx:236
 TNetXNGSystem.cxx:237
 TNetXNGSystem.cxx:238
 TNetXNGSystem.cxx:239
 TNetXNGSystem.cxx:240
 TNetXNGSystem.cxx:241
 TNetXNGSystem.cxx:242
 TNetXNGSystem.cxx:243
 TNetXNGSystem.cxx:244
 TNetXNGSystem.cxx:245
 TNetXNGSystem.cxx:246
 TNetXNGSystem.cxx:247
 TNetXNGSystem.cxx:248
 TNetXNGSystem.cxx:249
 TNetXNGSystem.cxx:250
 TNetXNGSystem.cxx:251
 TNetXNGSystem.cxx:252
 TNetXNGSystem.cxx:253
 TNetXNGSystem.cxx:254
 TNetXNGSystem.cxx:255
 TNetXNGSystem.cxx:256
 TNetXNGSystem.cxx:257
 TNetXNGSystem.cxx:258
 TNetXNGSystem.cxx:259
 TNetXNGSystem.cxx:260
 TNetXNGSystem.cxx:261
 TNetXNGSystem.cxx:262
 TNetXNGSystem.cxx:263
 TNetXNGSystem.cxx:264
 TNetXNGSystem.cxx:265
 TNetXNGSystem.cxx:266
 TNetXNGSystem.cxx:267
 TNetXNGSystem.cxx:268
 TNetXNGSystem.cxx:269
 TNetXNGSystem.cxx:270
 TNetXNGSystem.cxx:271
 TNetXNGSystem.cxx:272
 TNetXNGSystem.cxx:273
 TNetXNGSystem.cxx:274
 TNetXNGSystem.cxx:275
 TNetXNGSystem.cxx:276
 TNetXNGSystem.cxx:277
 TNetXNGSystem.cxx:278
 TNetXNGSystem.cxx:279
 TNetXNGSystem.cxx:280
 TNetXNGSystem.cxx:281
 TNetXNGSystem.cxx:282
 TNetXNGSystem.cxx:283
 TNetXNGSystem.cxx:284
 TNetXNGSystem.cxx:285
 TNetXNGSystem.cxx:286
 TNetXNGSystem.cxx:287
 TNetXNGSystem.cxx:288
 TNetXNGSystem.cxx:289
 TNetXNGSystem.cxx:290
 TNetXNGSystem.cxx:291
 TNetXNGSystem.cxx:292
 TNetXNGSystem.cxx:293
 TNetXNGSystem.cxx:294
 TNetXNGSystem.cxx:295
 TNetXNGSystem.cxx:296
 TNetXNGSystem.cxx:297
 TNetXNGSystem.cxx:298
 TNetXNGSystem.cxx:299
 TNetXNGSystem.cxx:300
 TNetXNGSystem.cxx:301
 TNetXNGSystem.cxx:302
 TNetXNGSystem.cxx:303
 TNetXNGSystem.cxx:304
 TNetXNGSystem.cxx:305
 TNetXNGSystem.cxx:306
 TNetXNGSystem.cxx:307
 TNetXNGSystem.cxx:308
 TNetXNGSystem.cxx:309
 TNetXNGSystem.cxx:310
 TNetXNGSystem.cxx:311
 TNetXNGSystem.cxx:312
 TNetXNGSystem.cxx:313
 TNetXNGSystem.cxx:314
 TNetXNGSystem.cxx:315
 TNetXNGSystem.cxx:316
 TNetXNGSystem.cxx:317
 TNetXNGSystem.cxx:318
 TNetXNGSystem.cxx:319
 TNetXNGSystem.cxx:320
 TNetXNGSystem.cxx:321
 TNetXNGSystem.cxx:322
 TNetXNGSystem.cxx:323
 TNetXNGSystem.cxx:324
 TNetXNGSystem.cxx:325
 TNetXNGSystem.cxx:326
 TNetXNGSystem.cxx:327
 TNetXNGSystem.cxx:328
 TNetXNGSystem.cxx:329
 TNetXNGSystem.cxx:330
 TNetXNGSystem.cxx:331
 TNetXNGSystem.cxx:332
 TNetXNGSystem.cxx:333
 TNetXNGSystem.cxx:334
 TNetXNGSystem.cxx:335
 TNetXNGSystem.cxx:336
 TNetXNGSystem.cxx:337
 TNetXNGSystem.cxx:338
 TNetXNGSystem.cxx:339
 TNetXNGSystem.cxx:340
 TNetXNGSystem.cxx:341
 TNetXNGSystem.cxx:342
 TNetXNGSystem.cxx:343
 TNetXNGSystem.cxx:344
 TNetXNGSystem.cxx:345
 TNetXNGSystem.cxx:346
 TNetXNGSystem.cxx:347
 TNetXNGSystem.cxx:348
 TNetXNGSystem.cxx:349
 TNetXNGSystem.cxx:350
 TNetXNGSystem.cxx:351
 TNetXNGSystem.cxx:352
 TNetXNGSystem.cxx:353
 TNetXNGSystem.cxx:354
 TNetXNGSystem.cxx:355
 TNetXNGSystem.cxx:356
 TNetXNGSystem.cxx:357
 TNetXNGSystem.cxx:358
 TNetXNGSystem.cxx:359
 TNetXNGSystem.cxx:360
 TNetXNGSystem.cxx:361
 TNetXNGSystem.cxx:362
 TNetXNGSystem.cxx:363
 TNetXNGSystem.cxx:364
 TNetXNGSystem.cxx:365
 TNetXNGSystem.cxx:366
 TNetXNGSystem.cxx:367
 TNetXNGSystem.cxx:368
 TNetXNGSystem.cxx:369
 TNetXNGSystem.cxx:370
 TNetXNGSystem.cxx:371
 TNetXNGSystem.cxx:372
 TNetXNGSystem.cxx:373
 TNetXNGSystem.cxx:374
 TNetXNGSystem.cxx:375
 TNetXNGSystem.cxx:376
 TNetXNGSystem.cxx:377
 TNetXNGSystem.cxx:378
 TNetXNGSystem.cxx:379
 TNetXNGSystem.cxx:380
 TNetXNGSystem.cxx:381
 TNetXNGSystem.cxx:382
 TNetXNGSystem.cxx:383