First Commit
[librecmc/package-feed.git] / net / iotivity / patches / 200-examples-OICMiddle-try-to-load-security-configuratio.patch
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
7 Load the security configuration from the default location by default.
8 When it is not found security will just not work.
9
10 Signed-off-by: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
11 ---
12  examples/OICMiddle/OICMiddle.cpp |    9 ++++++++-
13  examples/OICMiddle/OICMiddle.h   |    1 +
14  2 files changed, 9 insertions(+), 1 deletion(-)
15
16 --- a/examples/OICMiddle/OICMiddle.cpp
17 +++ b/examples/OICMiddle/OICMiddle.cpp
18 @@ -99,8 +99,15 @@ void Middle::startPlatform()
19      //std::string ipaddr = INADDR_ANY;
20      std::string ipaddr = "0.0.0.0";
21  
22 +    // Initialize Persistent Storage for SVR database
23 +    middle.ps.open = fopen;
24 +    middle.ps.read = fread;
25 +    middle.ps.write = fwrite;
26 +    middle.ps.close = fclose;
27 +    middle.ps.unlink = unlink;
28 +
29      PlatformConfig cfg { ServiceType::InProc, ModeType::Both,
30 -                  ipaddr, port, QualityOfService::LowQos};
31 +                  ipaddr, port, QualityOfService::LowQos, &middle.ps};
32  
33      OC::OCPlatform::Configure(cfg);
34  }
35 --- a/examples/OICMiddle/OICMiddle.h
36 +++ b/examples/OICMiddle/OICMiddle.h
37 @@ -83,6 +83,7 @@ protected:
38      MiddleServer *m_server;
39      LineInput *m_lineInput;
40      RestInput *m_restInput;
41 +    OCPersistentStorage ps;
42  
43  protected:
44      void startPlatform();