200-examples-OICMiddle-try-to-load-security-configuratio.patch 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. From ce27d50b9c11386242487852f14b025ed6c67701 Mon Sep 17 00:00:00 2001
  2. From: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
  3. Date: Wed, 19 Aug 2015 16:47:21 +0200
  4. Subject: [PATCH 14/14] examples: OICMiddle: try to load security
  5. configuration by default
  6. Load the security configuration from the default location by default.
  7. When it is not found security will just not work.
  8. Signed-off-by: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
  9. ---
  10. examples/OICMiddle/OICMiddle.cpp | 9 ++++++++-
  11. examples/OICMiddle/OICMiddle.h | 1 +
  12. 2 files changed, 9 insertions(+), 1 deletion(-)
  13. --- a/examples/OICMiddle/OICMiddle.cpp
  14. +++ b/examples/OICMiddle/OICMiddle.cpp
  15. @@ -99,8 +99,15 @@ void Middle::startPlatform()
  16. //std::string ipaddr = INADDR_ANY;
  17. std::string ipaddr = "0.0.0.0";
  18. + // Initialize Persistent Storage for SVR database
  19. + middle.ps.open = fopen;
  20. + middle.ps.read = fread;
  21. + middle.ps.write = fwrite;
  22. + middle.ps.close = fclose;
  23. + middle.ps.unlink = unlink;
  24. +
  25. PlatformConfig cfg { ServiceType::InProc, ModeType::Both,
  26. - ipaddr, port, QualityOfService::LowQos};
  27. + ipaddr, port, QualityOfService::LowQos, &middle.ps};
  28. OC::OCPlatform::Configure(cfg);
  29. }
  30. --- a/examples/OICMiddle/OICMiddle.h
  31. +++ b/examples/OICMiddle/OICMiddle.h
  32. @@ -83,6 +83,7 @@ protected:
  33. MiddleServer *m_server;
  34. LineInput *m_lineInput;
  35. RestInput *m_restInput;
  36. + OCPersistentStorage ps;
  37. protected:
  38. void startPlatform();