rmtclient.hpp 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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 RMTCLIENT_HPP
  14. #define RMTCLIENT_HPP
  15. #include "jsocket.hpp"
  16. #include "jfile.hpp"
  17. #include "remoteerr.hpp"
  18. #include "dafscommon.hpp"
  19. #ifdef DAFSCLIENT_EXPORTS
  20. #define DAFSCLIENT_API DECL_EXPORT
  21. #else
  22. #define DAFSCLIENT_API DECL_IMPORT
  23. #endif
  24. #define DAFILESRV_METAINFOVERSION 2
  25. #define DAFILESRV_STREAMREAD_MINVERSION 22
  26. #define DAFILESRV_STREAMGENERAL_MINVERSION 25
  27. typedef int RemoteFileIOHandle;
  28. // backward compatible modes
  29. typedef enum { compatIFSHnone, compatIFSHread, compatIFSHwrite, compatIFSHexec, compatIFSHall} compatIFSHmode;
  30. enum DAFS_OS
  31. {
  32. DAFS_OSunknown,
  33. DAFS_OSwindows,
  34. DAFS_OSlinux,
  35. DAFS_OSsolaris
  36. };
  37. extern DAFSCLIENT_API IFile * createRemoteFile(SocketEndpoint &ep,const char * _filename);
  38. interface IDaFsConnection;
  39. extern DAFSCLIENT_API unsigned short getDaliServixPort(); // assumed just the one for now
  40. extern DAFSCLIENT_API void setCanAccessDirectly(RemoteFilename & file,bool set);
  41. extern DAFSCLIENT_API unsigned getRemoteVersion(ISocket * _socket, StringBuffer &ver);
  42. extern DAFSCLIENT_API unsigned getCachedRemoteVersion(IDaFsConnection &daFsConnection);
  43. extern DAFSCLIENT_API unsigned getCachedRemoteVersion(const SocketEndpoint &ep, bool secure);
  44. extern DAFSCLIENT_API int setDafsTrace(ISocket * socket,byte flags);
  45. extern DAFSCLIENT_API int setDafsThrottleLimit(ISocket * socket, ThrottleClass throttleClass, unsigned throttleLimit, unsigned throttleDelayMs, unsigned throttleCPULimit, unsigned queueLimit, StringBuffer *errMsg=NULL);
  46. extern DAFSCLIENT_API int getDafsInfo(ISocket * socket, unsigned level, StringBuffer &retstr);
  47. extern DAFSCLIENT_API void setDafsEndpointPort(SocketEndpoint &ep);
  48. extern DAFSCLIENT_API void setDafsLocalMountRedirect(const IpAddress &ip,const char *dir,const char *mountdir);
  49. extern DAFSCLIENT_API ISocket *connectDafs(SocketEndpoint &ep, unsigned timeoutms); // NOTE: might alter ep.port if configured for multiple ports ...
  50. extern DAFSCLIENT_API ISocket *checkSocketSecure(ISocket *socket);
  51. extern DAFSCLIENT_API unsigned short getActiveDaliServixPort(const IpAddress &ip);
  52. extern DAFSCLIENT_API unsigned getDaliServixVersion(const IpAddress &ip,StringBuffer &ver);
  53. extern DAFSCLIENT_API unsigned getDaliServixVersion(const SocketEndpoint &ep,StringBuffer &ver);
  54. extern DAFSCLIENT_API DAFS_OS getDaliServixOs(const SocketEndpoint &ep);
  55. extern DAFSCLIENT_API bool testDaliServixPresent(const IpAddress &ip);
  56. extern DAFSCLIENT_API unsigned stopRemoteServer(ISocket *socket);
  57. extern DAFSCLIENT_API int setDafileSvrTraceFlags(const SocketEndpoint &ep,byte flags);
  58. extern DAFSCLIENT_API int setDafileSvrThrottleLimit(const SocketEndpoint &_ep, ThrottleClass throttleClass, unsigned throttleLimit, unsigned throttleDelayMs, unsigned throttleCPULimit, unsigned queueLimit, StringBuffer *errMsg=NULL);
  59. extern DAFSCLIENT_API int getDafileSvrInfo(const SocketEndpoint &ep, unsigned level, StringBuffer &retstr);
  60. extern DAFSCLIENT_API RemoteFileCommandType queryRemoteStreamCmd(); // used by testsocket only
  61. interface IDaFsConnection : extends IInterface
  62. {
  63. virtual void close(int handle) = 0;
  64. virtual void send(MemoryBuffer &sendMb, MemoryBuffer &reply) = 0;
  65. virtual unsigned getVersion(StringBuffer &ver) = 0;
  66. virtual const SocketEndpoint &queryEp() const = 0;
  67. };
  68. extern DAFSCLIENT_API IDAFS_Exception *createDafsException(int code, const char *msg);
  69. extern DAFSCLIENT_API IDAFS_Exception *createDafsExceptionVA(int code, const char *format, va_list args) __attribute__((format(printf,2,0)));
  70. extern DAFSCLIENT_API IDAFS_Exception *createDafsExceptionV(int code, const char *format, ...) __attribute__((format(printf,2,3)));
  71. extern DAFSCLIENT_API IDaFsConnection *createDaFsConnection(const SocketEndpoint &ep, DAFSConnectCfg connectMethod, const char *tracing);
  72. extern DAFSCLIENT_API unsigned stopRemoteServer(ISocket * _socket);
  73. #endif