Commit fe8c63d3 authored by saurabh.s9's avatar saurabh.s9 Committed by Randeep

Adding C++ API for MOT

Patch #11 Fix Review comments
          Changed MACRO _ENABLE_MULTIPLE_OWNER_ to MULTIPLE_OWNER and this
          change propagated upto C-API's.

Change-Id: I55305d5cf9210b25c68f0eaf04c1362111735979
Signed-off-by: default avatarsaurabh.s9 <saurabh.s9@samsung.com>
Signed-off-by: default avatarSandeep Sharma <sandeep.s9@samsung.com>
Signed-off-by: Randeep's avatarRandeep Singh <randeep.s@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/14221Tested-by: default avatarjenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: default avatarChul Lee <chuls.lee@samsung.com>
Signed-off-by: default avatarsaurabh.s9 <saurabh.s9@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/15145
parent ff44e046
......@@ -70,13 +70,8 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcProvisioning_ownershipTransferCB
OTMCallbackData_t CBData = {0};
if (OIC_JUST_WORKS == (OicSecOxm_t)OxmType)
{
CBData.loadSecretCB = LoadSecretJustWorksCallback;
CBData.createSecureSessionCB = CreateSecureSessionJustWorksCallback;
CBData.createSelectOxmPayloadCB = CreateJustWorksSelectOxmPayload;
CBData.createOwnerTransferPayloadCB = CreateJustWorksOwnerTransferPayload;
result = OCSecure::setOwnerTransferCallbackData((OicSecOxm_t)OxmType,
&CBData, NULL);
/*NO callback required for JUST_WORKS*/
result = OCSecure::setInputPinCallback(NULL);
}
if (OIC_RANDOM_DEVICE_PIN == (OicSecOxm_t)OxmType)
{
......@@ -84,12 +79,7 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcProvisioning_ownershipTransferCB
{
delete jniPinListener;
jniPinListener = new JniPinCheckListener(env, jListener);
CBData.loadSecretCB = InputPinCodeCallback;
CBData.createSecureSessionCB = CreateSecureSessionRandomPinCallback;
CBData.createSelectOxmPayloadCB = CreatePinBasedSelectOxmPayload;
CBData.createOwnerTransferPayloadCB = CreatePinBasedOwnerTransferPayload;
result = OCSecure::setOwnerTransferCallbackData((OicSecOxm_t)OxmType,
&CBData, Callback);
result = OCSecure::setInputPinCallback(Callback);
}
else
{
......
......@@ -67,7 +67,7 @@ typedef int (*CAgetPskCredentialsHandler)(CADtlsPskCredType_t type,
uint8_t *result, size_t result_length);
#if defined(__WITH_DTLS__) || defined(__WITH_TLS__)
#ifdef _ENABLE_MULTIPLE_OWNER_
#ifdef MULTIPLE_OWNER
/**
* API to get a secure connected peer information
*
......@@ -76,7 +76,7 @@ typedef int (*CAgetPskCredentialsHandler)(CADtlsPskCredType_t type,
* @return secure connected peer information on success, otherwise NULL
*/
const CASecureEndpoint_t *CAGetSecureEndpointData(const CAEndpoint_t *peer);
#endif //_ENABLE_MULTIPLE_OWNER_
#endif //MULTIPLE_OWNER
#endif
/**
......
......@@ -172,7 +172,7 @@ CAResult_t CAsslGenerateOwnerPsk(const CAEndpoint_t *endpoint,
const uint8_t* provServerDeviceId, const size_t provServerDeviceIdLen,
uint8_t* ownerPsk, const size_t ownerPskSize);
#ifdef _ENABLE_MULTIPLE_OWNER_
#ifdef MULTIPLE_OWNER
/**
* Gets CA secure endpoint info corresponding for endpoint.
*
......
......@@ -88,7 +88,7 @@ if ((secured == '1') and (with_tcp == True)):
env.AppendUnique(CPPDEFINES = ['__WITH_TLS__'])
if (multiple_owner == '1'):
env.AppendUnique(CPPDEFINES=['_ENABLE_MULTIPLE_OWNER_'])
env.AppendUnique(CPPDEFINES=['MULTIPLE_OWNER'])
ca_common_src = None
......
......@@ -792,7 +792,7 @@ static SslEndPoint_t *GetSslPeer(const CAEndpoint_t *peer)
return NULL;
}
#ifdef _ENABLE_MULTIPLE_OWNER_
#ifdef MULTIPLE_OWNER
/**
* Gets CA secure endpoint info corresponding for endpoint.
*
......
......@@ -143,7 +143,7 @@ void CARegisterHandler(CARequestCallback ReqHandler, CAResponseCallback RespHand
}
#if defined(__WITH_DTLS__) || defined(__WITH_TLS__)
#ifdef _ENABLE_MULTIPLE_OWNER_
#ifdef MULTIPLE_OWNER
const CASecureEndpoint_t *CAGetSecureEndpointData(const CAEndpoint_t *peer)
{
OIC_LOG(DEBUG, TAG, "IN CAGetSecurePeerInfo");
......@@ -157,7 +157,7 @@ const CASecureEndpoint_t *CAGetSecureEndpointData(const CAEndpoint_t *peer)
OIC_LOG(DEBUG, TAG, "OUT CAGetSecurePeerInfo");
return GetCASecureEndpointData(peer);
}
#endif //_ENABLE_MULTIPLE_OWNER_
#endif //MULTIPLE_OWNER
CAResult_t CAregisterSslHandshakeCallback(CAErrorCallback tlsHandshakeCallback)
{
......
......@@ -88,7 +88,7 @@ if env.get('LOGGING'):
libocsrm_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
if env.get('MULTIPLE_OWNER') == '1':
libocsrm_env.AppendUnique(CPPDEFINES=['_ENABLE_MULTIPLE_OWNER_'])
libocsrm_env.AppendUnique(CPPDEFINES=['MULTIPLE_OWNER'])
######################################################################
# Source files and Targets
......
......@@ -62,7 +62,7 @@ const OicSecAce_t* GetACLResourceData(const OicUuid_t* subjectId, OicSecAce_t **
*/
OCStackResult AclToCBORPayload(const OicSecAcl_t * acl, uint8_t **outPayload, size_t *size);
#ifdef _ENABLE_MULTIPLE_OWNER_
#ifdef MULTIPLE_OWNER
/**
* Function to check the ACL access of SubOwner
*
......@@ -73,7 +73,7 @@ OCStackResult AclToCBORPayload(const OicSecAcl_t * acl, uint8_t **outPayload, si
* @return ::true for valid access, otherwise invalid access
*/
bool IsValidAclAccessForSubOwner(const OicUuid_t* uuid, const uint8_t *cborPayload, const size_t size);
#endif //_ENABLE_MULTIPLE_OWNER_
#endif //MULTIPLE_OWNER
/**
......
......@@ -82,7 +82,7 @@ OicSecCred_t* GetCredEntryByCredId(const uint16_t credId);
OCStackResult CredToCBORPayload(const OicSecCred_t* cred, uint8_t **cborPayload,
size_t *cborSize, int secureFlag);
#ifdef _ENABLE_MULTIPLE_OWNER_
#ifdef MULTIPLE_OWNER
/**
* Function to check the credential access of SubOwner
*
......@@ -93,7 +93,7 @@ OCStackResult CredToCBORPayload(const OicSecCred_t* cred, uint8_t **cborPayload,
* @return ::true for valid access, otherwise invalid access
*/
bool IsValidCredentialAccessForSubOwner(const OicUuid_t* uuid, const uint8_t *cborPayload, size_t size);
#endif //_ENABLE_MULTIPLE_OWNER_
#endif //MULTIPLE_OWNER
/**
* This function generates the bin credential data.
......
......@@ -22,9 +22,9 @@
#define IOTVT_SRM_DOXM_H
#include "octypes.h"
#ifdef _ENABLE_MULTIPLE_OWNER_
#ifdef MULTIPLE_OWNER
#include "cacommon.h"
#endif //_ENABLE_MULTIPLE_OWNER_
#endif //MULTIPLE_OWNER
#ifdef __cplusplus
extern "C" {
......@@ -121,7 +121,7 @@ OCStackResult GetDoxmIsOwned(bool *isOwned);
*/
OCStackResult GetDoxmRownerId(OicUuid_t *rowneruuid);
#ifdef _ENABLE_MULTIPLE_OWNER_
#ifdef MULTIPLE_OWNER
/**
* Compare the UUID to SubOwner.
*
......@@ -130,7 +130,7 @@ OCStackResult GetDoxmRownerId(OicUuid_t *rowneruuid);
* @return true if uuid exists in the SubOwner list of doxm, else false.
*/
bool IsSubOwner(const OicUuid_t* uuid);
#endif //_ENABLE_MULTIPLE_OWNER_
#endif //MULTIPLE_OWNER
/** This function deallocates the memory for OicSecDoxm_t .
*
......@@ -144,7 +144,7 @@ void DeleteDoxmBinData(OicSecDoxm_t* doxm);
*/
void RestoreDoxmToInitState();
#if defined(__WITH_DTLS__) && defined(_ENABLE_MULTIPLE_OWNER_)
#if defined(__WITH_DTLS__) && defined(MULTIPLE_OWNER)
/**
* Callback function to handle MOT DTLS handshake result.
* @param[out] object remote device information.
......@@ -152,7 +152,7 @@ void RestoreDoxmToInitState();
*/
void MultipleOwnerDTLSHandshakeCB(const CAEndpoint_t *object,
const CAErrorInfo_t *errorInfo);
#endif //__WITH_DTLS__ && _ENABLE_MULTIPLE_OWNER_
#endif //__WITH_DTLS__ && MULTIPLE_OWNER
#ifdef __cplusplus
}
......
......@@ -50,10 +50,10 @@ typedef struct PEContext
SRMAccessResponse_t retVal;
AmsMgrContext_t *amsMgrContext;
#ifdef _ENABLE_MULTIPLE_OWNER_
#ifdef MULTIPLE_OWNER
uint8_t* payload;
size_t payloadSize;
#endif //_ENABLE_MULTIPLE_OWNER_
#endif //MULTIPLE_OWNER
} PEContext_t;
/**
......
......@@ -101,15 +101,15 @@ extern const char * OIC_JSON_PERMISSION_NAME;
extern const char * OIC_JSON_OWNERS_NAME;
extern const char * OIC_JSON_OWNER_NAME;
extern const char * OIC_JSON_DEVOWNERID_NAME;
#ifdef _ENABLE_MULTIPLE_OWNER_
#ifdef MULTIPLE_OWNER
extern const char * OIC_JSON_SUBOWNERID_NAME;
#endif //_ENABLE_MULTIPLE_OWNER_
#endif //MULTIPLE_OWNER
extern const char * OIC_JSON_OWNED_NAME;
extern const char * OIC_JSON_OXM_NAME;
extern const char * OIC_JSON_OXMS_NAME;
#ifdef _ENABLE_MULTIPLE_OWNER_
#ifdef MULTIPLE_OWNER
extern const char * OIC_JSON_MOM_NAME;
#endif //_ENABLE_MULTIPLE_OWNER_
#endif //MULTIPLE_OWNER
extern const char * OIC_JSON_OXM_TYPE_NAME;
extern const char * OIC_JSON_OXM_SEL_NAME;
extern const char * OIC_JSON_DEVICE_ID_FORMAT_NAME;
......@@ -152,9 +152,9 @@ extern const char * OIC_JSON_REL_NAME;
extern const char * OIC_JSON_RT_NAME;
extern const char * OIC_JSON_IF_NAME;
extern const char * OIC_JSON_ROWNERID_NAME;
#ifdef _ENABLE_MULTIPLE_OWNER_
#ifdef MULTIPLE_OWNER
extern const char * OIC_JSON_EOWNERID_NAME;
#endif //_ENABLE_MULTIPLE_OWNER_
#endif //MULTIPLE_OWNER
extern const char * OIC_JSON_ENCODING_NAME;
extern const char * OIC_JSON_DATA_NAME;
extern const char * OIC_JSON_SEC_V_NAME;
......@@ -178,9 +178,9 @@ extern const char * WILDCARD_RESOURCE_URI;
extern const char * OXM_JUST_WORKS;
extern const char * OXM_RANDOM_DEVICE_PIN;
extern const char * OXM_MANUFACTURER_CERTIFICATE;
#ifdef _ENABLE_MULTIPLE_OWNER_
#ifdef MULTIPLE_OWNER
extern const char * OXM_PRECONF_PIN;
#endif //_ENABLE_MULTIPLE_OWNER_
#endif //MULTIPLE_OWNER
extern const char * OIC_SEC_ENCODING_BASE64;
extern const char * OIC_SEC_ENCODING_RAW;
......
......@@ -105,7 +105,7 @@ OCStackResult GeneratePin(char* pinBuffer, size_t bufferSize);
*/
OCStackResult InputPin(char* pinBuffer, size_t bufferSize);
#ifdef _ENABLE_MULTIPLE_OWNER_
#ifdef MULTIPLE_OWNER
/**
* Function to save the Pre-configured PIN.
*
......@@ -153,7 +153,7 @@ int32_t GetDtlsPskForRandomPinOxm( CADtlsPskCredType_t type,
const unsigned char *UNUSED1, size_t UNUSED2,
unsigned char *result, size_t result_length);
#ifdef _ENABLE_MULTIPLE_OWNER_
#ifdef MULTIPLE_OWNER
/**
* This internal callback is used while Random PIN based MOT.
* This callback will be used to establish a temporary secure session according to
......@@ -210,7 +210,7 @@ int32_t GetDtlsPskForMotPreconfPinOxm( CADtlsPskCredType_t type,
const unsigned char *UNUSED1, size_t UNUSED2,
unsigned char *result, size_t result_length);
#endif //_ENABLE_MULTIPLE_OWNER_
#endif //MULTIPLE_OWNER
/**
......
......@@ -219,7 +219,7 @@ typedef enum OicSecDpm
SECURITY_MANAGEMENT_SERVICES = (0x1 << 3),
PROVISION_CREDENTIALS = (0x1 << 4),
PROVISION_ACLS = (0x1 << 5),
#ifdef _ENABLE_MULTIPLE_OWNER_
#ifdef MULTIPLE_OWNER
TAKE_SUB_OWNER = (0x1 << 6),
#endif
// << 7 THROUGH 15 RESERVED
......@@ -273,9 +273,9 @@ typedef enum
OIC_MANUFACTURER_CERTIFICATE = 0x2,
OIC_DECENTRALIZED_PUBLIC_KEY = 0x3,
OIC_OXM_COUNT,
#ifdef _ENABLE_MULTIPLE_OWNER_
#ifdef MULTIPLE_OWNER
OIC_PRECONFIG_PIN = 0xFF00,
#endif //_ENABLE_MULTIPLE_OWNER_
#endif //MULTIPLE_OWNER
}OicSecOxm_t;
typedef enum
......@@ -287,14 +287,14 @@ typedef enum
OIC_ENCODING_DER = 4
}OicEncodingType_t;
#ifdef _ENABLE_MULTIPLE_OWNER_
#ifdef MULTIPLE_OWNER
typedef enum
{
MOT_STATUS_READY = 0,
MOT_STATUS_IN_PROGRESS = 1,
MOT_STATUS_DONE = 2,
}MotStatus_t;
#endif //_ENABLE_MULTIPLE_OWNER_
#endif //MULTIPLE_OWNER
/*
* oic.sec.mom type definition
......@@ -325,10 +325,10 @@ typedef char *OicUrn_t; //TODO is URN type defined elsewhere?
typedef struct OicUuid OicUuid_t; //TODO is UUID type defined elsewhere?
#ifdef _ENABLE_MULTIPLE_OWNER_
#ifdef MULTIPLE_OWNER
typedef struct OicSecSubOwner OicSecSubOwner_t;
typedef struct OicSecMom OicSecMom_t;
#endif //_ENABLE_MULTIPLE_OWNER_
#endif //MULTIPLE_OWNER
#if defined(__WITH_DTLS__) || defined(__WITH_TLS__)
......@@ -395,7 +395,7 @@ struct OicSecAce
OicSecRsrc_t *resources; // 1:R:M:Y:Resource
uint16_t permission; // 2:R:S:Y:UINT16
OicSecValidity_t *validities; // 3:R:M:N:Time-interval
#ifdef _ENABLE_MULTIPLE_OWNER_
#ifdef MULTIPLE_OWNER
OicUuid_t* eownerID; //4:R:S:N:oic.uuid
#endif
OicSecAce_t *next;
......@@ -449,13 +449,13 @@ struct OicSecCred
OicSecKey_t privateData; // 6:R:S:N:oic.sec.key
char *period; // 7:R:S:N:String
OicUuid_t rownerID; // 8:R:S:Y:oic.uuid
#ifdef _ENABLE_MULTIPLE_OWNER_
#ifdef MULTIPLE_OWNER
OicUuid_t *eownerID; //9:R:S:N:oic.uuid
#endif //_ENABLE_MULTIPLE_OWNER_
#endif //MULTIPLE_OWNER
OicSecCred_t *next;
};
#ifdef _ENABLE_MULTIPLE_OWNER_
#ifdef MULTIPLE_OWNER
struct OicSecSubOwner {
OicUuid_t uuid;
MotStatus_t status;
......@@ -465,7 +465,7 @@ struct OicSecSubOwner {
struct OicSecMom{
OicSecMomType_t mode;
};
#endif //_ENABLE_MULTIPLE_OWNER_
#endif //MULTIPLE_OWNER
/**
* /oic/sec/doxm (Device Owner Transfer Methods) data type
......@@ -486,10 +486,10 @@ struct OicSecDoxm
OicUuid_t deviceID; // 6:R:S:Y:oic.uuid
bool dpc; // 7:R:S:Y:Boolean
OicUuid_t owner; // 8:R:S:Y:oic.uuid
#ifdef _ENABLE_MULTIPLE_OWNER_
#ifdef MULTIPLE_OWNER
OicSecSubOwner_t* subOwners; //9:R/W:M:N:oic.uuid
OicSecMom_t *mom; //10:R/W:S:N:oic.sec.mom
#endif //_ENABLE_MULTIPLE_OWNER_
#endif //MULTIPLE_OWNER
OicUuid_t rownerID; // 11:R:S:Y:oic.uuid
};
......
......@@ -89,7 +89,7 @@ if provisioning_env.get('LOGGING'):
provisioning_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
if provisioning_env.get('MULTIPLE_OWNER') == '1':
provisioning_env.AppendUnique(CPPDEFINES=['_ENABLE_MULTIPLE_OWNER_'])
provisioning_env.AppendUnique(CPPDEFINES=['MULTIPLE_OWNER'])
######################################################################
# Source files and Targets
......
......@@ -24,9 +24,9 @@
#include "octypes.h"
#include "pmtypes.h"
#include "ownershiptransfermanager.h"
#ifdef _ENABLE_MULTIPLE_OWNER_
#ifdef MULTIPLE_OWNER
#include "securevirtualresourcetypes.h"
#endif //_ENABLE_MULTIPLE_OWNER_
#endif //MULTIPLE_OWNER
#ifdef __cplusplus
extern "C" {
......@@ -91,7 +91,7 @@ OCStackResult OCDoOwnershipTransfer(void* ctx,
*/
OCStackResult OCSetOxmAllowStatus(const OicSecOxm_t oxm, const bool allowStatus);
#ifdef _ENABLE_MULTIPLE_OWNER_
#ifdef MULTIPLE_OWNER
/**
* API to perfrom multiple ownership transfer for MOT enabled device.
*
......@@ -103,7 +103,7 @@ OCStackResult OCSetOxmAllowStatus(const OicSecOxm_t oxm, const bool allowStatus)
OCStackResult OCDoMultipleOwnershipTransfer(void* ctx,
OCProvisionDev_t *targetDevices,
OCProvisionResultCB resultCallback);
#endif //_ENABLE_MULTIPLE_OWNER_
#endif //MULTIPLE_OWNER
/**
* API to register for particular OxM.
......@@ -125,7 +125,7 @@ OCStackResult OCSetOwnerTransferCallbackData(OicSecOxm_t oxm, OTMCallbackData_t*
*/
OCStackResult OCDiscoverOwnedDevices(unsigned short timeout, OCProvisionDev_t **ppList);
#ifdef _ENABLE_MULTIPLE_OWNER_
#ifdef MULTIPLE_OWNER
/**
* The function is responsible for discovery of MOT enabled device is current subnet.
*
......@@ -145,7 +145,7 @@ OCStackResult OCDiscoverMultipleOwnerEnabledDevices(unsigned short timeout, OCPr
* @return OC_STACK_OK in case of success and other value otherwise.
*/
OCStackResult OCDiscoverMultipleOwnedDevices(unsigned short timeout, OCProvisionDev_t **ppList);
#endif //_ENABLE_MULTIPLE_OWNER_
#endif //MULTIPLE_OWNER
/**
* API to provision credentials between two devices and ACLs for the devices who act as a server.
......@@ -239,7 +239,7 @@ OCStackResult OCProvisionCredentials(void *ctx, OicSecCredType_t type, size_t ke
const OCProvisionDev_t *pDev2,
OCProvisionResultCB resultCallback);
#ifdef _ENABLE_MULTIPLE_OWNER_
#ifdef MULTIPLE_OWNER
/**
* API to provision preconfigured PIN to device(NOT LIST).
* If device does not support the Preconfigured PIN OxM,
......@@ -295,7 +295,7 @@ OCStackResult OCChangeMOTMode(void *ctx, const OCProvisionDev_t *targetDeviceInf
*/
OCStackResult OCSelectMOTMethod(void *ctx, const OCProvisionDev_t *targetDeviceInfo,
const OicSecOxm_t oxmSelValue, OCProvisionResultCB resultCallback);
#endif //_ENABLE_MULTIPLE_OWNER_
#endif //MULTIPLE_OWNER
/**
* Function to unlink devices.
......
......@@ -67,7 +67,7 @@ OCStackResult PMSingleDeviceDiscovery(unsigned short waittime, const OicUuid_t*
*/
OCStackResult PMDeviceDiscovery(unsigned short waittime, bool isOwned, OCProvisionDev_t **ppList);
#ifdef _ENABLE_MULTIPLE_OWNER_
#ifdef MULTIPLE_OWNER
/**
* Discover multiple OTM enabled devices in the same IP subnet.
*
......@@ -78,7 +78,7 @@ OCStackResult PMDeviceDiscovery(unsigned short waittime, bool isOwned, OCProvisi
* @return OC_STACK_OK on success otherwise error.
*/
OCStackResult PMMultipleOwnerDeviceDiscovery(unsigned short waittime, bool isMultipleOwned, OCProvisionDev_t **ppDevicesList);
#endif //_ENABLE_MULTIPLE_OWNER_
#endif //MULTIPLE_OWNER
/**
* This function deletes list of provision target devices
......
......@@ -86,7 +86,7 @@ if env.get('SECURED') == '1':
if env.get('MULTIPLE_OWNER') == '1':
provisioning_env.AppendUnique(CPPDEFINES = ['_ENABLE_MULTIPLE_OWNER_'])
provisioning_env.AppendUnique(CPPDEFINES = ['MULTIPLE_OWNER'])
provisioning_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
......
......@@ -47,9 +47,9 @@ extern "C"
#define _10_DISCOV_ALL_DEVS_ 10
#define _11_DISCOV_UNOWN_DEVS_ 11
#define _12_DISCOV_OWN_DEVS_ 12
#ifdef _ENABLE_MULTIPLE_OWNER_
#ifdef MULTIPLE_OWNER
#define _13_MOT_DISCOV_DEV_ 13
#endif //_ENABLE_MULTIPLE_OWNER_
#endif //MULTIPLE_OWNER
#define _20_REGIST_DEVS_ 20
#define _30_PROVIS_PAIR_DEVS_ 30
#define _31_PROVIS_CRED_ 31
......@@ -63,11 +63,11 @@ extern "C"
#define _52_RESET_SELEC_DEV_ 52
#define _60_GET_CRED_ 60
#define _61_GET_ACL_ 61
#ifdef _ENABLE_MULTIPLE_OWNER_
#ifdef MULTIPLE_OWNER
#define _70_MOT_CHANGE_MOM_ 70
#define _71_MOT_PROV_PRECONF_PIN_ 71
#define _72_MOT_OXM_SEL_ 72
#endif //_ENABLE_MULTIPLE_OWNER_
#endif //MULTIPLE_OWNER
#define _80_SELECT_PROTOCOL_ 80
#define _99_EXIT_PRVN_CLT_ 99
......@@ -98,10 +98,10 @@ static OCProvisionDev_t* g_own_list;
static OCProvisionDev_t* g_unown_list;
static int g_own_cnt;
static int g_unown_cnt;
#ifdef _ENABLE_MULTIPLE_OWNER_
#ifdef MULTIPLE_OWNER
static OCProvisionDev_t* g_mot_enable_list;
static int g_mot_enable_cnt;
#endif //_ENABLE_MULTIPLE_OWNER_
#endif //MULTIPLE_OWNER
static bool g_doneCB;
#ifdef __WITH_TLS__
......@@ -262,7 +262,7 @@ static void syncDeviceCB(void* ctx, int nOfRes, OCProvisionResult_t* arr, bool h
g_doneCB = true;
}
#ifdef _ENABLE_MULTIPLE_OWNER_
#ifdef MULTIPLE_OWNER
static void updateDoxmForMOTCB(void* ctx, int nOfRes, OCProvisionResult_t* arr, bool hasError)
{
if(!hasError)
......@@ -276,7 +276,7 @@ static void updateDoxmForMOTCB(void* ctx, int nOfRes, OCProvisionResult_t* arr,
}
g_doneCB = true;
}
#endif //_ENABLE_MULTIPLE_OWNER_
#endif //MULTIPLE_OWNER
static void inputPinCB(char* pin, size_t len)
{
......@@ -431,7 +431,7 @@ static int discoverOwnedDevices(void)
return 0;
}
#ifdef _ENABLE_MULTIPLE_OWNER_
#ifdef MULTIPLE_OWNER
static int discoverMOTEnabledDevices(void)
{
// delete owned device list before updating it
......@@ -455,7 +455,7 @@ static int discoverMOTEnabledDevices(void)
return 0;
}
#endif //_ENABLE_MULTIPLE_OWNER_
#endif //MULTIPLE_OWNER
static int registerDevices(void)
{
......@@ -1206,7 +1206,7 @@ static int removeDeviceWithUuid(void)
return 0;
}
#ifdef _ENABLE_MULTIPLE_OWNER_
#ifdef MULTIPLE_OWNER
static int changeMultipleOwnershipTrnasferMode(void)
{
// check |own_list| for removing device
......@@ -1402,7 +1402,7 @@ static int provisionPreconfigPIN()
return 0;
}
#endif //_ENABLE_MULTIPLE_OWNER_
#endif //MULTIPLE_OWNER
static int resetDevice(void)
{
......@@ -2018,12 +2018,12 @@ static void printMenu(void)
printf("** [A] DISCOVER DEVICES ON NETWORK\n");
printf("** 10. Discover All Un/Owned Devices on Network\n");
printf("** 11. Discover Only Unowned Devices on Network\n");
#ifdef _ENABLE_MULTIPLE_OWNER_
#ifdef MULTIPLE_OWNER
printf("** 12. Discover Only Owned Devices on Network\n");
printf("** 13. Discover Multiple Ownership Transfer Enabled Devices on Network\n\n");
#else
printf("** 12. Discover Only Owned Devices on Network\n\n");
#endif //_ENABLE_MULTIPLE_OWNER_
#endif //MULTIPLE_OWNER
printf("** [B] REGISTER/OWN ALL DISCOVERED UNOWNED DEVICES\n");
printf("** 20. Register/Own All Discovered Unowned Devices\n\n");
......@@ -2048,12 +2048,12 @@ static void printMenu(void)
printf("** 60. Get the Credential resources of the Selected Device\n");
printf("** 61. Get the ACL resources of the Selected Device\n\n");
#ifdef _ENABLE_MULTIPLE_OWNER_
#ifdef MULTIPLE_OWNER
printf("** [G] UPDATE THE MULTIPLE OWNERSHIP TRANSFER RELATED VALUE\n");
printf("** 70. Change the Multiple Ownership transfer MODE(update mom)\n");
printf("** 71. Provision Preconfigured PIN\n");
printf("** 72. Change the Multiple Ownership transfer METHOD(update oxmsel)\n\n");
#endif //_ENABLE_MULTIPLE_OWNER_
#endif //MULTIPLE_OWNER
#ifdef __WITH_TLS__
printf("** [H] SELECT SECURE PROTOCOL DTLS/TLS\n");
......@@ -2105,9 +2105,9 @@ int main()
OIC_LOG(WARNING, TAG, "Failed to disable OIC_DECENTRALIZED_PUBLIC_KEY OxM");
}
#ifdef _ENABLE_MULTIPLE_OWNER_
#ifdef MULTIPLE_OWNER
SetPreconfigPin("12341234", 8);
#endif //_ENABLE_MULTIPLE_OWNER_
#endif //MULTIPLE_OWNER
// main loop for provisioning manager
int mn_num = 0;
......@@ -2143,14 +2143,14 @@ int main()
OIC_LOG(ERROR, TAG, "_12_DISCOV_OWN_DEVS_: error");
}
break;
#ifdef _ENABLE_MULTIPLE_OWNER_
#ifdef MULTIPLE_OWNER
case _13_MOT_DISCOV_DEV_:
if(discoverMOTEnabledDevices())
{
OIC_LOG(ERROR, TAG, "_13_MOT_DISCOV_DEV_: error");
}
break;
#endif //_ENABLE_MULTIPLE_OWNER_
#endif //MULTIPLE_OWNER
case _20_REGIST_DEVS_:
if(registerDevices())
{
......@@ -2229,7 +2229,7 @@ int main()
OIC_LOG(ERROR, TAG, "_61_GET_ACL_: error");
}
break;
#ifdef _ENABLE_MULTIPLE_OWNER_