PageRenderTime 36ms CodeModel.GetById 14ms RepoModel.GetById 1ms app.codeStats 0ms

/common/remote/rmtfile.hpp

http://github.com/hpcc-systems/HPCC-Platform
C++ Header | 110 lines | 71 code | 22 blank | 17 comment | 0 complexity | 646b676a12d20d2cc880c09d9f41f69f MD5 | raw file
Possible License(s): BSD-3-Clause, LGPL-2.0, MIT
  1. /*##############################################################################
  2. HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems®.
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. ############################################################################## */
  13. #ifndef RMTFILE_HPP
  14. #define RMTFILE_HPP
  15. #include "jsocket.hpp"
  16. #include "jfile.hpp"
  17. #include "sockfile.hpp"
  18. #ifdef REMOTE_EXPORTS
  19. #define REMOTE_API __declspec(dllexport)
  20. #else
  21. #define REMOTE_API __declspec(dllimport)
  22. #endif
  23. enum DAFS_OS
  24. {
  25. DAFS_OSunknown,
  26. DAFS_OSwindows,
  27. DAFS_OSlinux,
  28. DAFS_OSsolaris
  29. };
  30. extern REMOTE_API void filenameToUrl(StringBuffer & out, const char * filename);
  31. interface IDaFileSrvHook : extends IRemoteFileCreateHook
  32. {
  33. virtual void addSubnetFilter(const char *subnet, const char *mask, const char *dir, const char *sourceRange, bool trace) = 0;
  34. virtual void addRangeFilter(const char *range, const char *dir, const char *sourceRange, bool trace) = 0;
  35. virtual IPropertyTree *addFilters(IPropertyTree *filters, const SocketEndpoint *ipAddress) = 0;
  36. virtual IPropertyTree *addMyFilters(IPropertyTree *filters, SocketEndpoint *myEp=NULL) = 0;
  37. virtual void clearFilters() = 0;
  38. };
  39. extern REMOTE_API IDaFileSrvHook *queryDaFileSrvHook();
  40. extern REMOTE_API unsigned short getDaliServixPort(); // assumed just the one for now
  41. extern REMOTE_API void setCanAccessDirectly(RemoteFilename & file,bool set);
  42. extern REMOTE_API void setDaliServixSocketCaching(bool set);
  43. extern REMOTE_API bool canAccessDirectly(const RemoteFilename & file);
  44. extern REMOTE_API IFile *createDaliServixFile(const RemoteFilename & file);
  45. extern REMOTE_API bool testDaliServixPresent(const IpAddress &ip);
  46. extern REMOTE_API bool testDaliServixPresent(const SocketEndpoint &ep);
  47. extern REMOTE_API unsigned getDaliServixVersion(const IpAddress &ip,StringBuffer &ver);
  48. extern REMOTE_API unsigned getDaliServixVersion(const SocketEndpoint &ep,StringBuffer &ver);
  49. extern REMOTE_API DAFS_OS getDaliServixOs(const SocketEndpoint &ep);
  50. extern REMOTE_API void setLocalMountRedirect(const IpAddress &ip,const char *dir,const char *mountdir);
  51. // redirects a daliservix file to a local mount. To remove redirect use NULL for mount dir or NULL for dir
  52. extern REMOTE_API int remoteExec(const SocketEndpoint &ep,const char *cmdline, const char *workdir,bool sync,
  53. size32_t insize, void *inbuf, MemoryBuffer *outbuf);
  54. extern REMOTE_API void remoteExtractBlobElements(const char * prefix, const RemoteFilename &file, ExtractedBlobArray & extracted);
  55. extern REMOTE_API int setDafileSvrTraceFlags(const SocketEndpoint &ep,byte flags);
  56. extern REMOTE_API int setDafileSvrThrottleLimit(const SocketEndpoint &_ep, ThrottleClass throttleClass, unsigned throttleLimit, unsigned throttleDelayMs, unsigned throttleCPULimit, unsigned queueLimit, StringBuffer *errMsg=NULL);
  57. extern REMOTE_API int getDafileSvrInfo(const SocketEndpoint &ep, unsigned level, StringBuffer &retstr);
  58. extern REMOTE_API void disconnectRemoteFile(IFile *file);
  59. extern REMOTE_API void disconnectRemoteIoOnExit(IFileIO *fileio,bool set=true);
  60. extern REMOTE_API bool resetRemoteFilename(IFile *file, const char *newname); // returns false if not remote
  61. extern REMOTE_API void enableAuthentication(bool set=true); // default enabled for clients, disabled for server
  62. extern REMOTE_API bool asyncCopyFileSection(const char *uuid, // from genUUID - must be same for subsequent calls
  63. IFile *from, // expected to be remote
  64. RemoteFilename &to,
  65. offset_t toofs, // (offset_t)-1 created file and copies to start
  66. offset_t fromofs,
  67. offset_t size, // (offset_t)-1 for all file
  68. ICopyFileProgress *progress,
  69. unsigned timeout // 0 to start, non-zero to wait
  70. ); // returns true when done
  71. extern REMOTE_API void setRemoteFileTimeouts(unsigned maxconnecttime,unsigned maxreadtime);
  72. #define DAFS_VALIDATE_CONNECT_FAIL (0x01)
  73. #define DAFS_VALIDATE_BAD_VERSION (0x02)
  74. #define DAFS_VALIDATE_WRITE_FAIL_DATA (0x12)
  75. #define DAFS_VALIDATE_READ_FAIL_DATA (0x14)
  76. #define DAFS_VALIDATE_DISK_FULL_DATA (0x18)
  77. #define DAFS_VALIDATE_WRITE_FAIL_MIRROR (0x22)
  78. #define DAFS_VALIDATE_READ_FAIL_MIRROR (0x24)
  79. #define DAFS_VALIDATE_DISK_FULL_MIRROR (0x28)
  80. #define DAFS_SCRIPT_FAIL (0x40)
  81. extern REMOTE_API unsigned validateNodes(const SocketEndpointArray &eps,const char *dataDir, const char *mirrorDir, bool chkver, const char *script, unsigned scripttimeout, SocketEndpointArray &failures, UnsignedArray &failedcodes, StringArray &failedmessages, const char *filename=NULL);
  82. extern REMOTE_API void installFileHooks(const char *filespec);
  83. extern REMOTE_API void removeFileHooks(); // Should be called before closedown
  84. #endif