sockfile.hpp 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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 SOCKFILE_HPP
  14. #define SOCKFILE_HPP
  15. #include "jsocket.hpp"
  16. #include "jfile.hpp"
  17. #ifdef REMOTE_EXPORTS
  18. #define REMOTE_API __declspec(dllexport)
  19. #else
  20. #define REMOTE_API __declspec(dllimport)
  21. #endif
  22. #define RFEnoerror 0
  23. interface IRemoteFileServer : public IInterface
  24. {
  25. public:
  26. virtual void run(SocketEndpoint &listenep) = 0;
  27. virtual void stop() = 0;
  28. virtual unsigned idleTime() = 0; // in ms
  29. };
  30. #define FILESRV_VERSION 17 // don't forget VERSTRING in sockfile.cpp
  31. extern REMOTE_API IFile * createRemoteFile(SocketEndpoint &ep,const char * _filename); // takes ownershop of socket
  32. extern REMOTE_API unsigned getRemoteVersion(ISocket * _socket, StringBuffer &ver);
  33. extern REMOTE_API unsigned stopRemoteServer(ISocket * _socket);
  34. extern REMOTE_API const char *remoteServerVersionString();
  35. extern REMOTE_API IRemoteFileServer * createRemoteFileServer();
  36. extern REMOTE_API int setDafsTrace(ISocket * socket,byte flags);
  37. extern REMOTE_API bool enableDafsAuthentication(bool on);
  38. extern int remoteExec(ISocket * socket, const char *cmdline, const char *workdir,bool sync,
  39. size32_t insize, void *inbuf, MemoryBuffer *outbuf);
  40. extern void remoteExtractBlobElements(const SocketEndpoint &ep, const char * prefix, const char * filename, ExtractedBlobArray & extracted);
  41. extern int getDafsInfo(ISocket * socket,StringBuffer &retstr);
  42. extern void setDafsEndpointPort(SocketEndpoint &ep);
  43. extern void setDafsLocalMountRedirect(const IpAddress &ip,const char *dir,const char *mountdir);
  44. // client only
  45. extern void clientSetDaliServixSocketCaching(bool set);
  46. extern void clientCacheFileConnect(SocketEndpoint &ep,unsigned timeout);
  47. extern void clientDisconnectRemoteFile(IFile *file);
  48. extern void clientDisconnectRemoteIoOnExit(IFileIO *fileio,bool set);
  49. extern bool clientResetFilename(IFile *file, const char *newname); // returns false if not remote
  50. extern bool clientAsyncCopyFileSection(const char *uuid, // from genUUID - must be same for subsequent calls
  51. IFile *from, // expected to be remote
  52. RemoteFilename &to,
  53. offset_t toofs, // (offset_t)-1 created file and copies to start
  54. offset_t fromofs,
  55. offset_t size, // (offset_t)-1 for all file
  56. ICopyFileProgress *progress,
  57. unsigned timeout // 0 to start, non-zero to wait
  58. ); // returns true when done
  59. extern void clientSetRemoteFileTimeouts(unsigned maxconnecttime,unsigned maxreadtime);
  60. extern void clientAddSocketToCache(SocketEndpoint &ep,ISocket *socket);
  61. #endif