espcontext.hpp 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*##############################################################################
  2. Copyright (C) 2011 HPCC Systems.
  3. All rights reserved. This program is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU Affero General Public License as
  5. published by the Free Software Foundation, either version 3 of the
  6. License, or (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU Affero General Public License for more details.
  11. You should have received a copy of the GNU Affero General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. ############################################################################## */
  14. #ifndef _ESPCONTEXT_HPP__
  15. #define _ESPCONTEXT_HPP__
  16. /*#ifndef ESP_BUILTIN
  17. #ifdef _WIN32
  18. #define ESP_CONTEXT_API __declspec(dllexport)
  19. #endif
  20. #endif
  21. #ifndef ESP_CONTEXT_API
  22. #define ESP_CONTEXT_API
  23. #endif*/
  24. #include "esp.hpp"
  25. #include "esphttp.hpp"
  26. ESPHTTP_API IEspContext* createEspContext();
  27. // Get URL parameters (include these from Content)
  28. // Return: a=b&c=d format.
  29. ESPHTTP_API bool getUrlParams(IProperties *props, StringBuffer& params);
  30. // Only the original URL (not these from Content: URL form encoded)
  31. // Also remove these params that start with dot (.).
  32. // Return: a=b&c=d format.
  33. ESPHTTP_API void getEspUrlParams(IEspContext& ctx, StringBuffer& params, const char* excludeParams[]);
  34. ESPHTTP_API void addEspNativeArray(StringBuffer& schema, const char* xsdType, const char* arrayType);
  35. ESPHTTP_API void checkRequest(IEspContext& ctx);
  36. ESPHTTP_API LogLevel getEspLogLevel(IEspContext* );
  37. ESPHTTP_API LogLevel getEspLogLevel();
  38. ESPHTTP_API bool getEspLogRequests();
  39. ESPHTTP_API bool getEspLogResponses();
  40. ESPHTTP_API unsigned getSlowProcessingTime();
  41. ESPHTTP_API void ESPLOG(IEspContext* ctx, LogLevel level, const char* fmt, ...) __attribute__((format(printf, 3, 4)));
  42. ESPHTTP_API void ESPLOG(LogLevel level, const char* fmt, ...) __attribute__((format(printf, 2, 3)));
  43. ESPHTTP_API void setEspContainer(IEspContainer* container);
  44. ESPHTTP_API IEspContainer* getESPContainer();
  45. ESPHTTP_API void setCFD(const char* cfd);
  46. ESPHTTP_API const char* getCFD();
  47. ESPHTTP_API void setBuildVersion(const char* buildVersion);
  48. ESPHTTP_API const char* getBuildVersion();
  49. ESPHTTP_API void setBuildLevel(const char* buildLevel);
  50. ESPHTTP_API const char* getBuildLevel();
  51. #endif