Commit f93a48cb authored by Alex Kelley's avatar Alex Kelley Committed by Kevin Kane

Additional functionality for MOT and pin handling.

 - Add APIs to do MOT discovery of a specific device.
 - Add APIs to check to see if the caller is a subowner.
 - Add context to display and input pin callbacks.
 - Add device information to input pin callback.
 - Enable C++ security APIs to be built for Windows.
 - Update ProvisioningClient and Sampleserver_RandomPin
   to  use the new APIs.
 - Enable MOT to always build on Windows.

Change-Id: I27af9d3c2c7065b8643f77be3ac4c9b2dc5ffe80
Signed-off-by: default avatarAlex Kelley <alexke@microsoft.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/16403Tested-by: default avatarjenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: default avatarMike Fenelon <mike.fenelon@microsoft.com>
Reviewed-by: default avatarKevin Kane <kkane@microsoft.com>
parent dc6df8c2
......@@ -21,6 +21,7 @@
#include "gtest/gtest.h"
#include "time.h"
// Test function hooks
#define CAcloseSslConnection CAcloseSslConnectionTest
#define CAdecryptSsl CAdecryptSslTest
#define CAdeinitSslAdapter CAdeinitSslAdapterTest
......@@ -33,6 +34,9 @@
#define CAsetTlsCipherSuite CAsetTlsCipherSuiteTest
#define CAsslGenerateOwnerPsk CAsslGenerateOwnerPskTest
#define CAcloseSslConnectionAll CAcloseSslConnectionAllTest
#ifdef MULTIPLE_OWNER
#define GetCASecureEndpointData GetCASecureEndpointDataTest
#endif
#include "../src/adapter_util/ca_adapter_net_ssl.c"
......
; Windows octbstack.dll exports that are required for both products and tests,
; but only when building with SECURED=1.
ConvertUuidToStr
CreateJustWorksOwnerTransferPayload
CreateJustWorksSelectOxmPayload
CreateMVJustWorksSelectOxmPayload
......@@ -18,6 +20,7 @@ OCDeleteDiscoveredDevices
OCDeletePdAclList
OCDeleteUuidList
OCDiscoverOwnedDevices
OCDiscoverSingleDevice
OCDiscoverUnownedDevices
OCDoOwnershipTransfer
OCGetACLResource
......@@ -30,16 +33,27 @@ OCSaveACL
OCProvisionCredentials
OCProvisionDirectPairing
OCProvisionPairwiseDevices
OCProvisionTrustCertChain
OCReadTrustCertChain
OCRegisterTrustCertChainNotifier
OCRemoveDevice
OCRemoveDeviceWithUuid
OCRemoveTrustCertChainNotifier
OCResetDevice
OCResetSVRDB
OCSaveTrustCertChain
OCSetOwnerTransferCallbackData
OCUnlinkDevices
OCSetOxmAllowStatus
SetDisplayPinWithContextCB
UnsetDisplayPinWithContextCB
SetGeneratePinCB
UnsetGeneratePinCB
SetInputPinCB
SetInputPinWithContextCB
UnsetInputPinCB
UnsetInputPinWithContextCB
SetRandomPinPolicy
SetDisplayNumCB
UnsetDisplayNumCB
......
......@@ -11,7 +11,9 @@ OCAddPreconfigPin
OCChangeMOTMode
OCDiscoverMultipleOwnedDevices
OCDiscoverMultipleOwnerEnabledDevices
OCDiscoverMultipleOwnerEnabledSingleDevice
OCDoMultipleOwnershipTransfer
OCIsSubownerOfDevice
OCProvisionPreconfigPin
OCSelectMOTMethod
......
......@@ -49,44 +49,101 @@ typedef enum OicSecPinType{
}OicSecPinType_t;
/**
* Function pointer to print pin code.
* Function pointer to display pin code.
*/
typedef void (*GeneratePinCallback)(char* pinData, size_t pinSize);
/**
* Function pointer to display pin code, with context.
*/
typedef void(*DisplayPinCallbackWithContext)(char* pinData, size_t pinSize, void* context);
/**
* Function pointer to input pin code.
*/
typedef void (*InputPinCallback)(char* pinBuf, size_t bufSize);
/**
* Function to setting generate PIN callback from user.
* Function pointer to input pin code, with context and device information.
*/
typedef void(*InputPinCallbackWithContext)(OicUuid_t deviceId, char* pinBuffer, size_t pinBufferSize, void* context);
/**
* Function to set the display PIN callback from the user.
*
* @deprecated Use SetDisplayPinWithContextCB instead.
*
* @param pinCB implementation of generate PIN callback.
*/
void SetGeneratePinCB(GeneratePinCallback pinCB);
/**
* Function to setting input PIN callback from user.
* Function to set the display PIN callback from the user with context.
*
* @param displayPinCB implementation of display PIN callback.
* @param context context to return in the callback.
*
* @return OC_STACK_OK in case of success or other value in case of error.
* OC_STACK_INVALID_PARAM if pinCB is invalid.
* OC_STACK_DUPLICATE_REQUEST if a display pin callback has already been set.
*/
OCStackResult SetDisplayPinWithContextCB(DisplayPinCallbackWithContext displayPinCB, void* context);
/**
* Function to set the input PIN callback from the user.
*
* @deprecated Use SetInputPinWithContextCB instead.
*
* @param pinCB implementation of input PIN callback.
*/
void SetInputPinCB(InputPinCallback pinCB);
/**
* Function to set the input PIN callback from the user with context.
*
* @param inputPinCB implementation of input PIN callback.
* @param context context to return in the callback.
*
* @return OC_STACK_OK in case of success or other value in case of error.
* OC_STACK_INVALID_PARAM if pinCB is invalid.
* OC_STACK_DUPLICATE_REQUEST if an input pin callback has already been set.
*/
OCStackResult SetInputPinWithContextCB(InputPinCallbackWithContext inputPinCB, void* context);
/**
* Function to unset the input PIN callback.
* NOTE : Do not call this function while PIN based ownership transfer.
* NOTE : Do not call this function while PIN based ownership transfer is in progress.
*
* @deprecated Use UnsetInputPinWithContextCB instead.
*
*/
void UnsetInputPinCB();
/**
* Function to unset the input PIN callback.
* NOTE : Do not call this function while PIN based ownership transfer is in progress.
*/
void UnsetInputPinWithContextCB();
/**
* Function to unset the PIN generation callback.
* NOTE : Do not call this function while PIN based ownership transfer.
* NOTE : Do not call this function while PIN based ownership transfer is in progress.
*
* @deprecated Use UnsetDisplayPinWithContextCB instead.
*
*/
void UnsetGeneratePinCB();
/**
* Function to generate random PIN.
* This function will send generated PIN to user via callback.
* Function to unset the PIN display callback.
* NOTE : Do not call this function while PIN based ownership transfer is in progress.
*/
void UnsetDisplayPinWithContextCB();
/**
* Function to generate a random PIN.
* This function will send a generated PIN to the user via the callback that was set in
* SetGeneratePinCB or SetGeneratePinWithContextCB.
*
* @param pinBuffer is the reference to the buffer to store the generated PIN data.
* @param bufferSize is the size of buffer.
......@@ -96,14 +153,17 @@ void UnsetGeneratePinCB();
OCStackResult GeneratePin(char* pinBuffer, size_t bufferSize);
/**
* Function to input PIN callback via input callback.
* Function to get a pin for a device.
* This function will acquire a pin from the user via the callback that was set in
* SetInputPinCB or SetInputPinWithContextCB.
*
* @param[in] deviceId is the device that is requesting a pin
* @param[in,out] pinBuffer is the reference to the buffer to store the inputed PIN data.
* @param[in] bufferSize is the size of buffer.
*
* @return ::OC_STACK_OK in case of success or other value in ccase of error.
*/
OCStackResult InputPin(char* pinBuffer, size_t bufferSize);
OCStackResult InputPin(OicUuid_t deviceId, char* pinBuffer, size_t bufferSize);
#ifdef MULTIPLE_OWNER
/**
......@@ -118,7 +178,7 @@ OCStackResult SetPreconfigPin(const char *pinBuffer, size_t pinLength);
#endif
/**
* Function to setting the policy for random PIN generation
* Function to set the policy for random PIN generation
*
* @param[in] pinSize Byte length of random PIN
* @param[in] pinType Type of random PIN (ref OicSecPinType)
......
......@@ -56,23 +56,23 @@ OCStackResult OCInitPM(const char* dbPath);
*/
OCStackResult OCDiscoverSingleDevice(unsigned short timeout, const OicUuid_t* deviceID,
OCProvisionDev_t **ppFoundDevice);
/**
* The function is responsible for discovery of owned/unowned device is specified endpoint/MAC
* address.
* It will return the found device even though timeout is not exceeded.
*
* @param[in] timeout Timeout in seconds, value till which function will listen to responses from
* server before returning the device.
* @param[in] deviceID deviceID of target device.
* @param[in] hostAddress MAC address of target device.
* @param[in] connType ConnectivityType for discovery.
* @param[out] ppFoundDevice OCProvisionDev_t of found device.
* @return OTM_SUCCESS in case of success and other value otherwise.
*/
OCStackResult OCDiscoverSingleDeviceInUnicast(unsigned short timeout, const OicUuid_t* deviceID,
const char* hostAddress, OCConnectivityType connType,
OCProvisionDev_t **ppFoundDevice);
/**
* The function is responsible for discovery of owned/unowned device is specified endpoint/MAC
* address.
* It will return the found device even though timeout is not exceeded.
*
* @param[in] timeout Timeout in seconds, value till which function will listen to responses from
* server before returning the device.
* @param[in] deviceID deviceID of target device.
* @param[in] hostAddress MAC address of target device.
* @param[in] connType ConnectivityType for discovery.
* @param[out] ppFoundDevice OCProvisionDev_t of found device.
* @return OTM_SUCCESS in case of success and other value otherwise.
*/
OCStackResult OCDiscoverSingleDeviceInUnicast(unsigned short timeout, const OicUuid_t* deviceID,
const char* hostAddress, OCConnectivityType connType,
OCProvisionDev_t **ppFoundDevice);
/**
* The function is responsible for discovery of device is current subnet. It will list
......@@ -143,6 +143,22 @@ OCStackResult OCSetOwnerTransferCallbackData(OicSecOxm_t oxm, OTMCallbackData_t*
OCStackResult OCDiscoverOwnedDevices(unsigned short timeout, OCProvisionDev_t **ppList);
#ifdef MULTIPLE_OWNER
/**
* The function is responsible for the discovery of an MOT-enabled device with the specified deviceID.
* The function will return when security information for device with deviceID has been obtained or the
* timeout has been exceeded.
*
* @param[in] timeoutSeconds Maximum time, in seconds, this function will listen for responses from
* servers before returning.
* @param[in] deviceID deviceID of target device.
* @param[out] ppFoundDevice OCProvisionDev_t of discovered device. Caller should use
* OCDeleteDiscoveredDevices to delete the device.
* @return OC_STACK_OK in case of success and other values otherwise.
*/
OCStackResult OCDiscoverMultipleOwnerEnabledSingleDevice(unsigned short timeoutSeconds,
const OicUuid_t *deviceID,
OCProvisionDev_t **ppFoundDevice);
/**
* The function is responsible for discovery of MOT enabled device is current subnet.
*
......@@ -162,6 +178,15 @@ 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);
/**
* The function is responsible for determining if the caller is a subowner of the specified device.
*
* @param[in] device MOT enabled device that contains a list of subowners.
* @param[out] isSubowner Bool indicating whether the caller is a subowner of device.
* @return OC_STACK_OK in case of success and other value otherwise.
*/
OCStackResult OCIsSubownerOfDevice(OCProvisionDev_t *device, bool *isSubowner);
#endif //MULTIPLE_OWNER
/**
......
......@@ -85,6 +85,24 @@ OCStackResult PMSingleDeviceDiscoveryInUnicast(unsigned short waittime, const Oi
OCStackResult PMDeviceDiscovery(unsigned short waittime, bool isOwned, OCProvisionDev_t **ppList);
#ifdef MULTIPLE_OWNER
/**
* The function is responsible for the discovery of an MOT-enabled device with the specified deviceID.
* The function will return when security information for device with deviceID has been obtained or the
* timeout has been exceeded.
*
* @param[in] timeoutSeconds Maximum time, in seconds, this function will listen for responses from
* servers before returning.
* @param[in] deviceID deviceID of target device.
* @param[out] ppFoundDevice OCProvisionDev_t of found device. Caller should use PMDeleteDeviceList
* to delete the device.
*
* @return OC_STACK_OK on success otherwise error.
* OC_STACK_INVALID_PARAM when deviceID is NULL or ppFoundDevice is not initailized.
*/
OCStackResult PMMultipleOwnerSingleDeviceDiscovery(unsigned short timeoutSeconds,
const OicUuid_t *deviceID,
OCProvisionDev_t **ppFoundDevice);
/**
* Discover multiple OTM enabled devices in the same IP subnet.
*
......@@ -95,6 +113,16 @@ 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);
/**
* The function is responsible for determining if the caller is a subowner of the specified device.
*
* @param[in] device MOT enabled device that contains a list of subowners
* @param[out] isSubowner Bool indicating whether the caller is a subowner of device
*
* @return OC_STACK_OK in case of success and other value otherwise.
*/
OCStackResult PMIsSubownerOfDevice(OCProvisionDev_t *device, bool *isSubowner);
#endif //MULTIPLE_OWNER
/**
......
......@@ -50,6 +50,7 @@ extern "C"
#define _12_DISCOV_OWN_DEVS_ 12
#ifdef MULTIPLE_OWNER
#define _13_MOT_DISCOV_DEV_ 13
#define _14_MOT_DISCOV_SINGLE_DEV_ 14
#endif //MULTIPLE_OWNER
#define _20_REGIST_DEVS_ 20
#define _30_PROVIS_PAIR_DEVS_ 30
......@@ -281,7 +282,7 @@ static void updateDoxmForMOTCB(void* ctx, int nOfRes, OCProvisionResult_t* arr,
}
#endif //MULTIPLE_OWNER
static void inputPinCB(char* pin, size_t len)
static void inputPinCB(OicUuid_t deviceId, char *pin, size_t len, void *context)
{
if(!pin || OXM_RANDOM_PIN_MIN_SIZE > len)
{
......@@ -342,7 +343,7 @@ static int initProvisionClient(void)
return -1;
}
SetInputPinCB(inputPinCB);
SetInputPinWithContextCB(inputPinCB, NULL);
return 0;
}
......@@ -361,7 +362,7 @@ static int discoverAllDevices(void)
g_unown_list = NULL;
}
// call |OCGetDevInfoFromNetwork| API actually
// call |OCGetDevInfoFromNetwork| API
printf(" Discovering All Un/Owned Devices on Network..\n");
if(OC_STACK_OK != OCGetDevInfoFromNetwork(DISCOVERY_TIMEOUT, &g_own_list, &g_unown_list))
{
......@@ -391,7 +392,7 @@ static int discoverUnownedDevices(void)
g_unown_list = NULL;
}
// call |OCDiscoverUnownedDevices| API actually
// call |OCDiscoverUnownedDevices| API
printf(" Discovering Only Unowned Devices on Network..\n");
if(OC_STACK_OK != OCDiscoverUnownedDevices(DISCOVERY_TIMEOUT, &g_unown_list))
{
......@@ -417,7 +418,7 @@ static int discoverOwnedDevices(void)
g_own_list = NULL;
}
// call |OCDiscoverOwnedDevices| API actually
// call |OCDiscoverOwnedDevices| API
printf(" Discovering Only Owned Devices on Network..\n");
if(OC_STACK_OK != OCDiscoverOwnedDevices(DISCOVERY_TIMEOUT, &g_own_list))
{
......@@ -444,7 +445,7 @@ static int discoverMOTEnabledDevices(void)
g_mot_enable_list = NULL;
}
// call |OCDiscoverOwnedDevices| API actually
// call |OCDiscoverOwnedDevices| API
printf(" Discovering Multiple Ownership Transfer Enabled Devices on Network..\n");
if(OC_STACK_OK != OCDiscoverMultipleOwnerEnabledDevices(DISCOVERY_TIMEOUT, &g_mot_enable_list))
{
......@@ -458,6 +459,50 @@ static int discoverMOTEnabledDevices(void)
return 0;
}
static int discoverSingleMOTEnabledDevice(void)
{
OicUuid_t uuid = { .id = { 0 } };
char strUuid[64] = { 0 };
// Delete owned device list before updating it
if (g_mot_enable_list)
{
OCDeleteDiscoveredDevices(g_mot_enable_list);
g_mot_enable_list = NULL;
}
// Get the device id
printf(" Specify the Multiple Ownership Transfer enabled device to discover on the network\n");
printf(" > Input the UUID : ");
for (int ret = 0; 1 != ret; )
{
ret = scanf("%64s", strUuid);
for (; 0x20 <= getchar(); ); // for removing overflow garbages
// '0x20<=code' is character region
}
OCStackResult rst = ConvertStrToUuid(strUuid, &uuid);
if (OC_STACK_OK != rst)
{
OIC_LOG_V(ERROR, TAG, "ConvertStrToUuid API error: %d", rst);
return -1;
}
// Call |OCDiscoverMultipleOwnerEnabledSingleDevice| API
printf(" Discovering the Multiple Ownership Transfer enabled device on the network..\n");
if (OC_STACK_OK != OCDiscoverMultipleOwnerEnabledSingleDevice(DISCOVERY_TIMEOUT, &uuid, &g_mot_enable_list))
{
OIC_LOG(ERROR, TAG, "OCDiscoverMultipleOwnerEnabledSingleDevice API error");
return -1;
}
// Display the discovered owned list
printf(" > Discovered Multiple Ownership Transfer Enabled Device\n");
g_mot_enable_cnt = printDevList(g_mot_enable_list);
return 0;
}
#endif //MULTIPLE_OWNER
static int registerDevices(void)
......@@ -470,7 +515,7 @@ static int registerDevices(void)
return 0; // normal case
}
// call |OCDoOwnershipTransfer| API actually
// call |OCDoOwnershipTransfer| API
// calling this API with callback actually acts like blocking
// for error checking, the return value saved and printed
g_doneCB = false;
......@@ -524,7 +569,7 @@ static int provisionPairwise(void)
}
}
// call |OCProvisionPairwiseDevices| API actually
// call |OCProvisionPairwiseDevices| API
// calling this API with callback actually acts like blocking
// for error checking, the return value saved and printed
g_doneCB = false;
......@@ -611,7 +656,7 @@ static int provisionCred(void)
}
// call |OCProvisionCredentials| API actually
// call |OCProvisionCredentials| API
// calling this API with callback actually acts like blocking
// for error checking, the return value saved and printed
g_doneCB = false;
......@@ -677,7 +722,7 @@ static int provisionAcl(void)
goto PVACL_ERROR;
}
// call |OCProvisionACL| API actually
// call |OCProvisionACL| API
// calling this API with callback actually acts like blocking
// for error checking, the return value saved and printed
g_doneCB = false;
......@@ -775,7 +820,7 @@ static int provisionDirectPairing(void)
goto PVDP_ERROR;
}
// call |OCProvisionDirectPairing| API actually
// call |OCProvisionDirectPairing| API
// calling this API with callback actually acts like blocking
// for error checking, the return value saved and printed
g_doneCB = false;
......@@ -837,7 +882,7 @@ static int checkLinkedStatus(void)
printf(" Entered Wrong Number. Please Enter Again\n");
}
// call |OCGetLinkedStatus| API actually
// call |OCGetLinkedStatus| API
printf(" Checking Selected Link Status on PRVN DB..\n");
OCUuidList_t* dvid_lst = NULL;
size_t dvid_cnt = 0;
......@@ -932,7 +977,7 @@ static int saveAcl(void)
goto SVACL_ERROR;
}
// call |OCSaveACL| API actually
// call |OCSaveACL| API
rst = OCSaveACL(acl);
if(OC_STACK_OK != rst)
{
......@@ -979,7 +1024,7 @@ static int getCred(void)
printf(" Entered Wrong Number. Please Enter Again\n");
}
// call |getDevInst| API actually
// call |getDevInst| API
// calling this API with callback actually acts like blocking
// for error checking, the return value saved and printed
g_doneCB = false;
......@@ -1038,7 +1083,7 @@ static int getAcl(void)
printf(" Entered Wrong Number. Please Enter Again\n");
}
// call |getDevInst| API actually
// call |getDevInst| API
// calling this API with callback actually acts like blocking
// for error checking, the return value saved and printed
g_doneCB = false;
......@@ -1088,7 +1133,7 @@ static int unlinkPairwise(void)
return -1;
}
// call |OCUnlinkDevices| API actually
// call |OCUnlinkDevices| API
// calling this API with callback actually acts like blocking
// for error checking, the return value saved and printed
g_doneCB = false;
......@@ -1144,7 +1189,7 @@ static int removeDevice(void)
printf(" Entered Wrong Number. Please Enter Again\n");
}
// call |OCRemoveDevice| API actually
// call |OCRemoveDevice| API
// calling this API with callback actually acts like blocking
// for error checking, the return value saved and printed
g_doneCB = false;
......@@ -2104,7 +2149,8 @@ static void printMenu(void)
printf("** 11. Discover Only Unowned Devices on Network\n");
#ifdef MULTIPLE_OWNER
printf("** 12. Discover Only Owned Devices on Network\n");
printf("** 13. Discover Multiple Ownership Transfer Enabled Devices on Network\n\n");
printf("** 13. Discover Multiple Ownership Transfer Enabled Devices on Network\n");
printf("** 14. Discover Specific Multiple Ownership Transfer Enabled Device on Network\n\n");
#else
printf("** 12. Discover Only Owned Devices on Network\n\n");
#endif //MULTIPLE_OWNER
......@@ -2240,6 +2286,12 @@ int main()
OIC_LOG(ERROR, TAG, "_13_MOT_DISCOV_DEV_: error");
}
break;
case _14_MOT_DISCOV_SINGLE_DEV_:
if (discoverSingleMOTEnabledDevice())
{
OIC_LOG(ERROR, TAG, "_14_MOT_DISCOV_SINGLE_DEV_: error");
}
break;
#endif //MULTIPLE_OWNER
case _20_REGIST_DEVS_:
if(registerDevices())
......
......@@ -447,7 +447,7 @@ FILE* server_fopen(const char *path, const char *mode)
return fopen(CRED_FILE, mode);
}
void GeneratePinCB(char* pin, size_t pinSize)
void DisplayPinCB(char *pin, size_t pinSize, void *context)
{
if(NULL == pin || pinSize <= 0)
{
......@@ -475,10 +475,10 @@ int main()
}
/**
* If server supported random pin based ownership transfer,
* callback of print PIN should be registered before runing server.
* If the server supports random pin based ownership transfer, the callback
* to display a PIN should be registered before running the server.
*/
SetGeneratePinCB(GeneratePinCB);
SetDisplayPinWithContextCB(DisplayPinCB, NULL);
/**
* Random PIN generation policy can be changed through SetRandomPinPolicy() API.
......
......@@ -169,6 +169,30 @@ OCStackResult OCDiscoverOwnedDevices(unsigned short timeout, OCProvisionDev_t **
}
#ifdef MULTIPLE_OWNER
/**
* The function is responsible for the discovery of an MOT-enabled device with the specified deviceID.
* The function will return when security information for device with deviceID has been obtained or the
* timeout has been exceeded.
*
* @param[in] timeoutSeconds Maximum time, in seconds, this function will listen for responses from
* servers before returning.
* @param[in] deviceID deviceID of target device.
* @param[out] ppFoundDevice OCProvisionDev_t of discovered device. Caller should use
* OCDeleteDiscoveredDevices to delete the device.
* @return OC_STACK_OK in case of success and other values otherwise.
*/
OCStackResult OCDiscoverMultipleOwnerEnabledSingleDevice(unsigned short timeoutSeconds,
const OicUuid_t* deviceID,
OCProvisionDev_t **ppFoundDevice)
{
if ((NULL == ppFoundDevice) || (NULL != *ppFoundDevice) || (0 == timeoutSeconds) || (NULL == deviceID))
{
return OC_STACK_INVALID_PARAM;
}
return PMMultipleOwnerSingleDeviceDiscovery(timeoutSeconds, deviceID, ppFoundDevice);
}
/**
* The function is responsible for discovery of MOT enabled device is current subnet.
*
......@@ -211,7 +235,6 @@ OCStackResult OCDiscoverMultipleOwnedDevices(unsigned short timeout, OCProvision
* @param[in] targetDeviceInfo Selected target device.
* @param[in] preconfigPin Preconfig PIN which is used while multiple owner authentication
* @param[in] preconfigPinLen Byte length of preconfigPin
*
* @return OC_STACK_OK in case of success and other value otherwise.
*/
OCStackResult OCAddPreconfigPin(const OCProvisionDev_t *targetDeviceInfo,
......@@ -237,6 +260,22 @@ OCStackResult OCDoMultipleOwnershipTransfer(void* ctx,
return MOTDoOwnershipTransfer(ctx, targetDevices, resultCallback);
}
/**
* The function is responsible for determining if the caller is a subowner of the specified device.
*
* @param[in] device MOT enabled device that contains a list of subowners
* @param[out] isSubowner Bool indicating whether the caller is a subowner of device
* @return OC_STACK_OK in case of success and other value otherwise.
*/
OCStackResult OCIsSubownerOfDevice(OCProvisionDev_t *device, bool *isSubowner)
{
if ((NULL == device) || (NULL == isSubowner))
{