[IOT-3022] 37/24637/4
authorOleksandr Dmytrenko <o.dmytrenko@samsung.com>
Thu, 12 Apr 2018 13:52:33 +0000 (16:52 +0300)
committerAleksey Volkov <a.volkov@samsung.com>
Wed, 18 Apr 2018 13:13:43 +0000 (13:13 +0000)
outdated cloud sample removed

Change-Id: I8d8991d1e6f5f0879c3a168b7807680710b2e0a2
Signed-off-by: Oleksandr Dmytrenko <o.dmytrenko@samsung.com>
13 files changed:
resource/csdk/security/provisioning/sample/SConscript
resource/csdk/security/provisioning/sample/cloud.dat [deleted file]
resource/csdk/security/provisioning/sample/cloud.json [deleted file]
resource/csdk/security/provisioning/sample/cloud/cloudCommon.c [deleted file]
resource/csdk/security/provisioning/sample/cloud/cloudCommon.h [deleted file]
resource/csdk/security/provisioning/sample/cloud/cloudDiscovery.c [deleted file]
resource/csdk/security/provisioning/sample/cloud/cloudDiscovery.h [deleted file]
resource/csdk/security/provisioning/sample/cloud/cloudResource.c [deleted file]
resource/csdk/security/provisioning/sample/cloud/cloudResource.h [deleted file]
resource/csdk/security/provisioning/sample/cloud/cloudWrapper.c [deleted file]
resource/csdk/security/provisioning/sample/cloud/cloudWrapper.h [deleted file]
resource/csdk/security/provisioning/sample/cloudClient.c [deleted file]
resource/csdk/security/provisioning/sample/cloudServer.c [deleted file]

index f29a7af..213b1b4 100644 (file)
@@ -104,22 +104,6 @@ if provisioning_sample_env.get('MULTIPLE_OWNER') == '1':
     sampleserver_preconfpin = provisioning_sample_env.Program(
         'sampleserver_preconfpin', 'sampleserver_preconfpin.cpp')
 
-if target_os not in ['msys_nt', 'windows']:
-    if provisioning_sample_env.get('WITH_TCP') == True and provisioning_sample_env.get('WITH_CLOUD') == True:
-        cloud_src = [
-            'cloud/cloudCommon.c',
-            'cloud/cloudWrapper.c',
-            'cloud/cloudDiscovery.c'
-        ]
-        cloudClient = provisioning_sample_env.Program(
-            'cloudClient', cloud_src + ['cloudClient.c'])
-        cloudServer = provisioning_sample_env.Program(
-            'cloudServer',
-            cloud_src + [
-                'cloudServer.c',
-                'cloud/cloudResource.c'
-            ])
-
 src_dir = provisioning_sample_env.get('SRC_DIR')
 sec_provisioning_src_dir = src_dir + '/resource/csdk/security/provisioning/sample/'
 sec_provisioning_build_dir = env.get(
@@ -133,9 +117,7 @@ if target_os not in ['msys_nt', 'windows']:
             sec_provisioning_src_dir + 'rootca.crt')
         if provisioning_sample_env.get('WITH_TCP') == True and provisioning_sample_env.get('WITH_CLOUD') == True:
             Alias("cloud", [
-                rootcert,
-                cloudClient,
-                cloudServer
+                rootcert
             ])
             provisioning_sample_env.AppendTarget("cloud")
 sampleapps = [
diff --git a/resource/csdk/security/provisioning/sample/cloud.dat b/resource/csdk/security/provisioning/sample/cloud.dat
deleted file mode 100644 (file)
index 29e93fd..0000000
Binary files a/resource/csdk/security/provisioning/sample/cloud.dat and /dev/null differ
diff --git a/resource/csdk/security/provisioning/sample/cloud.json b/resource/csdk/security/provisioning/sample/cloud.json
deleted file mode 100644 (file)
index fce2c84..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-{
-    "acl": {
-        "aclist2": [
-            {
-                "aceid": 1,
-                "subject": { "conntype": "anon-clear" },
-                "resources": [
-                    { "href": "/oic/res" },
-                    { "href": "/oic/d" },
-                    { "href": "/oic/p"}
-                ],
-                "permission": 2
-            },
-            {
-                "aceid": 2,
-                "subject": { "conntype": "auth-crypt" },
-                "resources": [
-                    { "href": "/oic/res" },
-                    { "href": "/oic/d" },
-                    { "href": "/oic/p"}
-                ],
-                "permission": 2
-            },
-            {
-                "aceid": 3,
-                "subject": { "conntype": "anon-clear" },
-                "resources": [
-                    { "href": "/oic/sec/doxm" }
-                ],
-                "permission": 14
-            },
-            {
-                "aceid": 4,
-                "subject": { "conntype": "auth-crypt" },
-                "resources": [
-                    { "href": "/oic/sec/doxm" },
-                    { "href": "/oic/sec/roles" }
-                ],
-                "permission": 14
-            }
-        ],
-        "rowneruuid" : "61646D69-6E44-6576-6963-655575696430"
-    },
-    "pstat": {
-        "dos": {"s": 3, "p": false},
-        "isop": true,
-        "cm": 0,
-        "tm": 0,
-        "om": 4,
-        "sm": 4,
-        "deviceuuid": "61646D69-6E44-6576-6963-655575696430",
-        "rowneruuid": "61646D69-6E44-6576-6963-655575696430"
-    },
-    "doxm": {
-        "oxms": [0],
-        "oxmsel": 0,
-        "sct": 9,
-        "owned": true,
-        "deviceuuid": "61646D69-6E44-6576-6963-655575696430",
-        "devowneruuid": "61646D69-6E44-6576-6963-655575696430",
-        "rowneruuid": "61646D69-6E44-6576-6963-655575696430"
-    }
-}
diff --git a/resource/csdk/security/provisioning/sample/cloud/cloudCommon.c b/resource/csdk/security/provisioning/sample/cloud/cloudCommon.c
deleted file mode 100644 (file)
index 18625d4..0000000
+++ /dev/null
@@ -1,763 +0,0 @@
-//******************************************************************
-//
-// Copyright 2016 Samsung Electronics All Rights Reserved.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "ocstack.h"
-#include "experimental/logger.h"
-#include "octhread.h"
-#include "cathreadpool.h"
-#include "ocpayload.h"
-#include "experimental/payload_logging.h"
-#include "aclresource.h"
-#include "acl_logging.h"
-#include "crl_logging.h"
-#include "crlresource.h"
-#include "ocprovisioningmanager.h"
-#include "casecurityinterface.h"
-#include "mbedtls/ssl_ciphersuites.h"
-
-#include "utils.h"
-#include "cloud/auth.h"
-#include "cloudCommon.h"
-#include "cloudWrapper.h"
-#include "cloudDiscovery.h"
-
-#ifdef __unix__
-#include <unistd.h> //for unlink
-#endif
-
-#define TAG "cloudCommon"
-
-//[IOT-2147] Requests 50-83 are not confirmed to new OCF spec
-//disable them for 1.3 rel, later (1.3.1 or after) they should be rewritten and enabled again
-#define DISABLE_50_83_REQUESTS_FOR_1_3_REL 1
-
-#define DEFAULT_HOST            "10.113.68.85"//"127.0.0.1"
-#define DEFAULT_PORT            OC_MULTICAST_PORT
-#define DEFAULT_AUTH_PROVIDER   "github"
-#define DEFAULT_DB_FILE         "./cloud.dat"
-#define DEFAULT_RESPONSE_WAIT_TIME (10 * 1000000) //10s
-
-#define GITHUB_AUTH_LINK        "https://github.com/login?return_to=%2Flogin%2Foauth%2Fauthorize%3Fclient_id%3Dea9c18f540323b0213d0%26redirect_uri%3Dhttp%253A%252F%252Fwww.example.com%252Foauth_callback%252F"
-
-#define CLIENT_ONLY(mode)       if (OC_SERVER == (mode)) { wrongRequest(); sendDataToServer = false; break; }
-
-static bool fExit = false;
-
-static oc_thread g_requestsThread = NULL;
-static char *fname = DEFAULT_DB_FILE;
-static uint64_t timeout;
-static uint16_t g_credId = 0;
-
-static oc_cond cond;
-static oc_mutex mutex;
-
-typedef enum {
-    SIGN_UP       = 1,
-    SIGN_IN       = 2,
-    SIGN_OUT      = 3,
-
-    HOST          = 4,
-    PORT          = 5,
-    AUTH_PROVIDER = 7,
-    USE_RSA = 8,
-    SAVE_TRUST_CERT = 9,
-    USE_SECURE_CONN = 10,
-    CONFIG_SELF_OWNERSHIP = 11,
-
-    DISCOVERY     = 13,
-    GET           = 14,
-    PUT           = 15,
-    POST          = 16,
-
-    CSR_SIGN      = 19,
-
-    CRL_GET       = 20,
-    CRL_POST      = 21,
-
-    ACL_ID_CREATE = 30,
-    ACL_ID_GET_BY_DEVICE = 31,
-    ACL_ID_DELETE = 32,
-
-    ACL_INDIVIDUAL_GET_INFO = 40,
-    ACL_INDIVIDUAL_UPDATE_ACE = 41,
-    ACL_INDIVIDUAL_UPDATE = 42,
-    ACL_INDIVIDUAL_DELETE = 43,
-    ACL_INDIVIDUAL_DELETE_ACE = 44,
-
-#ifndef DISABLE_50_83_REQUESTS_FOR_1_3_REL
-    ACL_GROUP_CREATE = 50,
-    ACL_GROUP_FIND   = 51,
-    ACL_GROUP_JOIN   = 52,
-    ACL_GROUP_OBSERVE= 53,
-    ACL_GROUP_DELETE = 54,
-
-    ACL_GROUP_SHARE_DEVICE  = 60,
-    ACL_GROUP_DELETE_DEVICE  = 61,
-    ACL_GROUP_GET_INFO  = 62,
-
-    ACL_POLICY_CHECK_REQUEST = 70,
-
-    ACL_GROUP_INVITE_USER = 80,
-    ACL_GROUP_GET_INVITE  = 81,
-    ACL_GROUP_DELETE_INVITE  = 82,
-    ACL_GROUP_CANCEL_INVITE  = 83,
-#endif
-
-    EXIT          = 99
-}CloudRequest;
-
-static void printMenu(OCMode mode)
-{
-    char *title = "Client";
-    if (OC_SERVER == mode)
-    {
-        title = "Server";
-    }
-    printf("************************************************************\n");
-    printf("****************** Cloud %s Requests *******************\n", title);
-    printf("************************************************************\n");
-    printf("** AUTHORIZATION\n");
-    printf("** %d - Sign Up request\n", SIGN_UP);
-    printf("** %d - Sign In request\n", SIGN_IN);
-    printf("** %d - Sign Out request\n", SIGN_OUT);
-
-    printf("** SETTINGS \n");
-    printf("** %d - Change default host\n", HOST);
-    printf("** %d - Change default port\n", PORT);
-    printf("** %d - Change default auth provider\n", AUTH_PROVIDER);
-    printf("** %d - Change TLS cipher suite (ECDSA/RSA)\n", USE_RSA);
-    printf("** %d - Save Trust Cert. Chain into Cred of SVR\n", SAVE_TRUST_CERT);
-    printf("** %d - Change Protocol type (CoAP/CoAPs)\n", USE_SECURE_CONN);
-    printf("** %d - Configure SVRdb as Self-OwnerShip\n", CONFIG_SELF_OWNERSHIP);
-
-    if (OC_CLIENT == mode)
-    {
-        printf("** DISCOVERY\n");
-        printf("** %d - Start Discovery\n", DISCOVERY);
-        printf("** %d - Get Request\n", GET);
-        printf("** %d - Put Request\n", PUT);
-        printf("** %d - Post Request\n", POST);
-    }
-
-    printf("** CERTIFICATE REQUEST\n");
-    printf("** %d - Certificate Request\n", CSR_SIGN);
-
-    printf("** CRL\n");
-    printf("** %d - CRL GET Request\n", CRL_GET);
-    printf("** %d - CRL POST Request\n", CRL_POST);
-
-    printf("** ACL MANAGER\n");
-    printf("** %d - ACL id create Request\n", ACL_ID_CREATE);
-    printf("** %d - ACL id retrieve by device Request\n", ACL_ID_GET_BY_DEVICE);
-    printf("** %d - ACL id delete Request\n", ACL_ID_DELETE);
-
-    printf("** ACL INDIVIDUAL\n");
-    printf("** %d - ACL individual get info Request\n", ACL_INDIVIDUAL_GET_INFO);
-    printf("** %d - ACL individual update ACE Request\n", ACL_INDIVIDUAL_UPDATE_ACE);
-    printf("** %d - ACL individual update Request\n", ACL_INDIVIDUAL_UPDATE);
-    printf("** %d - ACL individual delete Request\n", ACL_INDIVIDUAL_DELETE);
-    printf("** %d - ACL individual delete ACE Request\n", ACL_INDIVIDUAL_DELETE_ACE);
-
-#ifndef DISABLE_50_83_REQUESTS_FOR_1_3_REL
-    printf("** ACL GROUP MANAGER\n");
-    printf("** %d - ACL Create Group Request\n", ACL_GROUP_CREATE);
-    printf("** %d - ACL Find Group Request\n", ACL_GROUP_FIND);
-    printf("** %d - ACL Join to invited Group Request\n", ACL_GROUP_JOIN);
-    printf("** %d - ACL Observe Group Request\n", ACL_GROUP_OBSERVE);
-    printf("** %d - ACL Delete Group Request\n", ACL_GROUP_DELETE);
-
-    printf("** ACL INDIVIDUAL GROUP\n");
-    printf("** %d - ACL Share device into Group Request\n", ACL_GROUP_SHARE_DEVICE);
-    printf("** %d - ACL Delete device from Group Request\n", ACL_GROUP_DELETE_DEVICE);
-    printf("** %d - ACL Get Group Info Request\n", ACL_GROUP_GET_INFO);
-
-    printf("** ACL POLICY ENFORCEMENT\n");
-    printf("** %d - ACL Check Permissions Request\n", ACL_POLICY_CHECK_REQUEST);
-
-    printf("** ACL MEMBER INVITATION\n");
-    printf("** %d - ACL Invite user to group Request\n", ACL_GROUP_INVITE_USER);
-    printf("** %d - ACL Retrieve invitation Request\n", ACL_GROUP_GET_INVITE);
-    printf("** %d - ACL Delete invitation Request\n", ACL_GROUP_DELETE_INVITE);
-    printf("** %d - ACL Cancel invitation Request\n", ACL_GROUP_CANCEL_INVITE);
-#endif
-
-    printf("** EXIT\n");
-    printf("** %d - Exit cloud %s\n", EXIT, title);
-    printf("************************************************************\n");
-}
-
-void unlockMenu(void *data)
-{
-    OICFree(data);
-
-    if (!fExit)
-    {
-        oc_mutex_lock(mutex);
-        oc_cond_signal(cond);
-        oc_mutex_unlock(mutex);
-    }
-}
-
-/**
- * This is default callback to all requests
- * Used to sync with main menu
- *
- * @param[in] ctx          context
- * @param[in] result       result
- * @param[in] data         data
- */
-static void handleCB(void* ctx, OCClientResponse *response, void* data)
-{
-    OC_UNUSED(ctx);
-    OC_UNUSED(data);
-
-    if (response)
-    {
-        OIC_LOG_V(INFO, TAG, "%s: Received result = %d", __func__, response->result);
-
-        if (response->payload)
-        {
-            OIC_LOG(INFO, TAG, "Payload received:");
-            OIC_LOG_PAYLOAD(INFO, response->payload);
-        }
-    }
-    else
-    {
-        OIC_LOG_V(ERROR, TAG, "%s: Received NULL response", __func__);
-    }
-
-    unlockMenu(NULL);
-}
-
-/**
- * This function prints Acl id and calls default callback function handleCB()
- *
- * @param[in] ctx          context
- * @param[in] result       result
- * @param[in] aclId        acl id
- */
-static void handleAclIdCB(void* ctx, OCClientResponse *response, void* aclId)
-{
-    OIC_LOG_V(INFO, TAG, "Received Acl id = %s", (char *)aclId);
-    handleCB(ctx, response, aclId);
-    OICFree(aclId);
-}
-
-#ifndef DISABLE_50_83_REQUESTS_FOR_1_3_REL
-/**
- * This function prints group id and calls default callback function handleCB()
- *
- * @param[in] ctx          context
- * @param[in] result       result
- * @param[in] groupId      group id
- */
-static void handleAclCreateGroupCB(void* ctx, OCClientResponse *response, void* groupId)
-{
-    OIC_LOG_V(INFO, TAG, "Received gid = %s", (char *)groupId);
-    handleCB(ctx, response, groupId);
-    OICFree(groupId);
-}
-
-/**
- * This function prints group policy and calls default callback function handleCB()
- *
- * @param[in] ctx          context
- * @param[in] result       result
- * @param[in] gp           group policy
- */
-static void handleAclPolicyCheckCB(void* ctx, OCClientResponse *response, void* gp)
-{
-    OIC_LOG_V(INFO, TAG, "Received gp = %s", (char *)gp);
-    handleCB(ctx, response, gp);
-    OICFree(gp);
-}
-#endif
-
-/**
- * This function prints received acl and calls default callback function handleCB()
- *
- * @param[in] ctx          context
- * @param[in] result       result
- * @param[in] acl          acl
- */
-static void handleAclIndividualGetInfoCB(void* ctx, OCClientResponse *response, void* acl)
-{
-    OIC_LOG_ACL(INFO, acl);
-    handleCB(ctx, response, acl);
-    //can't delete acl here because its ACE's were added to gAcl
-    //TODO: changes in aclresources.c required to fix that
-}
-
-#ifndef DISABLE_50_83_REQUESTS_FOR_1_3_REL
-/**
- * This function prints received group id list and calls default callback function handleCB()
- *
- * @param[in] ctx          context
- * @param[in] result       result
- * @param[in] gidList      group id list
- */
-static void handleAclFindMyGroupCB(void* ctx, OCClientResponse *response, void* gidList)
-{
-    printStringArray((stringArray_t *)gidList);
-    handleCB(ctx, response, gidList);
-    clearStringArray((stringArray_t *)gidList);
-}
-#endif
-
-/**
- * This function prints received acl and calls default callback function handleCB()
- *
- * @param[in] ctx          context
- * @param[in] result       result
- * @param[in] crl          crl
- */
-static void handleGetCrlCB(void* ctx, OCClientResponse *response, void* crl)
-{
-    OIC_LOG_CRL(INFO, crl);
-    handleCB(ctx, response, crl);
-    DeleteCrl((OicSecCrl_t *)crl);
-}
-
-#ifndef DISABLE_50_83_REQUESTS_FOR_1_3_REL
-/**
- * This function prints received invitation response and calls default callback function handleCB()
- *
- * @param[in] ctx          context
- * @param[in] result       result
- * @param[in] invite       invitation response (it has inviteResponse_t* type)
- */
-static void handleAclGetInvitationCB(void* ctx, OCClientResponse *response, void* invite)
-{
-    printInviteResponse((inviteResponse_t *)invite);
-    handleCB(ctx, response, invite);
-    clearInviteResponse((inviteResponse_t *)invite);
-    OICFree(invite);
-}
-#endif
-
-static OCStackResult saveTrustCert(void)
-{
-    OCStackResult res = OC_STACK_ERROR;
-    OIC_LOG(INFO, TAG, "Save Trust Cert. Chain into Cred of SVR");
-
-    ByteArray_t trustCertChainArray = {0, 0};
-    const char *filename = "rootca.crt";
-
-    if (!readFile(filename, (OCByteString *)&trustCertChainArray))
-    {
-        OIC_LOG_V(ERROR, TAG, "Can't read %s file", filename);
-        return OC_STACK_ERROR;
-    }
-    OIC_LOG_BUFFER(DEBUG, TAG, trustCertChainArray.data, trustCertChainArray.len);
-
-    res = OCSaveTrustCertChain(trustCertChainArray.data, trustCertChainArray.len, OIC_ENCODING_PEM,&g_credId);
-
-    if (OC_STACK_OK != res)
-    {
-        OIC_LOG(ERROR, TAG, "OCSaveTrustCertChain API error");
-    }
-    else
-    {
-        OIC_LOG_V(INFO, TAG, "CredId of Saved Trust Cert. Chain into Cred of SVR : %d.\n", g_credId);
-    }
-    OICFree(trustCertChainArray.data);
-
-    return res;
-}
-
-static OCStackResult configSelfOwnership(void)
-{
-    OCStackResult res = OC_STACK_ERROR;
-    OIC_LOG(INFO, TAG, "Configures SVR DB as self-ownership.");
-
-    res = OCConfigSelfOwnership();
-
-    if (OC_STACK_OK != res)
-    {
-        OIC_LOG(ERROR, TAG, "OCConfigSelfOwnership API error. Please check SVR DB");
-    }
-    else
-    {
-        OIC_LOG(INFO, TAG, "Success to configures SVR DB as self-ownership");
-    }
-
-    return res;
-}
-
-static void wrongRequest(void)
-{
-    printf(">> Entered Wrong Menu Number. Please Enter Again\n\n");
-}
-
-static void *userRequests(void *data)
-{
-    if (NULL == data)
-    {
-        OIC_LOG(ERROR, TAG, "Received NULL data");
-        return NULL;
-    }
-
-    OCMode mode = *(OCMode*)data;
-
-    mutex = oc_mutex_new();
-    cond = oc_cond_new();
-
-    OicCloud_t *cloud = (OicCloud_t *)OICCalloc(1,sizeof(OicCloud_t));
-    if (NULL == cloud)
-    {
-        OIC_LOG(ERROR, TAG, "cloud calloc failed");
-        return NULL;
-    }
-    cloud->cis = (char *)OICCalloc(1,1024 * 4);
-    if (NULL == cloud->cis)
-    {
-        OIC_LOG(ERROR, TAG, "cloud->cis calloc failed");
-        OICFree(cloud);
-        return NULL;
-    }
-    cloud->apn = (char *)OICCalloc(1,512);
-    if (NULL == cloud->apn)
-    {
-        OIC_LOG(ERROR, TAG, "cloud->apn calloc failed");
-        OICFree(cloud->cis);
-        OICFree(cloud);
-        return NULL;
-    }
-    cloud->at = (char *)OICCalloc(1,1024);
-    if (NULL == cloud->at)
-    {
-        OIC_LOG(ERROR, TAG, "cloud->at calloc failed");
-        OICFree(cloud->apn);
-        OICFree(cloud->cis);
-        OICFree(cloud);
-        return NULL;
-    }
-
-    while (false == fExit)
-    {
-        OCStackResult res = OC_STACK_ERROR;
-        bool sendDataToServer = true;
-        timeout = DEFAULT_RESPONSE_WAIT_TIME;
-        //startup report
-        printf("-----------------------------------------------------------\n");
-        printf("Connecting to: %s\n", cloud->cis);
-        printf("srv file: %s\n", fname);
-        printf("-----------------------------------------------------------\n");
-
-        printMenu(mode);
-
-        int request = 0;
-        readInteger(&request, "Menu number", "see above");
-
-        switch (request)
-        {
-        case SIGN_UP:
-            if (0 == strcmp(cloud->at, DEFAULT_AUTH_PROVIDER))
-            {
-                printf("Paste to browser %s and get auth code\n", GITHUB_AUTH_LINK);
-            }
-            readString(cloud->at, 1024, "auth token", "check link above");
-            res = OCCloudSignUp(cloud);
-            break;
-        case SIGN_IN:
-            res = OCCloudSignIn(cloud);
-            break;
-        case SIGN_OUT:
-            res = OCCloudSignOut(cloud);
-            break;
-        case HOST:
-            readString(cloud->cis, 1024 * 4, "cloud uri(coaps+tcp://ip:port)", DEFAULT_HOST);
-            sendDataToServer = false;
-            break;
-        case CRL_GET:
-            res = OCWrapperGetCRL(cloud->cis, handleGetCrlCB);
-            break;
-        case CRL_POST:
-            res = OCWrapperPostCRL(cloud->cis, handleCB);
-            break;
-#ifndef DISABLE_50_83_REQUESTS_FOR_1_3_REL
-        case ACL_GROUP_CREATE:
-            res = OCWrapperAclCreateGroup(cloud->cis, handleAclCreateGroupCB);
-            break;
-        case ACL_GROUP_FIND:
-            res = OCWrapperAclFindMyGroup(cloud->cis, handleAclFindMyGroupCB);
-            break;
-        case ACL_GROUP_DELETE:
-            res = OCWrapperAclDeleteGroup(cloud->cis, handleCB);
-            break;
-        case ACL_GROUP_JOIN:
-            res = OCWrapperAclJoinToInvitedGroup(cloud->cis, handleCB);
-            break;
-        case ACL_GROUP_OBSERVE:
-            res = OCWrapperAclObserveGroup(cloud->cis, handleCB);
-            break;
-        case ACL_GROUP_SHARE_DEVICE:
-            res = OCWrapperAclShareDeviceIntoGroup(cloud->cis, handleCB);
-            break;
-        case ACL_GROUP_DELETE_DEVICE:
-            res = OCWrapperAclDeleteDeviceFromGroup(cloud->cis, handleCB);
-            break;
-        case ACL_GROUP_GET_INFO:
-            res = OCWrapperAclGroupGetInfo(cloud->cis, handleCB);
-            break;
-        case ACL_GROUP_INVITE_USER:
-            res = OCWrapperAclInviteUser(cloud->cis, handleCB);
-            break;
-        case ACL_GROUP_GET_INVITE:
-            res = OCWrapperAclGetInvitation(cloud->cis, handleAclGetInvitationCB);
-            break;
-        case ACL_GROUP_DELETE_INVITE:
-            res = OCWrapperAclDeleteInvitation(cloud->cis, handleCB);
-            break;
-        case ACL_GROUP_CANCEL_INVITE:
-            res = OCWrapperAclCancelInvitation(cloud->cis, handleCB);
-            break;
-        case ACL_POLICY_CHECK_REQUEST:
-            res = OCWrapperAclPolicyCheck(cloud->cis, handleAclPolicyCheckCB);
-            break;
-#endif
-        case ACL_ID_GET_BY_DEVICE:
-            res = OCWrapperAclIdGetByDevice(cloud->cis, handleAclIdCB);
-            break;
-        case ACL_ID_CREATE:
-            res = OCWrapperAclIdCreate(cloud->cis, handleAclIdCB);
-            break;
-        case ACL_ID_DELETE:
-            res = OCWrapperAclIdDelete(cloud->cis, handleCB);
-            break;
-        case ACL_INDIVIDUAL_GET_INFO:
-            res = OCWrapperAclIndividualGetInfo(cloud->cis, handleAclIndividualGetInfoCB);
-            break;
-        case ACL_INDIVIDUAL_UPDATE_ACE:
-            res = OCWrapperAclIndividualUpdateAce(cloud->cis, handleCB);
-            break;
-        case ACL_INDIVIDUAL_UPDATE:
-            res = OCWrapperAclIndividualUpdate(cloud->cis, handleCB);
-            break;
-        case ACL_INDIVIDUAL_DELETE:
-            res = OCWrapperAclIndividualDelete(cloud->cis, handleCB);
-            break;
-        case ACL_INDIVIDUAL_DELETE_ACE:
-            res = OCWrapperAclIndividualDeleteAce(cloud->cis, handleCB);
-            break;
-        case CSR_SIGN:
-            res = OCWrapperCertificateIssueRequest(cloud->cis, handleCB);
-            break;
-        case DISCOVERY:
-            CLIENT_ONLY(mode);
-            res = InitDiscovery();
-            break;
-        case GET:
-            CLIENT_ONLY(mode);
-            res = InitRequest(OC_REST_GET);
-            break;
-        case PUT:
-            CLIENT_ONLY(mode);
-            res= InitRequest(OC_REST_PUT);
-            break;
-        case POST:
-            CLIENT_ONLY(mode);
-            res= InitRequest(OC_REST_POST);
-            break;
-        case USE_RSA:
-        {
-            int tmp = 0;
-            readInteger(&tmp, "Select Cipher Suite", "0 - ECDSA, other - RSA");
-            uint16_t cipher = tmp? MBEDTLS_TLS_RSA_WITH_AES_128_GCM_SHA256:
-                                   MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8;
-            if (OC_STACK_OK != OCSelectCipherSuite(cipher, OC_ADAPTER_TCP))
-            {
-                OIC_LOG(ERROR, TAG, "CASelectCipherSuite returned an error");
-            }
-            sendDataToServer = false;
-        }
-            break;
-        case SAVE_TRUST_CERT:
-            saveTrustCert();
-            sendDataToServer = false;
-            break;
-        case USE_SECURE_CONN:
-        {
-            int tmp = 0;
-            readInteger(&tmp, "CoAP protocol type", "0 - non-secure, 1 - secure");
-            setCoapPrefix(0 == tmp ? false : true);
-            sendDataToServer = false;
-        }
-            break;
-        case CONFIG_SELF_OWNERSHIP:
-            configSelfOwnership();
-            sendDataToServer = false;
-            break;
-        case EXIT:
-            oc_mutex_free(mutex);
-            oc_cond_free(cond);
-            fExit = true;
-            sendDataToServer = false;
-            break;
-        default:
-            wrongRequest();
-            sendDataToServer = false;
-            break;
-        }
-
-        //if requests were sent then wait response
-        if (sendDataToServer)
-        {
-            if (OC_STACK_OK == res)
-            {
-                oc_mutex_lock(mutex);
-                oc_cond_wait_for(cond, mutex, timeout);
-                oc_mutex_unlock(mutex);
-            }
-            else
-            {
-                OIC_LOG_V(ERROR, TAG, "Request returned an error %d", res);
-            }
-        }
-    }
-    OICFree(cloud);
-    return NULL;
-}
-
-FILE* server_fopen(const char *path, const char *mode)
-{
-    if (0 == strcmp(path, OC_SECURITY_DB_DAT_FILE_NAME))
-    {
-        return fopen(fname, mode);
-    }
-    else
-    {
-        return fopen(path, mode);
-    }
-}
-
-/**
- * Check file accessibility
- *
- * @param[in] name        file path
- * @return true           if check was successful
- */
-static bool checkConfig(const char *name)
-{
-    FILE* file = fopen(name, "rb");
-
-    if (file)
-    {
-        fclose(file);
-        return true;
-    }
-    return false;
-}
-
-static void printUsage(char *name)
-{
-    printf("Wrong arguments count!\n");
-    printf("Usage : %s <database_filename>\n", name);
-    printf("Examples : 1) %s 2) %s cloud.dat\n", name, name);
-}
-
-bool parseCommandLineArguments(int argc, char *argv[])
-{
-    bool result = true;
-    if (2 == argc)
-    {
-        fname = argv[1];
-
-        if (!checkConfig(fname))
-        {
-            OIC_LOG_V(ERROR, TAG, "Can't open database file %s, exit!", fname);
-            result = false;
-        }
-    }
-    else if (argc > 2)
-    {
-        printUsage(argv[0]);
-        result = false;
-    }
-    return result;
-}
-
-OCStackResult initPersistentStorage(void)
-{
-    //Initialize Persistent Storage for SVR database
-    static OCPersistentStorage ps = {server_fopen, fread, fwrite, fclose, unlink};
-
-    return OCRegisterPersistentStorageHandler(&ps);
-}
-
-OCStackResult startRequestsThread(OCMode *mode)
-{
-    OCThreadResult_t res = oc_thread_new(&g_requestsThread, userRequests, mode);
-
-    if (OC_THREAD_SUCCESS != res)
-    {
-        OIC_LOG_V(ERROR, TAG, "oc_thread_new failed - error %u", res);
-        return OC_STACK_NO_MEMORY;
-    }
-
-    return OC_STACK_OK;
-}
-
-OCStackResult initProcess(OCMode mode)
-{
-    return OCInit(NULL, 0, mode);
-}
-
-void startProcess(void)
-{
-    while(false == fExit)
-    {
-        if (OCProcess() != OC_STACK_OK)
-        {
-            OIC_LOG(ERROR, TAG,"OCProcess process error, exit\n");
-            break;
-        }
-    }
-
-    if (OCStop() != OC_STACK_OK)
-    {
-        OIC_LOG(ERROR, TAG, "OCStop process error\n");
-    }
-}
-
-void freeThreadResources(void)
-{
-    if (g_requestsThread)
-    {
-        OCThreadResult_t res = oc_thread_wait(g_requestsThread);
-
-        if (OC_THREAD_SUCCESS != res)
-        {
-            OIC_LOG_V(ERROR, TAG, "oc_thread_wait failed - error %u", res);
-        }
-
-        res = oc_thread_free(g_requestsThread);
-
-        if (OC_THREAD_SUCCESS != res)
-        {
-            OIC_LOG_V(ERROR, TAG, "oc_thread_free failed - error %u", res);
-        }
-
-        g_requestsThread = NULL;
-    }
-}
diff --git a/resource/csdk/security/provisioning/sample/cloud/cloudCommon.h b/resource/csdk/security/provisioning/sample/cloud/cloudCommon.h
deleted file mode 100644 (file)
index 342d269..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-/* *****************************************************************
- *
- * Copyright 2016 Samsung Electronics All Rights Reserved.
- *
- *
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * *****************************************************************/
-#ifndef CLOUD_COMMON_H
-#define CLOUD_COMMON_H
-
-#include "octypes.h"
-
-/**
- * Used parse command line arguments
- * Interpret given argument as database filename and check that given file exists
- *
- * @param[in] argc  count of command line parameters
- * @param[in] argv  command line parameters
- * @return  bool true if parameters are correct, false otherwise
- */
-bool parseCommandLineArguments(int argc, char *argv[]);
-
-/**
- * This function initializes persistent storage
- * It uses database filename from global variable
- *
- * @return  OCStackResult application result
- */
-OCStackResult initPersistentStorage(void);
-
-/**
- * Used to display Main Menu and send requests
- *
- * @param[in] mode  OC_CLIENT/OC_SERVER mode
- * @return  OCStackResult application result
- */
-OCStackResult startRequestsThread(OCMode *mode);
-
-/**
- * This function initialize main process
- *
- * @param[in] mode  in which mode process starts (client/server/both/gateway)
- * @return  OCStackResult application result
- */
-OCStackResult initProcess(OCMode mode);
-
-/**
- * This function starts main process which responds to any requests
- */
-void startProcess(void);
-
-/**
- * This function frees thread pool data
- */
-void freeThreadResources(void);
-
-/**
- * Used to sync with Main Menu
- * Create this function to have proper API for delete callbacks
- *
- * @param[in] data         data
- */
-void unlockMenu(void *data);
-
-#endif // CLOUD_COMMON_H
diff --git a/resource/csdk/security/provisioning/sample/cloud/cloudDiscovery.c b/resource/csdk/security/provisioning/sample/cloud/cloudDiscovery.c
deleted file mode 100644 (file)
index 471b586..0000000
+++ /dev/null
@@ -1,259 +0,0 @@
-//******************************************************************
-//
-// Copyright 2016 Samsung Electronics All Rights Reserved.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-#include "ocstack.h"
-#include "experimental/logger.h"
-#include "ocpayload.h"
-#include "experimental/payload_logging.h"
-#include "oic_string.h"
-#include "srmresourcestrings.h"
-#include "pmutility.h"
-
-#include "cloudCommon.h"
-#include "cloudWrapper.h"
-
-#define TAG "cloudDiscovery"
-
-#define DISCOVERY_URI "/oic/res"
-
-static OCDevAddr endPoint;
-static OCConnectivityType ocConnType = CT_DEFAULT;
-static char gUri[MAX_URI_LENGTH] = {0};
-
-bool withTcp = true;
-
-/**
- * This function clears internal data
- */
-static void clearData(void)
-{
-    memset(&endPoint, 0, sizeof(endPoint));
-    memset(gUri, 0, sizeof(gUri));
-    ocConnType = CT_DEFAULT;
-}
-
-/**
- * This function parses Discovery payload
- * It tries to find secure devices
- *
- * @param[in] clientResponse   response from peer
- */
-static void parseClientResponse(OCClientResponse * clientResponse)
-{
-    OIC_LOG_V(DEBUG, TAG, "IN: %s",__func__);
-
-    if (!clientResponse || !clientResponse->payload)
-    {
-        OIC_LOG_V(WARNING, TAG, "OUT: %s: %s is NULL",__func__, 
-            !clientResponse ? "clientResponse" : "clientResponse->payload");
-        return;
-    }
-
-    OCResourcePayload* res = ((OCDiscoveryPayload*)clientResponse->payload)->resources;
-    
-    while (res)
-    {
-        char *uri = res->uri;
-        OIC_LOG_V(INFO, TAG, "Uri -- %s", uri);
-
-        if (0 == strcmp(uri, OIC_RSRC_DOXM_URI))
-        {
-            OIC_LOG(INFO,TAG,"Skip: doxm is secure virtual resource");
-            goto next;
-        }
-        if (0 == strcmp(uri, OIC_RSRC_PSTAT_URI))
-        {
-            OIC_LOG(INFO,TAG,"Skip: pstat is secure virtual resource");
-            goto next;
-        }
-
-        OIC_LOG_V(INFO, TAG, "Secure -- %s", res->secure ? "YES" : "NO");
-
-        if (res->secure)
-        {
-            ocConnType = clientResponse->connType;
-            endPoint = clientResponse->devAddr;
-
-            if(withTcp)
-            {
-                OIC_LOG_V(INFO,TAG,"SECUREPORT tcp: %d",res->tcpPort);
-                endPoint.port = res->tcpPort;
-            }
-            else
-            {
-                OIC_LOG_V(INFO,TAG,"SECUREPORT udp: %d",res->port);
-                endPoint.port = res->port;
-            }
-            OICStrcpy(gUri, sizeof(gUri), uri);
-            break;
-        }
-
-        next:
-        res = res->next;
-    }
-    OIC_LOG_V(DEBUG, TAG, "OUT: %s",__func__);
-}
-
-/**
- * This function handles discovery response
- *
- * @param[in] ctx                    context
- * @param[in] handle                 handle
- * @param[in] response               response from peer
- * @return  OCStackApplicationResult application result
- */
-static OCStackApplicationResult handleDiscoveryResponse(void *ctx, OCDoHandle handle,
-                                                        OCClientResponse * clientResponse)
-{
-    OC_UNUSED(ctx);
-    OC_UNUSED(handle);
-
-    if (NULL == clientResponse)
-    {
-        OIC_LOG(ERROR, TAG, "Receive NULL response");
-        return OC_STACK_DELETE_TRANSACTION;
-    }
-
-    if (OC_STACK_OK == clientResponse->result)
-    {
-        OIC_LOG(INFO, TAG, "Discovery successful!");
-    }
-    else
-    {
-        OIC_LOG_V(INFO, TAG, "Discovery fails with result: %d", clientResponse->result);
-    }
-
-    if (clientResponse->payload)
-    {
-        OIC_LOG_PAYLOAD(INFO, clientResponse->payload);
-    }
-    else
-    {
-        OIC_LOG(ERROR, TAG, "Receive NULL payload");
-    }
-
-    OIC_LOG_V(INFO, TAG,
-            "Device =============> Discovered @ %s:%d",
-            clientResponse->devAddr.addr,
-            clientResponse->devAddr.port);
-
-    parseClientResponse(clientResponse);
-
-    return OC_STACK_KEEP_TRANSACTION;
-}
-
-/**
- * This function handles any response from secure device
- *
- * @param[in] ctx                    context
- * @param[in] handle                 handle
- * @param[in] response               response from peer
- * @return  OCStackApplicationResult application result
- */
-static OCStackApplicationResult handleResponse(void *ctx, OCDoHandle handle,
-                                               OCClientResponse * clientResponse)
-{
-    OC_UNUSED(ctx);
-    OC_UNUSED(handle);
-
-    if(!clientResponse)
-    {
-        OIC_LOG_V(ERROR, TAG, "%s: Received NULL response",  __func__);
-        return OC_STACK_DELETE_TRANSACTION;
-    }
-
-    if (NULL == ctx)
-    {
-        OIC_LOG_V(ERROR, TAG, "%s: Received NULL context, exit",  __func__);
-        return OC_STACK_DELETE_TRANSACTION;
-    }
-
-    char *str = NULL;
-    OCMethod method = *((OCMethod*)ctx);
-
-    switch (method)
-    {
-        case OC_REST_GET:
-            str = "Get";
-            break;
-        case OC_REST_PUT:
-            str = "Put";
-            break;
-        case OC_REST_POST:
-            str = "Post";
-            break;
-        default:
-            OIC_LOG_V(INFO, TAG, "Received Wrong method %d. Skip response", method);
-            return OC_STACK_ERROR;
-    }
-
-    OIC_LOG_V(INFO, TAG, "StackResult: %d",  clientResponse->result);
-    OIC_LOG_V(INFO, TAG, "SEQUENCE NUMBER: %d", clientResponse->sequenceNumber);
-    OIC_LOG_PAYLOAD(INFO, clientResponse->payload);
-    OIC_LOG_V(INFO, TAG, "=============> %s Response", str);
-
-    return OC_STACK_DELETE_TRANSACTION;
-}
-
-OCStackResult InitDiscovery(void)
-{
-    clearData();
-
-    OCCallbackData cbData;
-    memset(&cbData, 0, sizeof(OCCallbackData));
-    cbData.cb = handleDiscoveryResponse;
-    cbData.cd = unlockMenu;
-
-    return OCDoResource(NULL, OC_REST_DISCOVER, DISCOVERY_URI, NULL, 0,
-                        CT_DEFAULT, OC_LOW_QOS, &cbData, NULL, 0);
-}
-
-OCStackResult InitRequest(OCMethod method)
-{
-    if (0 == endPoint.port || 0 == endPoint.addr[0])
-    {
-        OIC_LOG(ERROR, TAG, "Host or port are missing. Please execute Discovery first!");
-        return OC_STACK_ERROR;
-    }
-
-    OCMethod *tmp = OICCalloc(1, sizeof(OCMethod));
-    if (!tmp)
-    {
-        OIC_LOG(ERROR, TAG, "Can't allocate tmp");
-        return OC_STACK_NO_MEMORY;
-    }
-
-    *tmp = method;
-
-    OIC_LOG_V(INFO, TAG, "Executing uri = %s", gUri);
-    OIC_LOG_V(INFO, TAG, "Send Request to %s:%d", endPoint.addr, endPoint.port);
-
-    endPoint.flags = (OCTransportFlags)(endPoint.flags | OC_SECURE);
-    endPoint.adapter = OC_ADAPTER_TCP;
-
-
-    OCCallbackData cbData;
-    memset(&cbData, 0, sizeof(OCCallbackData));
-    cbData.cd = unlockMenu;
-    cbData.cb = handleResponse;
-    cbData.context = (void *)tmp;
-
-    return OCDoResource(NULL, method, gUri, &endPoint, 0,
-                        ocConnType, OC_LOW_QOS, &cbData, NULL, 0);
-}
diff --git a/resource/csdk/security/provisioning/sample/cloud/cloudDiscovery.h b/resource/csdk/security/provisioning/sample/cloud/cloudDiscovery.h
deleted file mode 100644 (file)
index afd5ad9..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/* *****************************************************************
- *
- * Copyright 2016 Samsung Electronics All Rights Reserved.
- *
- *
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * *****************************************************************/
-#ifndef CLOUD_DISCOVERY_H
-#define CLOUD_DISCOVERY_H
-
-/**
- * This function discovers devices
- *
- * @param[in] secure   secure flag
- */
-OCStackResult InitDiscovery(void);
-
-/**
- * This function sends GET/PUT/POST request to peer
- * Peer info taken from previous discovery
- *
- * @param[in] method   request method
- */
-OCStackResult InitRequest(OCMethod method);
-
-#endif // CLOUD_DISCOVERY_H
diff --git a/resource/csdk/security/provisioning/sample/cloud/cloudResource.c b/resource/csdk/security/provisioning/sample/cloud/cloudResource.c
deleted file mode 100644 (file)
index fc33bd7..0000000
+++ /dev/null
@@ -1,268 +0,0 @@
-/* *****************************************************************
- *
- * Copyright 2016 Samsung Electronics All Rights Reserved.
- *
- *
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * *****************************************************************/
-#include <string.h>
-#include "cloudCommon.h"
-#include "ocstack.h"
-#include "experimental/logger.h"
-#include "ocpayload.h"
-
-#include "cloudResource.h"
-
-#define TAG "cloudResource"
-
-LEDResource LED;
-char *gResourceUri = (char *)"/a/led";
-
-// This variable determines instance number of the LED resource.
-// Used by POST method to create a new instance of LED resource.
-static int gCurrLedInstance = 0;
-#define SAMPLE_MAX_NUM_POST_INSTANCE  2
-static LEDResource gLedInstance[SAMPLE_MAX_NUM_POST_INSTANCE];
-
-static OCRepPayload* getPayload(const char* uri, int64_t power, bool state)
-{
-    OCRepPayload* payload = OCRepPayloadCreate();
-    if(!payload)
-    {
-        OIC_LOG(ERROR, TAG, "Failed to allocate Payload");
-        return NULL;
-    }
-
-    OCRepPayloadSetUri(payload, uri);
-    OCRepPayloadSetPropBool(payload, "state", state);
-    OCRepPayloadSetPropInt(payload, "power", power);
-
-    return payload;
-}
-
-static OCEntityHandlerResult ProcessRequest (OCEntityHandlerRequest *request,
-        OCRepPayload **payload)
-{
-    OIC_LOG_V(DEBUG, TAG, "%s: IN",  __func__);
-
-    if(!request)
-    {
-        OIC_LOG_V(ERROR, TAG, "%s: OUT: request is NULL",__func__);
-        return OC_EH_ERROR;
-    }
-
-    OIC_LOG_V(DEBUG, TAG, "%s: method: %d",  __func__, request->method);
-
-    LEDResource *currLEDResource = &LED;
-
-    if (request->resource == gLedInstance[0].handle)
-    {
-        currLEDResource = &gLedInstance[0];
-        gResourceUri = (char *) "/a/led/0";
-    }
-    else if (request->resource == gLedInstance[1].handle)
-    {
-        currLEDResource = &gLedInstance[1];
-        gResourceUri = (char *) "/a/led/1";
-    }
-
-    if(OC_REST_PUT == request->method)
-    {
-        if (!request->payload || request->payload->type != PAYLOAD_TYPE_REPRESENTATION)
-        {
-            OIC_LOG_V(ERROR, TAG, "%s: OUT: Incoming payload type(%d) is not a representation",
-                      __func__, request->payload ? request->payload->type : 0);
-            return OC_EH_ERROR;
-        }
-        OCRepPayload* input = (OCRepPayload*)request->payload;
-        // Get pointer to query
-        int64_t pow;
-        if(OCRepPayloadGetPropInt(input, "power", &pow))
-        {
-            currLEDResource->power =pow;
-        }
-
-        bool state;
-        if(OCRepPayloadGetPropBool(input, "state", &state))
-        {
-            currLEDResource->state = state;
-        }
-    }
-
-    *payload = getPayload(gResourceUri, currLEDResource->power, currLEDResource->state);
-
-    OIC_LOG_V(DEBUG, TAG, "%s: OUT",  __func__);
-
-    return (*payload) ? OC_EH_OK : OC_EH_ERROR;
-}
-
-static OCEntityHandlerResult ProcessPostRequest (OCEntityHandlerRequest *request,
-        char *resourceUri, OCRepPayload **payload)
-{
-    OCRepPayload *answer = NULL;
-    OCEntityHandlerResult result = OC_EH_ERROR;
-
-    /*
-     * The entity handler determines how to process a POST request.
-     * Per the REST paradigm, POST can also be used to update representation of existing
-     * resource or create a new resource.
-     * In the sample below, if the POST is for /a/led then a new instance of the LED
-     * resource is created with default representation (if representation is included in
-     * POST payload it can be used as initial values) as long as the instance is
-     * lesser than max new instance count. Once max instance count is reached, POST on
-     * /a/led updated the representation of /a/led (just like PUT)
-     */
-
-    if (request->resource == LED.handle)
-    {
-        if (gCurrLedInstance < SAMPLE_MAX_NUM_POST_INSTANCE)
-        {
-            // Create new LED instance
-            char uri[15] = "/a/led/";
-            size_t length = strlen(uri);
-            snprintf (uri + length, sizeof(uri) - length, "%d", gCurrLedInstance);
-
-            answer = OCRepPayloadCreate();
-            if (!answer)
-            {
-                OIC_LOG(ERROR, TAG, "Failed to allocate Payload");
-                return OC_EH_ERROR;
-            }
-
-            OCRepPayloadSetUri(answer, gResourceUri);
-            OCRepPayloadSetPropString(answer, "createduri", uri);
-
-            gLedInstance[gCurrLedInstance].power = 0;
-            gLedInstance[gCurrLedInstance].state = false;
-
-            if (OC_STACK_OK == createLEDResource(uri, &gLedInstance[gCurrLedInstance]))
-            {
-                OIC_LOG (INFO, TAG, "Created new LED instance");
-                gLedInstance[gCurrLedInstance].state = false;
-                gLedInstance[gCurrLedInstance].power = 0;
-                gCurrLedInstance++;
-                strncpy(resourceUri, uri, MAX_URI_LENGTH);
-                result = OC_EH_OK;
-            }
-        }
-        else
-        {
-            result = ProcessRequest(request, &answer);
-        }
-    }
-    else
-    {
-        for (int i = 0; i < SAMPLE_MAX_NUM_POST_INSTANCE; i++)
-        {
-            if (request->resource == gLedInstance[i].handle)
-            {
-                result = ProcessRequest(request, &answer);
-                break;
-            }
-        }
-    }
-
-    if (OC_EH_OK == result)
-    {
-        *payload = answer;
-    }
-
-    return result;
-}
-
-static OCEntityHandlerResult
-OCLedHandler (OCEntityHandlerFlag flag,
-        OCEntityHandlerRequest *request,
-        void *params)
-{
-    OC_UNUSED(params);
-    OIC_LOG_V (INFO, TAG, "%s IN - flags: 0x%x", __func__, flag);
-
-    OCEntityHandlerResult result = OC_EH_ERROR;
-    char resourceUri[MAX_URI_LENGTH] = "";
-
-    if (!request)
-    {
-        OIC_LOG (ERROR, TAG, "Invalid request pointer");
-        return result;
-    }
-
-    OCRepPayload* payload = NULL;
-
-    if (flag & OC_REQUEST_FLAG)
-    {
-        OIC_LOG_V(INFO, TAG, "Received %d request method from client", request->method);
-
-        switch (request->method)
-        {
-            case OC_REST_GET:
-                result = ProcessRequest(request, &payload);
-                break;
-            case OC_REST_PUT:
-                result = ProcessRequest(request, &payload);
-                break;
-            case OC_REST_POST:
-                result = ProcessPostRequest(request, resourceUri, &payload);
-                break;
-            default:
-                OIC_LOG_V (ERROR, TAG, "Method %d doesn't supported!", request->method);
-                break;
-        }
-
-        if (result == OC_EH_OK)
-        {
-            // Format the response.  Note this requires some info about the request
-            OCEntityHandlerResponse response;
-            memset(&response, 0, sizeof(OCEntityHandlerResponse));
-
-            response.requestHandle = request->requestHandle;
-            response.ehResult = result;
-            response.payload = (OCPayload*)payload;
-            response.numSendVendorSpecificHeaderOptions = 0;
-            // Indicate that response is NOT in a persistent buffer
-            response.persistentBufferFlag = 0;
-            if (resourceUri[0])
-            {
-                memcpy(response.resourceUri, resourceUri, sizeof(resourceUri));
-            }
-
-            // Send the response
-            if (OCDoResponse(&response) != OC_STACK_OK)
-            {
-                OIC_LOG(ERROR, TAG, "Error sending response");
-                result = OC_EH_ERROR;
-            }
-        }
-    }
-    OCRepPayloadDestroy(payload);
-    return result;
-}
-
-OCStackResult createLEDResource (char *uri, LEDResource *resource)
-{
-    if (!uri || !resource)
-    {
-        OIC_LOG(ERROR, TAG, "Resource URI and LED cannot be NULL");
-        return OC_STACK_INVALID_PARAM;
-    }
-
-    return OCCreateResource(&resource->handle,
-            "core.led",
-            OC_RSRVD_INTERFACE_DEFAULT,
-            uri,
-            OCLedHandler,
-            NULL,
-            OC_DISCOVERABLE | OC_OBSERVABLE | OC_SECURE);
-}
diff --git a/resource/csdk/security/provisioning/sample/cloud/cloudResource.h b/resource/csdk/security/provisioning/sample/cloud/cloudResource.h
deleted file mode 100644 (file)
index 025d80c..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/* *****************************************************************
- *
- * Copyright 2016 Samsung Electronics All Rights Reserved.
- *
- *
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * *****************************************************************/
-#ifndef CLOUD_RESOURCE_H
-#define CLOUD_RESOURCE_H
-
-typedef struct LEDRESOURCE{
-    OCResourceHandle handle;
-    bool state;
-    int64_t power;
-} LEDResource;
-
-/**
- * Creates resource with all required request handlers
- *
- * @param[in] uri          resource URI
- * @param[in] resource     resource
-  * @return  OCStackResult application result
- */
-OCStackResult createLEDResource (char *uri, LEDResource *resource);
-
-#endif // CLOUD_RESOURCE_H
diff --git a/resource/csdk/security/provisioning/sample/cloud/cloudWrapper.c b/resource/csdk/security/provisioning/sample/cloud/cloudWrapper.c
deleted file mode 100644 (file)
index 96a01ae..0000000
+++ /dev/null
@@ -1,781 +0,0 @@
-/* *****************************************************************
- *
- * Copyright 2016 Samsung Electronics All Rights Reserved.
- *
- *
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * *****************************************************************/
-#include "experimental/logger.h"
-#include "occloudprovisioning.h"
-#include "oic_malloc.h"
-#include "oic_string.h"
-#include "srmutility.h"
-#include "aclresource.h"
-#include "utlist.h"
-
-#include "utils.h"
-
-#define TAG "CLOUD-WRAPPER"
-
-#define MAX_ID_LENGTH       (64)
-#define MAX_STRING_LENGTH   (256)
-
-#define UUID_EXAMPLE_1 "9cfbeb8e-5a1e-4d1c-9d01-2ae6fdb"
-#define UUID_EXAMPLE_2 "123e4567-e89b-12d3-a456-4266554"
-#define UUID_EXAMPLE_3 "987e6543-e21b-12d3-a456-4266554"
-#define SUBJECT_ID_EXAMPLE "72616E64-5069-6E44-6576-557569643030"
-
-#define ACL_ID_EXAMPLE "0f3d9f7fe5491d54077d"
-#define ACE_ID_EXAMPLE "a0001"
-
-#define ID_EXAMPLE_1   "78f98b4f25f21e2487e8"
-#define ID_EXAMPLE_2   "6caa7009386290fd3681"
-
-#define RESOURCE_URI_EXAMPLE "/a/light/0"
-#define RESOURCE_TYPE_EXAMPLE "core.light"
-#define INTERFACE_EXAMPLE "oic.if.baseline"
-
-//in case of optional parameters absence should be sent NULL
-#define OPTIONAL_PARAM(str) (str[0] ? str : NULL)
-
-/**
- * Skip special characters from stdin
- * */
-static void skipSpecialCharacters(void)
-{
-    for( ; 0x20<=getchar(); );  // for removing overflow garbages
-                                // '0x20<=code' is character region
-}
-
-static bool readOptional(const char* description)
-{
-    if (NULL == description)
-    {
-        return false;
-    }
-
-    printf("Do you want to Enter %s (y/n):\n", description);
-    char choice = 0;
-
-    while(1)
-    {
-        if(scanf("%c", &choice))
-        {
-            skipSpecialCharacters();
-
-            switch (choice)
-            {
-                case 'y': return true;
-                case 'n': return false;
-                default: printf("Wrong value entered. Please press 'y' or 'n'\n");
-            }
-        }
-        else
-        {
-            printf("Failed to read input. Please press 'y' or 'n'\n");
-        }
-    }
-    return false;
-}
-
-void readString(char* item, int length, const char* description, const char* example)
-{
-    printf("Enter %s (f.e. %s):\n", description, example);
-    char template[8] = { 0 };
-    snprintf(template, sizeof(template), "%%%ds", length - 1);
-    if (scanf(template, item))
-    {
-        skipSpecialCharacters();
-    }
-}
-
-/**
- * Read user input (expect string value, but it is optional and can be skipped by user)
- *
- * @param[out] item           string item to fill
- * @param[in] length          max allowed string length
- * @param[in] description     item description
- * @param[in] example         item example
- */
-static void readOptionalString(char* item, int length, const char* description, const char* example)
-{
-    if (readOptional(description))
-    {
-        readString(item, length, description, example);
-    }
-}
-
-void readInteger(int* item, const char* description, const char* example)
-{
-    printf("Enter %s (f.e. %s):\n", description, example);
-    if(scanf("%d", item))
-    {
-        skipSpecialCharacters();
-    }
-}
-
-void readUInt16(uint16_t* item, const char* description, const char* example)
-{
-    printf("Enter %s (f.e. %s):\n", description, example);
-    if (scanf("%hu", item))
-    {
-        skipSpecialCharacters();
-    }
-}
-
-/**
- * Read user input (expect array of strings)
- *
- * @param[out] list           array of strings structure
- * @param[in] length          max allowed array item length
- * @param[in] description     whole array description
- * @param[in] example         array item example
- */
-static void readStringArray(stringArray_t *list, int length, const char* description, const char* example)
-{
-    int i = 0;
-    int count = 0;
-    char hint[MAX_STRING_LENGTH] = { 0 };
-
-    snprintf(hint, sizeof(hint), "%s items count", description);
-    readInteger(&count, hint, "2");
-
-    char **item = NULL;
-
-    if (0 == count)
-    {
-        return;
-    }
-
-    item = OICCalloc(count, sizeof(char*));
-
-    if (NULL == item)
-    {
-        goto no_memory;
-    }
-
-    for (i = 0; i < count; i++)
-    {
-        item[i] = OICCalloc(length, sizeof(char));
-
-        if (NULL == item[i])
-        {
-            goto no_memory;
-        }
-
-        snprintf(hint, sizeof(hint), "%s %d item", description, i + 1);
-        readString(item[i], length, hint, example);
-    }
-    list->array  = item;
-    list->length = count;
-    return;
-
-no_memory:
-    //free already allocated memory here
-    for (int k = 0; k < i; k++)
-    {
-        OICFree(item[k]);
-    }
-    OICFree(item);
-}
-
-/**
- * Read user input (expect array of strings)
- * It is optional and can be skipped by user.
- *
- * @param[out] list           array of strings structure
- * @param[in] length          max allowed array item length
- * @param[in] description     whole array description
- * @param[in] example         array item example
- */
-static void readOptionalStringArray(stringArray_t *list, int length, const char* description, const char* example)
-{
-    if (readOptional(description))
-    {
-        readStringArray(list, length, description, example);
-    }
-}
-
-void printStringArray(stringArray_t *list)
-{
-    if (NULL == list)
-    {
-        OIC_LOG(INFO, TAG, "Received NULL list");
-        return;
-    }
-
-    OIC_LOG_V(INFO, TAG, "List contains %" PRIuPTR " items", list->length);
-
-    for (size_t i = 0; i < list->length; i++)
-    {
-        OIC_LOG_V(INFO, TAG, "item[%" PRIuPTR "] = %s", i, list->array[i]);
-    }
-}
-
-void printInviteResponse(inviteResponse_t *in)
-{
-    if (NULL == in)
-    {
-        OIC_LOG(INFO, TAG, "Received NULL invitation response");
-        return;
-    }
-
-    OIC_LOG(INFO, TAG, "Received next invite gid list:");
-    printStringArray(&in->invite.gidlist);
-
-    OIC_LOG(INFO, TAG, "Received next invite mid list:");
-    printStringArray(&in->invite.midlist);
-
-    OIC_LOG(INFO, TAG, "Received next invited gid list:");
-    printStringArray(&in->invited.gidlist);
-
-    OIC_LOG(INFO, TAG, "Received next invited mid list:");
-    printStringArray(&in->invited.midlist);
-}
-
-void clearInviteResponse(inviteResponse_t *in)
-{
-    if (NULL == in)
-    {
-        return;
-    }
-
-    clearStringArray(&in->invite.gidlist);
-    clearStringArray(&in->invite.midlist);
-
-    clearStringArray(&in->invited.gidlist);
-    clearStringArray(&in->invited.midlist);
-}
-
-bool readFile(const char *name, OCByteString *out)
-{
-    FILE *file = NULL;
-    int length = 0;
-    uint8_t *buffer = NULL;
-    bool result = false;
-
-    //Open file
-    file = fopen(name, "rb");
-    if (!file)
-    {
-        OIC_LOG_V(ERROR, TAG, "Unable to open file %s", name);
-        return result;
-    }
-
-    //Get file length
-    if (fseek(file, 0, SEEK_END))
-    {
-        OIC_LOG(ERROR, TAG, "Failed to SEEK_END");
-        goto exit;
-    }
-
-    length = ftell(file);
-    if (length < 0)
-    {
-        OIC_LOG(ERROR, TAG, "Failed to ftell");
-        goto exit;
-    }
-
-    if (fseek(file, 0, SEEK_SET))
-    {
-        OIC_LOG(ERROR, TAG, "Failed to SEEK_SET");
-        goto exit;
-    }
-
-    //Allocate memory
-    buffer = (uint8_t *)malloc(length);
-    if (!buffer)
-    {
-        OIC_LOG(ERROR, TAG, "Failed to allocate buffer");
-        goto exit;
-    }
-
-    //Read file contents into buffer
-    size_t count = 1;
-    size_t realCount = fread(buffer, length, count, file);
-    if (realCount != count)
-    {
-        OIC_LOG_V(ERROR, TAG, "Read %d bytes %" PRIuPTR " times instead of %" PRIuPTR, length, realCount, count);
-        goto exit;
-    }
-
-    out->bytes = buffer;
-    out->len   = length;
-
-    result = true;
-exit:
-    fclose(file);
-    if (buffer) 
-    {
-        free(buffer);
-    }
-    return result;
-}
-
-/**
- * Frees particular cloudAce object
- *
- * @param[in] ace   ace object to free
- * */
-static void freeCloudAce(cloudAce_t *ace)
-{
-    OICFree(ace->aceId);
-
-    //Clean Resources
-    OicSecRsrc_t* rsrc = NULL;
-    OicSecRsrc_t* tmpRsrc = NULL;
-    LL_FOREACH_SAFE(ace->resources, rsrc, tmpRsrc)
-    {
-        LL_DELETE(ace->resources, rsrc);
-        FreeRsrc(rsrc);
-    }
-
-    OICFree(ace);
-}
-
-/**
- * Deletes cloudAce list
- *
- * @param[in] ace   aces list to delete
- * */
-static void deleteCloudAceList(cloudAce_t *aces)
-{
-    cloudAce_t *ace = NULL;
-    cloudAce_t *tmpAce = NULL;
-    LL_FOREACH_SAFE(aces, ace, tmpAce)
-    {
-        LL_DELETE(aces, ace);
-        freeCloudAce(ace);
-    }
-}
-
-OCStackResult OCWrapperCertificateIssueRequest(const char *cloudUri, OCCloudResponseCB callback)
-{
-    return OCCloudCertificateIssueRequest(NULL, cloudUri, callback);
-}
-
-OCStackResult OCWrapperGetCRL(const char *cloudUri, OCCloudResponseCB callback)
-{
-    return OCCloudGetCRL(NULL, cloudUri, callback);
-}
-
-OCStackResult OCWrapperPostCRL(const char *cloudUri, OCCloudResponseCB callback)
-{
-    OCStackResult result = OC_STACK_ERROR;
-    OCByteString crlData = {0, 0};
-    char filename[64] = {0};
-    char thisUpdate[16] = { 0 };
-    char nextUpdate[16] = { 0 };
-    stringArray_t serialNumbers = {0, 0};
-
-    readString(thisUpdate, sizeof(thisUpdate), "Crl's thisUpdate value", "20160727000000");
-    readString(nextUpdate, sizeof(nextUpdate), "Crl's nextUpdate value", "20161027000000");
-    readOptionalStringArray(&serialNumbers, 16, "Revoked serial numbers", "1234");
-
-    if (NULL == serialNumbers.array)
-    {
-        readString(filename, sizeof(filename),
-                   "filename from which binary Crl in DER format will be read", "crl");
-
-        if (!readFile(filename, &crlData))
-        {
-            printf("Can't read crl from file %s\n", filename);
-            goto exit;
-        }
-    }
-    stringArray_t *rcsn = serialNumbers.array? &serialNumbers : NULL;
-    OCByteString *crl = crlData.bytes? &crlData : NULL;
-
-    result = OCCloudPostCRL(NULL, thisUpdate, nextUpdate, crl, rcsn,
-                            cloudUri, callback);
-exit:
-    clearStringArray(&serialNumbers);
-    OICFree(crlData.bytes);
-
-    return result;
-}
-
-OCStackResult OCWrapperAclIdGetByDevice(const char *cloudUri, OCCloudResponseCB callback)
-{
-    char di[MAX_ID_LENGTH] = { 0 };
-
-    readString(di, sizeof(di), "device id", UUID_EXAMPLE_1);
-
-    return OCCloudGetAclIdByDevice(NULL, di, cloudUri, callback);
-}
-
-OCStackResult OCWrapperAclIdCreate(const char *cloudUri, OCCloudResponseCB callback)
-{
-    char oid[MAX_ID_LENGTH]  = { 0 };
-    char di[MAX_ID_LENGTH]   = { 0 };
-
-    readString(oid, sizeof(oid), "owner id", UUID_EXAMPLE_2);
-    readString(di, sizeof(di), "device id", UUID_EXAMPLE_1);
-
-    return OCCloudAclIdCreate(NULL, oid, di, cloudUri, callback);
-}
-
-OCStackResult OCWrapperAclIdDelete(const char *cloudUri, OCCloudResponseCB callback)
-{
-    char aclid[MAX_ID_LENGTH] = { 0 };
-
-    readString(aclid, sizeof(aclid), "acl id", ACL_ID_EXAMPLE);
-
-    return OCCloudAclIdDelete(NULL, aclid, cloudUri, callback);
-}
-
-OCStackResult OCWrapperAclIndividualGetInfo(const char *cloudUri, OCCloudResponseCB callback)
-{
-    char aclid[MAX_ID_LENGTH] = { 0 };
-
-    readString(aclid, sizeof(aclid), "acl id", ACL_ID_EXAMPLE);
-
-    return OCCloudAclIndividualGetInfo(NULL, aclid, cloudUri, callback);
-}
-
-OCStackResult OCWrapperAclIndividualUpdateAce(const char *cloudUri, OCCloudResponseCB callback)
-{
-    OCStackResult result = OC_STACK_NO_MEMORY;
-
-    char aclid[MAX_ID_LENGTH] = { 0 };
-    readString(aclid, sizeof(aclid), "acl id", ACL_ID_EXAMPLE);
-
-    int acllist_count = 0;
-    readInteger(&acllist_count, "acl list count", "1");
-
-    cloudAce_t *aces = NULL;
-
-    for (int i = 0; i < acllist_count; i++)
-    {
-        cloudAce_t *ace = OICCalloc(1, sizeof(cloudAce_t));
-        if (!ace)
-        {
-            OIC_LOG(ERROR, TAG, "Can't allocate memory for ace");
-            goto exit;
-        }
-        LL_APPEND(aces, ace);
-
-        char aceid[MAX_ID_LENGTH] = { 0 };
-        char subjectuuid[MAX_ID_LENGTH] = { 0 };
-        uint16_t stype = 0;
-        uint16_t permission = 0;
-
-        do
-        {
-            readString(subjectuuid, sizeof(subjectuuid), "subjectuuid", SUBJECT_ID_EXAMPLE);
-        } while (OC_STACK_OK != ConvertStrToUuid(subjectuuid, &ace->subjectuuid));
-
-        readUInt16(&stype, "subject type", "0 – Device, 1 – User, 2 - Group");
-        readUInt16(&permission, "permission", "6");
-
-        ace->aceId = OICStrdup(aceid);
-        ace->stype = stype;
-        ace->permission = permission;
-
-        int reslist_count = 0;
-        readInteger(&reslist_count, "resources list count", "1");
-
-        for (int j = 0; j < reslist_count; j++)
-        {
-            OicSecRsrc_t *res = OICCalloc(1, sizeof(OicSecRsrc_t));
-            if (!res)
-            {
-                OIC_LOG(ERROR, TAG, "Can't allocate memory for res");
-                goto exit;
-            }
-            LL_APPEND(ace->resources, res);
-
-            char href[32] = { 0 };
-            readString(href, sizeof(href), "href", RESOURCE_URI_EXAMPLE);
-
-            stringArray_t rt = {0, 0};
-            readStringArray(&rt, MAX_ID_LENGTH, "resource type", RESOURCE_TYPE_EXAMPLE);
-
-            stringArray_t _if = {0, 0};
-            readStringArray(&_if, MAX_ID_LENGTH, "interface", INTERFACE_EXAMPLE);
-
-            res->href = OICStrdup(href);
-            res->types = rt.array;
-            res->typeLen = rt.length;
-            res->interfaces = _if.array;
-            res->interfaceLen = _if.length;
-        }
-    }
-
-    result = OCCloudAclIndividualAclUpdate(NULL, aclid, aces, cloudUri, callback);
-exit:
-    deleteCloudAceList(aces);
-    return result;
-}
-
-OCStackResult OCWrapperAclIndividualUpdate(const char *cloudUri, OCCloudResponseCB callback)
-{
-    OCStackResult result = OC_STACK_NO_MEMORY;
-
-    char aclid[MAX_ID_LENGTH] = { 0 };
-    readString(aclid, sizeof(aclid), "acl id", ACL_ID_EXAMPLE);
-
-    cloudAce_t *ace = OICCalloc(1, sizeof(cloudAce_t));
-    if (!ace)
-    {
-        OIC_LOG(ERROR, TAG, "Can't allocate memory for ace");
-        goto exit;
-    }
-
-    char aceid[MAX_ID_LENGTH] = { 0 };
-    char subjectuuid[MAX_ID_LENGTH] = { 0 };
-    uint16_t stype = 0;
-    uint16_t permission = 0;
-
-    readString(aceid, sizeof(aceid), "ace id", ACE_ID_EXAMPLE);
-    do
-    {
-        readString(subjectuuid, sizeof(subjectuuid), "subjectuuid", SUBJECT_ID_EXAMPLE);
-    } while (OC_STACK_OK != ConvertStrToUuid(subjectuuid, &ace->subjectuuid));
-
-    readUInt16(&stype, "subject type", "0 – Device, 1 – User, 2 - Group");
-    readUInt16(&permission, "permission", "6");
-
-    ace->stype = stype;
-    ace->permission = permission;
-
-    int reslist_count = 0;
-    readInteger(&reslist_count, "resources list count", "1");
-
-    for (int i = 0; i < reslist_count; i++)
-    {
-        OicSecRsrc_t *res = OICCalloc(1, sizeof(OicSecRsrc_t));
-        if (!res)
-        {
-            OIC_LOG(ERROR, TAG, "Can't allocate memory for res");
-            goto exit;
-        }
-        LL_APPEND(ace->resources, res);
-
-        char href[32] = { 0 };
-        readString(href, sizeof(href), "href", RESOURCE_URI_EXAMPLE);
-
-        stringArray_t rt = {0, 0};
-        readStringArray(&rt, MAX_ID_LENGTH, "resource type", RESOURCE_TYPE_EXAMPLE);
-
-        stringArray_t _if = {0, 0};
-        readStringArray(&_if, MAX_ID_LENGTH, "interface", INTERFACE_EXAMPLE);
-
-        res->href = OICStrdup(href);
-        res->types = rt.array;
-        res->typeLen = rt.length;
-        res->interfaces = _if.array;
-        res->interfaceLen = _if.length;
-    }
-
-
-    result = OCCloudAclIndividualAceUpdate(NULL, aclid,aceid, ace, cloudUri, callback);
-exit:
-    return result;
-}
-
-OCStackResult OCWrapperAclIndividualDelete(const char *cloudUri, OCCloudResponseCB callback)
-{
-    char aclid[MAX_ID_LENGTH] = { 0 };
-
-    readString(aclid, sizeof(aclid), "acl id", ACL_ID_EXAMPLE);
-
-    return OCCloudAclAcesDelete(NULL, aclid, cloudUri, callback);
-}
-
-OCStackResult OCWrapperAclIndividualDeleteAce(const char *cloudUri, OCCloudResponseCB callback)
-{
-    char aclid[MAX_ID_LENGTH] = { 0 };
-    char aceid[MAX_ID_LENGTH] = { 0 };
-
-    readString(aclid, sizeof(aclid), "acl id", ACL_ID_EXAMPLE);
-    readString(aceid, sizeof(aceid), "ace id", ACE_ID_EXAMPLE);
-
-    return OCCloudAclIndividualAceDelete(NULL, aclid, aceid, cloudUri, callback);
-}
-
-OCStackResult OCWrapperAclCreateGroup(const char *cloudUri, OCCloudResponseCB callback)
-{
-    char gtype[16] = { 0 };
-    char gmid[MAX_ID_LENGTH] = { 0 };
-
-    readString(gtype, sizeof(gtype), "Group type value", "Public");
-    readOptionalString(gmid, sizeof(gmid), "group member id value", UUID_EXAMPLE_2);
-
-    return OCCloudAclCreateGroup(NULL, gtype, OPTIONAL_PARAM(gmid), cloudUri, callback);
-}
-
-OCStackResult OCWrapperAclFindMyGroup(const char *cloudUri, OCCloudResponseCB callback)
-{
-    char mid[MAX_ID_LENGTH]  = { 0 };
-
-    readOptionalString(mid, sizeof(mid), "member id value", UUID_EXAMPLE_2);
-
-    return OCCloudAclFindMyGroup(NULL, OPTIONAL_PARAM(mid), cloudUri, callback);
-}
-
-OCStackResult OCWrapperAclDeleteGroup(const char *cloudUri, OCCloudResponseCB callback)
-{
-    char gid[MAX_ID_LENGTH]  = { 0 };
-    char gmid[MAX_ID_LENGTH] = { 0 };
-
-    readString(gid, sizeof(gid), "Group id value", ID_EXAMPLE_1);
-
-    readOptionalString(gmid, sizeof(gmid), "group member id value", UUID_EXAMPLE_2);
-
-    return OCCloudAclDeleteGroup(NULL, gid, OPTIONAL_PARAM(gmid), cloudUri, callback);
-}
-
-OCStackResult OCWrapperAclJoinToInvitedGroup(const char *cloudUri, OCCloudResponseCB callback)
-{
-    char gid[MAX_ID_LENGTH]  = { 0 };
-
-    readString(gid, sizeof(gid), "Group id value", ID_EXAMPLE_1);
-
-    return OCCloudAclJoinToInvitedGroup(NULL, gid, cloudUri, callback);
-}
-
-OCStackResult OCWrapperAclObserveGroup(const char *cloudUri, OCCloudResponseCB callback)
-{
-    char gid[MAX_ID_LENGTH]  = { 0 };
-
-    readString(gid, sizeof(gid), "Group id value", ID_EXAMPLE_1);
-
-    return OCCloudAclObserveGroup(NULL, gid, cloudUri, callback);
-}
-
-OCStackResult OCWrapperAclShareDeviceIntoGroup(const char *cloudUri, OCCloudResponseCB callback)
-{
-    OCStackResult result = OC_STACK_NO_MEMORY;
-    char gid[MAX_ID_LENGTH]  = { 0 };
-    stringArray_t midlist = {0,0};
-    stringArray_t dilist = {0,0};
-
-    readString(gid, sizeof(gid), "Group id value", ID_EXAMPLE_1);
-
-    readStringArray(&midlist, MAX_ID_LENGTH, "member id list", UUID_EXAMPLE_2);
-
-    readStringArray(&dilist, MAX_ID_LENGTH, "device list", UUID_EXAMPLE_1);
-
-    result = OCCloudAclShareDeviceIntoGroup(NULL, gid, &midlist, &dilist, cloudUri, callback);
-
-    clearStringArray(&midlist);
-    clearStringArray(&dilist);
-
-    return result;
-}
-
-OCStackResult OCWrapperAclDeleteDeviceFromGroup(const char *cloudUri, OCCloudResponseCB callback)
-{
-    OCStackResult result = OC_STACK_NO_MEMORY;
-    char gid[MAX_ID_LENGTH]  = { 0 };
-    stringArray_t midlist = {0,0};
-    stringArray_t dilist = {0,0};
-
-    readString(gid, sizeof(gid), "Group id value", ID_EXAMPLE_1);
-
-    readStringArray(&midlist, MAX_ID_LENGTH, "member id list", UUID_EXAMPLE_2);
-
-    readStringArray(&dilist, MAX_ID_LENGTH, "device list", UUID_EXAMPLE_1);
-
-    result = OCCloudAclDeleteDeviceFromGroup(NULL, gid, &midlist, &dilist, cloudUri, callback);
-
-    clearStringArray(&midlist);
-    clearStringArray(&dilist);
-
-    return result;
-}
-
-OCStackResult OCWrapperAclGroupGetInfo(const char *cloudUri, OCCloudResponseCB callback)
-{
-    char gid[MAX_ID_LENGTH]  = { 0 };
-    char mid[MAX_ID_LENGTH]  = { 0 };
-
-    readString(gid, sizeof(gid), "Group id value", ID_EXAMPLE_1);
-
-    readOptionalString(mid, sizeof(mid), "member id value", UUID_EXAMPLE_2);
-
-    return OCCloudAclGroupGetInfo(NULL, gid, OPTIONAL_PARAM(mid), cloudUri, callback);
-}
-
-OCStackResult OCWrapperAclInviteUser(const char *cloudUri, OCCloudResponseCB callback)
-{
-    OCStackResult result = OC_STACK_NO_MEMORY;
-    char uid[MAX_ID_LENGTH]  = { 0 };
-    stringArray_t midlist = {0,0};
-    stringArray_t gidlist = {0,0};
-
-    readOptionalString(uid, sizeof(uid), "user id value", UUID_EXAMPLE_2);
-
-    readStringArray(&gidlist, MAX_ID_LENGTH, "group id list", UUID_EXAMPLE_1);
-
-    readStringArray(&midlist, MAX_ID_LENGTH, "member id list", UUID_EXAMPLE_2);
-
-    result = OCCloudAclInviteUser(NULL, OPTIONAL_PARAM(uid), &gidlist, &midlist, cloudUri, callback);
-
-    clearStringArray(&midlist);
-    clearStringArray(&gidlist);
-
-    return result;
-}
-
-OCStackResult OCWrapperAclGetInvitation(const char *cloudUri, OCCloudResponseCB callback)
-{
-    char uid[MAX_ID_LENGTH]  = { 0 };
-
-    readOptionalString(uid, sizeof(uid), "user uuid value", UUID_EXAMPLE_2);
-
-    return OCCloudAclGetInvitation(NULL, OPTIONAL_PARAM(uid), cloudUri, callback);
-}
-
-OCStackResult OCWrapperAclDeleteInvitation(const char *cloudUri, OCCloudResponseCB callback)
-{
-    char uid[MAX_ID_LENGTH]  = { 0 };
-    char gid[MAX_ID_LENGTH]  = { 0 };
-
-    readOptionalString(uid, sizeof(uid), "user uuid value", UUID_EXAMPLE_2);
-    readString(gid, sizeof(gid), "Group id value", ID_EXAMPLE_1);
-
-    return OCCloudAclDeleteInvitation(NULL, OPTIONAL_PARAM(uid), gid, cloudUri, callback);
-}
-
-OCStackResult OCWrapperAclCancelInvitation(const char *cloudUri, OCCloudResponseCB callback)
-{
-    char uid[MAX_ID_LENGTH]  = { 0 };
-    char gid[MAX_ID_LENGTH]  = { 0 };
-    char mid[MAX_ID_LENGTH]  = { 0 };
-
-    readOptionalString(uid, sizeof(uid), "user uuid value", UUID_EXAMPLE_2);
-
-    readString(gid, sizeof(gid), "Group id value", ID_EXAMPLE_1);
-    readString(mid, sizeof(mid), "member id value", ID_EXAMPLE_1);
-
-    return OCCloudAclCancelInvitation(NULL, OPTIONAL_PARAM(uid), gid, mid, cloudUri, callback);
-}
-
-OCStackResult OCWrapperAclPolicyCheck(const char *cloudUri, OCCloudResponseCB callback)
-{
-    char sid[MAX_ID_LENGTH] = { 0 };
-    char di[MAX_ID_LENGTH]  = { 0 };
-    char rm[16]  = { 0 };
-    char user_uri[32] = { 0 };
-
-    readString(sid, sizeof(sid), "subject id", UUID_EXAMPLE_1);
-    readString(di, sizeof(di), "device id", UUID_EXAMPLE_2);
-    readString(rm, sizeof(rm), "request method", "GET or POST or DELETE");
-    readString(user_uri, sizeof(user_uri), "request uri", RESOURCE_URI_EXAMPLE);
-
-    return OCCloudAclPolicyCheck(NULL, sid, di, rm, user_uri, cloudUri, callback);
-}
diff --git a/resource/csdk/security/provisioning/sample/cloud/cloudWrapper.h b/resource/csdk/security/provisioning/sample/cloud/cloudWrapper.h
deleted file mode 100644 (file)
index 5a63742..0000000
+++ /dev/null
@@ -1,299 +0,0 @@
-/* *****************************************************************
- *
- * Copyright 2016 Samsung Electronics All Rights Reserved.
- *
- *
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * *****************************************************************/
-#ifndef OC_CLOUD_WRAPPER_H
-#define OC_CLOUD_WRAPPER_H
-
-#include "occloudprovisioning.h"
-
-/**
- * Certificate-Issue request function
- *
- * @param[in] cloudUri          cloud host and port
- * @param[in] callback          result callback
- * @return  OCStackResult application result
- */
-OCStackResult OCWrapperCertificateIssueRequest(const char *cloudUri, OCCloudResponseCB callback);
-
-/**
- * CRL GET request function
- *
- * @param[in] cloudUri          cloud host and port
- * @param[in] callback          result callback
- * @return  OCStackResult application result
- */
-OCStackResult OCWrapperGetCRL(const char *cloudUri, OCCloudResponseCB callback);
-
-/**
- * CRL POST request function (with Serial Numbers list to revoke)
- *
- * @param[in] cloudUri          cloud host and port
- * @param[in] callback          result callback
- * @return  OCStackResult application result
- */
-OCStackResult OCWrapperPostCRL(const char *cloudUri, OCCloudResponseCB callback);
-
-/**
- * ACL id retrieve by device id
- *
- * @param[in] cloudUri          cloud host and port
- * @param[in] callback          result callback
- * @return  OCStackResult application result
- */
-OCStackResult OCWrapperAclIdGetByDevice(const char *cloudUri, OCCloudResponseCB callback);
-
-/**
- * ACL id create
- *
- * @param[in] cloudUri          cloud host and port
- * @param[in] callback          result callback
- * @return  OCStackResult application result
- */
-OCStackResult OCWrapperAclIdCreate(const char *cloudUri, OCCloudResponseCB callback);
-
-/**
- * ACL id delete
- *
- * @param[in] cloudUri          cloud host and port
- * @param[in] callback          result callback
- * @return  OCStackResult application result
- */
-OCStackResult OCWrapperAclIdDelete(const char *cloudUri, OCCloudResponseCB callback);
-
-/**
- * ACL individual get info
- *
- * @param[in] cloudUri          cloud host and port
- * @param[in] callback          result callback
- * @return  OCStackResult application result
- */
-OCStackResult OCWrapperAclIndividualGetInfo(const char *cloudUri, OCCloudResponseCB callback);
-
-/**
- * ACL individual update ACE
- *
- * @param[in] cloudUri          cloud host and port
- * @param[in] callback          result callback
- * @return  OCStackResult application result
- */
-OCStackResult OCWrapperAclIndividualUpdateAce(const char *cloudUri, OCCloudResponseCB callback);
-
-/**
- * ACL individual update. Replaces an existing ACE with a new one
- *
- * @param[in] cloudUri          cloud host and port
- * @param[in] callback          result callback
- * @return  OCStackResult application result
- */
-OCStackResult OCWrapperAclIndividualUpdate(const char *cloudUri, OCCloudResponseCB callback);
-
-/**
- * ACL individual delete
- *
- * @param[in] cloudUri          cloud host and port
- * @param[in] callback          result callback
- * @return  OCStackResult application result
- */
-OCStackResult OCWrapperAclIndividualDelete(const char *cloudUri, OCCloudResponseCB callback);
-
-/**
- * ACL individual delete ACE
- *
- * @param[in] cloudUri          cloud host and port
- * @param[in] callback          result callback
- * @return  OCStackResult application result
- */
-OCStackResult OCWrapperAclIndividualDeleteAce(const char *cloudUri, OCCloudResponseCB callback);
-
-/**
- * ACL post group request function
- *
- * @param[in] cloudUri          cloud host and port
- * @param[in] callback          result callback
- * @return  OCStackResult application result
- */
-OCStackResult OCWrapperAclCreateGroup(const char *cloudUri, OCCloudResponseCB callback);
-
-/**
- * ACL get group request function
- *
- * @param[in] cloudUri          cloud host and port
- * @param[in] callback          result callback
- * @return  OCStackResult application result
- */
-OCStackResult OCWrapperAclFindMyGroup(const char *cloudUri, OCCloudResponseCB callback);
-
-/**
- * ACL delete group request function
- *
- * @param[in] cloudUri          cloud host and port
- * @param[in] callback          result callback
- * @return  OCStackResult application result
- */
-OCStackResult OCWrapperAclDeleteGroup(const char *cloudUri, OCCloudResponseCB callback);
-
-/**
- * ACL join to invited group request function
- *
- * @param[in] cloudUri          cloud host and port
- * @param[in] callback          result callback
- * @return  OCStackResult application result
- */
-OCStackResult OCWrapperAclJoinToInvitedGroup(const char *cloudUri, OCCloudResponseCB callback);
-
-/**
- * ACL observe group request function
- *
- * @param[in] cloudUri          cloud host and port
- * @param[in] callback          result callback
- * @return  OCStackResult application result
- */
-OCStackResult OCWrapperAclObserveGroup(const char *cloudUri, OCCloudResponseCB callback);
-
-/**
- * ACL share device into group request function
- *
- * @param[in] cloudUri          cloud host and port
- * @param[in] callback          result callback
- * @return  OCStackResult application result
- */
-OCStackResult OCWrapperAclShareDeviceIntoGroup(const char *cloudUri, OCCloudResponseCB callback);
-
-/**
- * ACL delete device from group request function
- *
- * @param[in] cloudUri          cloud host and port
- * @param[in] callback          result callback
- * @return  OCStackResult application result
- */
-OCStackResult OCWrapperAclDeleteDeviceFromGroup(const char *cloudUri, OCCloudResponseCB callback);
-
-/**
- * ACL get group info request function
- *
- * @param[in] cloudUri          cloud host and port
- * @param[in] callback          result callback
- * @return  OCStackResult application result
- */
-OCStackResult OCWrapperAclGroupGetInfo(const char *cloudUri, OCCloudResponseCB callback);
-
-/**
- * ACL invite user to group request function
- *
- * @param[in] cloudUri          cloud host and port
- * @param[in] callback          result callback
- * @return  OCStackResult application result
- */
-OCStackResult OCWrapperAclInviteUser(const char *cloudUri, OCCloudResponseCB callback);
-
-/**
- * ACL get invitation request function
- *
- * @param[in] cloudUri          cloud host and port
- * @param[in] callback          result callback
- * @return  OCStackResult application result
- */
-OCStackResult OCWrapperAclGetInvitation(const char *cloudUri, OCCloudResponseCB callback);
-
-/**
- * ACL delete invitation request function (by receiver)
- *
- * @param[in] cloudUri          cloud host and port
- * @param[in] callback          result callback
- * @return  OCStackResult application result
- */
-OCStackResult OCWrapperAclDeleteInvitation(const char *cloudUri, OCCloudResponseCB callback);
-
-/**
- * ACL cancel invitation request function (by sender)
- *
- * @param[in] cloudUri          cloud host and port
- * @param[in] callback          result callback
- * @return  OCStackResult application result
- */
-OCStackResult OCWrapperAclCancelInvitation(const char *cloudUri, OCCloudResponseCB callback);
-
-/**
- * ACL check that given request can be applied to resource
- *
- * @param[in] cloudUri          cloud host and port
- * @param[in] callback          result callback
- * @return  OCStackResult application result
- */
-OCStackResult OCWrapperAclPolicyCheck(const char *cloudUri, OCCloudResponseCB callback);
-
-/**
- * Read user input (expect string value)
- *
- * @param[out] item           string item to fill
- * @param[in] length          max allowed string length
- * @param[in] description     item description
- * @param[in] example         item example
- */
-void readString(char* item, int length, const char* description, const char* example);
-
-/**
- * Read user input (expect integer value)
- *
- * @param[out] item           integer item to fill
- * @param[in] description     item description
- * @param[in] example         item example
- */
-void readInteger(int* item, const char* description, const char* example);
-
-/**
- * Read user input (expect uint16_t value)
- *
- * @param[out] item           uint16_t item to fill
- * @param[in]  description    item description
- * @param[in]  example        item example
- */
-void readUInt16(uint16_t* item, const char* description, const char* example);
-
-/**
- * Copies whole binary file to out variable
- *
- * @param[in] list           array of strings structure
- * @param[out] out           byte array to fill
- * @return                   negative error code
- * */
-int readFile(const char *name, OCByteString *out);
-
-/**
- * Print array of strings
- *
- * @param[in] list           array of strings
- */
-void printStringArray(stringArray_t *list);
-
-/**
- * Print invitation response
- *
- * @param[in] in           invitation response
- */
-void printInviteResponse(inviteResponse_t *in);
-
-/**
- * Clear invitation response
- *
- * @param[in] in           invitation response
- */
-void clearInviteResponse(inviteResponse_t *in);
-
-#endif //OC_CLOUD_WRAPPER_H
diff --git a/resource/csdk/security/provisioning/sample/cloudClient.c b/resource/csdk/security/provisioning/sample/cloudClient.c
deleted file mode 100644 (file)
index a819d5b..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/* *****************************************************************
- *
- * Copyright 2016 Samsung Electronics All Rights Reserved.
- *
- *
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * *****************************************************************/
-#include "cloudCommon.h"
-#include "experimental/logger.h"
-
-#define TAG "cloudClient"
-
-int main(int argc, char *argv[])
-{
-    if (!parseCommandLineArguments(argc, argv))
-    {
-        return -1;
-    }
-
-    if (OC_STACK_OK != initPersistentStorage())
-    {
-        return -2;
-    }
-
-    if (OC_STACK_OK != initProcess(OC_CLIENT_SERVER))
-    {
-        OIC_LOG(ERROR, TAG, "initProcess error, exit\n");
-        return -3;
-    }
-
-    OCMode mode = OC_CLIENT;
-    if (OC_STACK_OK != startRequestsThread(&mode))
-    {
-        return -4;
-    }
-
-    startProcess();
-
-    freeThreadResources();
-
-    return 0;
-}
diff --git a/resource/csdk/security/provisioning/sample/cloudServer.c b/resource/csdk/security/provisioning/sample/cloudServer.c
deleted file mode 100644 (file)
index 8030777..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-/* *****************************************************************
- *
- * Copyright 2016 Samsung Electronics All Rights Reserved.
- *
- *
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * *****************************************************************/
-#include "cloudCommon.h"
-#include "experimental/logger.h"
-#include "cloudResource.h"
-
-#define TAG "cloudServer"
-
-extern LEDResource LED;
-extern char *gResourceUri;
-
-int main(int argc, char *argv[])
-{
-    if (!parseCommandLineArguments(argc, argv))
-    {
-        return -1;
-    }
-
-    if (OC_STACK_OK != initPersistentStorage())
-    {
-        return -2;
-    }
-
-    if (OC_STACK_OK != initProcess(OC_CLIENT_SERVER))
-    {
-        OIC_LOG(ERROR, TAG, "initProcess error, exit\n");
-        return -3;
-    }
-
-    LED.state = false;
-    LED.power = 0;
-    /*
-     * Declare and create the example resource: LED
-     */
-    if (OC_STACK_OK != createLEDResource(gResourceUri, &LED))
-    {
-        return -4;
-    }
-
-    OCMode mode = OC_SERVER;
-    if (OC_STACK_OK != startRequestsThread(&mode))
-    {
-        return -5;
-    }
-
-    startProcess();
-
-    freeThreadResources();
-
-    return 0;
-}