dllserver.hpp 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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 DLLSERVER_INCL
  14. #define DLLSERVER_INCL
  15. #ifdef DLLSERVER_EXPORTS
  16. #define DLLSERVER_API DECL_EXPORT
  17. #else
  18. #define DLLSERVER_API DECL_IMPORT
  19. #endif
  20. #include "jiface.hpp"
  21. class IpAddress;
  22. class RemoteFilename;
  23. class MemoryBuffer;
  24. class StringBuffer;
  25. interface IJlibDateTime;
  26. /**
  27. * IDLLLocation tracks where a generated DLL (or other artefact?) is located, and supports copying them to a location where they are required
  28. * In general this means copying from a location where they are only accessible via dafilesrv (and cannot therefore be directly loaded) to
  29. * a local location where they can. However, DLLs in shared off-node mounts are not currently describable.
  30. */
  31. enum DllLocationType
  32. {
  33. DllLocationNowhere = 0, // DLL does not exist anywhere
  34. DllLocationAnywhere = 1, // DLL exists but cannot be loaded directly
  35. DllLocationLocal = 2, // DLL exists on local machine but not in this process's DLL cache directory
  36. DllLocationDirectory = 3 // DLL exists in this process's cache directory
  37. };
  38. interface IDllLocation : extends IInterface
  39. {
  40. virtual void getDllFilename(RemoteFilename & filename) = 0;
  41. virtual void getIP(IpAddress & ip) = 0;
  42. virtual DllLocationType queryLocation() = 0;
  43. virtual void remove(bool removeFiles, bool removeDirectory) = 0;
  44. };
  45. interface IDllEntry : extends IInterface
  46. {
  47. virtual IIterator * createLocationIterator() = 0;
  48. virtual IDllLocation * getBestLocation() = 0;
  49. virtual IDllLocation * getBestLocationCandidate() = 0;
  50. virtual void getCreated(IJlibDateTime & dateTime) = 0;
  51. virtual const char * queryKind() = 0;
  52. virtual const char * queryName() = 0;
  53. virtual void remove(bool removeFiles, bool removeDirectory) = 0;
  54. };
  55. interface ILoadedDllEntry;
  56. interface IDllServer : extends IInterface
  57. {
  58. virtual IIterator * createDllIterator() = 0;
  59. virtual void ensureAvailable(const char * name, DllLocationType location) = 0;
  60. virtual void getDll(const char * name, MemoryBuffer & dllText) = 0;
  61. virtual IDllEntry * getEntry(const char * name) = 0;
  62. virtual DllLocationType isAvailable(const char * name) = 0;
  63. virtual ILoadedDllEntry * loadDll(const char * name, DllLocationType location) = 0;
  64. virtual ILoadedDllEntry * loadDllResources(const char * name, DllLocationType location) = 0;
  65. virtual void removeDll(const char * name, bool removeDlls, bool removeDirectory) = 0;
  66. virtual void registerDll(const char * name, const char * kind, const char * dllPath) = 0;
  67. virtual IDllEntry * createEntry(IPropertyTree *owner, IPropertyTree *entry) = 0;
  68. };
  69. extern DLLSERVER_API IDllServer & queryDllServer();
  70. extern DLLSERVER_API void closeDllServer();
  71. extern DLLSERVER_API void initDllServer(const char * localRoot);
  72. #endif