static const char* TEST_CERT_ROLE2 = "IoTivity-test-role2";
static const char* TEST_CERT_AUTHORITY = "IoTivity-test-OBT-authority-name";
-static OicUuid_t WILDCARD_SUBJECT_ID = { "*" };
-static size_t WILDCARD_SUBJECT_ID_LEN = 1;
-
// |g_ctx| means provision manager application context and
// the following, includes |un/own_list|, could be variables, which |g_ctx| has,
// for accessing all function(s) for these, they are declared on global domain
// function declaration(s) for calling them before implementing
static OCProvisionDev_t* getDevInst(const OCProvisionDev_t*, const int);
static int printDevList(const OCProvisionDev_t*);
-static size_t printUuidList(const OCUuidList_t*);
static size_t printResultList(const OCProvisionResult_t*, const size_t);
static void printUuid(const OicUuid_t*);
static int saveUuid(const OCProvisionResult_t* rslt_lst, const size_t rslt_cnt);
return 0;
}
-static int discoverUnownedDevices(void)
-{
- // delete unowned device list before updating it
- if(g_unown_list)
- {
- OCDeleteDiscoveredDevices(g_unown_list);
- g_unown_list = NULL;
- }
-
- // call |OCDiscoverUnownedDevices| API
- printf(" Discovering Only Unowned Devices on Network..\n");
- if(OC_STACK_OK != OCDiscoverUnownedDevices(DISCOVERY_TIMEOUT, &g_unown_list))
- {
- OIC_LOG(ERROR, TAG, "OCDiscoverUnownedDevices API error");
- return -1;
- }
-
- // display the discovered unowned list
- printf(" > Discovered Unowned Devices\n");
- g_unown_cnt = printDevList(g_unown_list);
-
- return 0;
-}
-
-static int discoverOwnedDevices(void)
-{
- // delete owned device list before updating it
- if(g_own_list)
- {
- OCDeleteDiscoveredDevices(g_own_list);
- g_own_list = NULL;
- }
-
- // call |OCDiscoverOwnedDevices| API
- printf(" Discovering Only Owned Devices on Network..\n");
- if(OC_STACK_OK != OCDiscoverOwnedDevices(DISCOVERY_TIMEOUT, &g_own_list))
- {
- OIC_LOG(ERROR, TAG, "OCDiscoverOwnedDevices API error");
- return -1;
- }
-
- // display the discovered owned list
- printf(" > Discovered Owned Devices\n");
- g_own_cnt = printDevList(g_own_list);
-
- return 0;
-}
-
static int registerDevices(void)
{
// check |unown_list| for registering devices
g_doneCB = false;
OicSecCredType_t type = SIGNED_ASYMMETRIC_KEY;
- rst = OCProvisionTrustCertChain((void*)g_ctx, type, caCredId, targetDevice, &provisionTrustChainCB);
+ rst = OCProvisionTrustCertChain((void*)g_ctx, type, caCredId, targetDevice, (OCProvisionResultCB)&provisionTrustChainCB);
if(OC_STACK_OK != rst)
{
OIC_LOG_V(ERROR, TAG, "OCProvisionTrustCertChain returned error: %d", rst);
if(rst != OC_STACK_OK)
{
OIC_LOG(ERROR, TAG, "Failed to validate CSR signature");
- OICFreeAndSetToNull(&g_csr);
+ OICFreeAndSetToNull((void**)&g_csr);
return -1;
}
if (*csr == NULL)
{
OIC_LOG(ERROR, TAG, "OICStrdup failed");
- OICFreeAndSetToNull(&g_csr);
+ OICFreeAndSetToNull((void**)&g_csr);
return -1;
}
}
- OICFreeAndSetToNull(&g_csr);
+ OICFreeAndSetToNull((void**)&g_csr);
printf(" > Get CSR SUCCEEDED\n");
OIC_LOG_V(ERROR, TAG, "%s Failed to provision role certificate", __func__);
goto exit;
}
- OICFreeAndSetToNull(&roleCert);
+ OICFreeAndSetToNull((void**)&roleCert);
/* The second will have the authority field set */
ret = createCertFromCSR(g_caKeyPem, g_caCertPem, csr, TEST_CERT_ROLE2, TEST_CERT_AUTHORITY, &roleCert);
return lst_cnt;
}
-static size_t printUuidList(const OCUuidList_t* uid_lst)
-{
- if (!uid_lst)
- {
- printf(" Device List is Empty..\n\n");
- return 0;
- }
-
- OCUuidList_t* lst = (OCUuidList_t*)uid_lst;
- size_t lst_cnt = 0;
- for (; lst; )
- {
- printf(" [%zu] ", ++lst_cnt);
- printUuid((const OicUuid_t*)&lst->dev);
- printf("\n");
- lst = lst->next;
- }
- printf("\n");
-
- return lst_cnt;
-}
-
static size_t printResultList(const OCProvisionResult_t* rslt_lst, const size_t rslt_cnt)
{
if (!rslt_lst || (0 == rslt_cnt))
OCDeleteDiscoveredDevices(g_own_list); // after here |g_own_list| points to nothing
OCDeleteDiscoveredDevices(g_unown_list); // after here |g_unown_list| points to nothing
- OICFreeAndSetToNull(&g_svr_fname);
- OICFreeAndSetToNull(&g_prvn_fname);
+ OICFreeAndSetToNull((void**)&g_svr_fname);
+ OICFreeAndSetToNull((void**)&g_prvn_fname);
}
static int initDiscoverRegisterAllDevices()
-/*
- * //******************************************************************
- * //
- * // 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.
- * //
- * //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- */
+//******************************************************************
+//
+// 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 "logger.h"
#include "ocpayload.h"
g_doneCB = false;
OicSecCredType_t type = SIGNED_ASYMMETRIC_KEY;
- OCStackResult rst = OCProvisionTrustCertChain((void*)g_ctx, type, g_caCredId, targetDevice, &provisionTrustChainCB);
+ OCStackResult rst = OCProvisionTrustCertChain((void*)g_ctx, type, g_caCredId, targetDevice, (OCProvisionResultCB)&provisionTrustChainCB);
if (OC_STACK_OK != rst)
{
OIC_LOG_V(ERROR, TAG, "OCProvisionTrustCertChain returned error: %d", rst);
if (OC_STACK_OK != rst)
{
OIC_LOG(ERROR, TAG, "Failed to validate CSR signature");
- OICFreeAndSetToNull(&g_csr);
+ OICFreeAndSetToNull((void**)&g_csr);
return -1;
}
printf(" > Creating a certificate for the device..\n");
char* deviceCert;
int ret = createIdentityCertFromCSR(g_caKeyPem, g_caCertPem, g_csr, &deviceCert);
- OICFreeAndSetToNull(&g_csr);
+ OICFreeAndSetToNull((void**)&g_csr);
if (ret != 0)
{
OIC_LOG(ERROR, TAG, "Failed to generate certificate");
printf(" Atempt Direct-Pairing Provisioning (PIN : [%s])..\n", (char*)pconf.pin.val);
OCStackResult rst = OCProvisionDirectPairing((void*) g_ctx,
getDevInst((const OCProvisionDev_t*) g_own_list, dev_num),
- &pconf, provisionDPCB);
+ &pconf, (OCProvisionResultCB)provisionDPCB);
if(OC_STACK_OK != rst)
{
OIC_LOG_V(ERROR, TAG, "OCProvisionDirectPairing API error: %d", rst);
#include "srmutility.h"
-static const unsigned int USECS_PER_MSEC = 1000;
-
#define TAG ("OIC_PM_UTILITY")
typedef struct _DiscoveryInfo{
//coaps://0.0.0.0:5684/oic/sec/cred?subjectid=(Canonical ENCODED UUID)
const char *srpUri = SRP_FORM_DELETE_CREDENTIAL;
#ifdef __WITH_TLS__
- if(CA_ADAPTER_TCP == destDev->endpoint.adapter)
+ if((int)CA_ADAPTER_TCP == (int)destDev->endpoint.adapter)
{
srpUri = SRP_FORM_DELETE_CREDENTIAL_TCP;
}
*/
OCPMGetCsrResult_t* currentEntry = &getCsrData->resArr[getCsrData->numOfResults];
OIC_LOG_V(INFO, TAG, "Inside registerResultForGetCSRResourceCB "
- "getCsrData->numOfResults is %d\n", getCsrData->numOfResults);
+ "getCsrData->numOfResults is %zu\n", getCsrData->numOfResults);
memcpy(currentEntry->deviceId.id,
getCsrData->deviceInfo->doxm->deviceID.id, UUID_LENGTH);
currentEntry->res = stackresult;
*/
OCPMGetRolesResult_t* currentEntry = &getRolesData->resArr[getRolesData->numOfResults];
OIC_LOG_V(INFO, TAG, "Inside registerResultForGetCSRResourceCB "
- "getRolesData->numOfResults is %d\n", getRolesData->numOfResults);
+ "getRolesData->numOfResults is %zu\n", getRolesData->numOfResults);
memcpy(currentEntry->deviceId.id,
getRolesData->deviceInfo->doxm->deviceID.id, UUID_LENGTH);
currentEntry->res = stackresult;
{{0}}, /* OicUuid_t deviceID */
false, /* bool dpc */
{{0}}, /* OicUuid_t owner */
+ {{0}} /* rownerID */
};
static OicSecDoxm_t defaultDoxm2 =
{{0}}, /* OicUuid_t deviceID */
false, /* bool dpc */
{{0}}, /* OicUuid_t owner */
+ {{0}} /* rownerID */
};
static void provisioningCB (void* UNUSED1, size_t UNUSED2, OCProvisionResult_t *UNUSED3, bool UNUSED4)
{{0}}, /* OicUuid_t deviceID */
false, /* bool dpc */
{{0}}, /* OicUuid_t owner */
+ {{0}} /* rownerID */
};
static OicSecDoxm_t defaultDoxm2 =
{{0}}, /* OicUuid_t deviceID */
false, /* bool dpc */
{{0}}, /* OicUuid_t owner */
+ {{0}} /* rownerID */
};
static void provisioningCB (void* UNUSED1, size_t UNUSED2, OCProvisionResult_t *UNUSED3, bool UNUSED4)