X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=resource%2Fcsdk%2Fsecurity%2Fprovisioning%2Finclude%2Focprovisioningmanager.h;h=b76512ccaa830371dac40cbcbaab201c0168a4af;hb=8229635f6d207516ccbbdf23b13be164e0fc1787;hp=cbf01ce676d2cb2e4dd4cd911aa7711be44c3f76;hpb=80b29f4c381165b2b48800577aaa09a3642c50e6;p=platform%2Fupstream%2Fiotivity.git diff --git a/resource/csdk/security/provisioning/include/ocprovisioningmanager.h b/resource/csdk/security/provisioning/include/ocprovisioningmanager.h index cbf01ce..b76512c 100644 --- a/resource/csdk/security/provisioning/include/ocprovisioningmanager.h +++ b/resource/csdk/security/provisioning/include/ocprovisioningmanager.h @@ -23,7 +23,11 @@ #include "octypes.h" #include "pmtypes.h" +#include "casecurityinterface.h" #include "ownershiptransfermanager.h" +#ifdef MULTIPLE_OWNER +#include "securevirtualresourcetypes.h" +#endif //MULTIPLE_OWNER #ifdef __cplusplus extern "C" { @@ -42,18 +46,47 @@ extern "C" { OCStackResult OCInitPM(const char* dbPath); /** - * The function is responsible for discovery of owned/unowned device is specified endpoint. - * It will return when found one or more device even though timeout is not exceeded + * API to termiante the provisioning manager + */ +void OCTerminatePM(); + +/** + * API to cleanup PDM in case of timeout. + * It will remove the PDM_DEVICE_INIT state devices from PDM. + * + * @return OC_STACK_OK in case of success and other value otherwise. + */ +OCStackResult OCPDMCleanupForTimeout(); + +/** + * The function is responsible for discovery of owned/unowned device is specified endpoint/deviceID. + * 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 list of devices. - * @param[in] host address of target endpoint - * @param[in] connType connectivity type of endpoint - * @param[out] ppList List of device. + * server before returning the device. + * @param[in] deviceID deviceID of target device. + * @param[out] ppFoundDevice OCProvisionDev_t of found device + * @return OTM_SUCCESS in case of success and other value otherwise. + */ +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 OCDiscoverSecureResource(unsigned short timeout, const char* host, - OCConnectivityType connType, OCProvisionDev_t **ppList); +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 @@ -80,6 +113,60 @@ OCStackResult OCDoOwnershipTransfer(void* ctx, OCProvisionResultCB resultCallback); /** + * API to set a allow status of OxM + * + * @param[in] oxm Owership transfer method (ref. OicSecOxm_t) + * @param[in] allowStatus allow status (true = allow, false = not allow) + * + * @return OC_STACK_OK in case of success and other value otherwise. + */ +OCStackResult OCSetOxmAllowStatus(const OicSecOxm_t oxm, const bool allowStatus); + + +#ifdef MULTIPLE_OWNER +/** + * API to perfrom multiple ownership transfer for MOT enabled device. + * + * @param[in] ctx Application context would be returned in result callback + * @param[in] targetDevices List of devices to perform ownership transfer. + * @param[in] resultCallback Result callback function to be invoked when ownership transfer finished. + * @return OC_STACK_OK in case of success and other value otherwise. + */ +OCStackResult OCDoMultipleOwnershipTransfer(void* ctx, + OCProvisionDev_t *targetDevices, + OCProvisionResultCB resultCallback); + +/** + * API to remove sub-owner from resource server + * + * @param[in] ctx Application context would be returned in result callback + * @param[in] targetDeviceInfo Selected target device. + * @param[in] subOwner sub-owner UUID to be removed + * @param[in] resultCallback callback provided by API user, callback will be invoked when + * DELETE 'subowneruuid' request recieves a response from resource server. + * @return OC_STACK_OK in case of success and other value otherwise. + */ +OCStackResult OCRemoveSubOwner(void* ctx, + const OCProvisionDev_t *targetDeviceInfo, + const OicUuid_t* subOwner, + OCProvisionResultCB resultCallback); + +/** + * API to remove all sub-owner from resource server + * + * @param[in] ctx Application context would be returned in result callback + * @param[in] targetDeviceInfo Selected target device. + * @param[in] resultCallback callback provided by API user, callback will be invoked when + * DELETE 'subowneruuid' request recieves a response from resource server. + * @return OC_STACK_OK in case of success and other value otherwise. + */ +OCStackResult OCRemoveAllSubOwner(void* ctx, + const OCProvisionDev_t *targetDeviceInfo, + OCProvisionResultCB resultCallback); + +#endif //MULTIPLE_OWNER + +/** * API to register for particular OxM. * * @param[in] Ownership transfer method. @@ -99,6 +186,28 @@ OCStackResult OCSetOwnerTransferCallbackData(OicSecOxm_t oxm, OTMCallbackData_t* */ OCStackResult OCDiscoverOwnedDevices(unsigned short timeout, OCProvisionDev_t **ppList); +#ifdef MULTIPLE_OWNER +/** + * The function is responsible for discovery of MOT enabled device is current subnet. + * + * @param[in] timeout Timeout in seconds, value till which function will listen to responses from + * server before returning the list of devices. + * @param[out] ppList List of MOT enabled devices. + * @return OC_STACK_OK in case of success and other value otherwise. + */ +OCStackResult OCDiscoverMultipleOwnerEnabledDevices(unsigned short timeout, OCProvisionDev_t **ppList); + +/** + * The function is responsible for discovery of Multiple Owned device is current subnet. + * + * @param[in] timeout Timeout in seconds, value till which function will listen to responses from + * server before returning the list of devices. + * @param[out] ppList List of Multiple Owned devices. + * @return OC_STACK_OK in case of success and other value otherwise. + */ +OCStackResult OCDiscoverMultipleOwnedDevices(unsigned short timeout, OCProvisionDev_t **ppList); +#endif //MULTIPLE_OWNER + /** * API to provision credentials between two devices and ACLs for the devices who act as a server. * @@ -131,6 +240,14 @@ OCStackResult OCProvisionACL(void *ctx, const OCProvisionDev_t *selectedDeviceIn OCProvisionResultCB resultCallback); /** + * function to save ACL which has several ACE into Acl of SVR. + * + * @param acl ACL to be saved in Acl of SVR. + * @return OC_STACK_OK in case of success and other value otherwise. + */ +OCStackResult OCSaveACL(const OicSecAcl_t* acl); + +/** * this function requests CRED information to resource. * * @param[in] ctx Application context would be returned in result callback. @@ -183,6 +300,64 @@ OCStackResult OCProvisionCredentials(void *ctx, OicSecCredType_t type, size_t ke const OCProvisionDev_t *pDev2, OCProvisionResultCB resultCallback); +#ifdef MULTIPLE_OWNER +/** + * API to provision preconfigured PIN to device(NOT LIST). + * If device does not support the Preconfigured PIN OxM, + * OCProvisionPreconfigPin API will update the device's Doxm + * and then try preconfigured PIN provisioning once again. + * + * @param[in] ctx Application context would be returned in result callback. + * @param[in] targetDeviceInfo Selected target device. + * @param[in] preconfigPin string of preconfigured PIN. + * @param[in] preconfigPinLen string length of 'preconfigPin'. + * @param[in] resultCallback callback provided by API user, callback will be called when + * provisioning request recieves a response from first resource server. + * @return OC_STACK_OK in case of success and other value otherwise. + */ +OCStackResult OCProvisionPreconfigPin(void *ctx, + OCProvisionDev_t *targetDeviceInfo, + const char *preconfigPin, + size_t preconfigPinLen, + OCProvisionResultCB resultCallback); + +/** + * API to add preconfigured PIN to local SVR DB. + * + * @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, + const char *preconfigPin, + size_t preconfigPinLen); + +/** + * API to update 'doxm.mom' to resource server. + * + * @param[in] targetDeviceInfo Selected target device. + * @param[in] momType Mode of multiple ownership transfer (ref. oic.sec.mom) + * @param[in] resultCallback callback provided by API user, callback will be called when + * POST 'mom' request recieves a response from resource server. + * @return OC_STACK_OK in case of success and other value otherwise. + */ +OCStackResult OCChangeMOTMode(void *ctx, const OCProvisionDev_t *targetDeviceInfo, + const OicSecMomType_t momType, OCProvisionResultCB resultCallback); + +/** + * API to update 'doxm.oxmsel' to resource server. + * + * @param[in] targetDeviceInfo Selected target device. + * @param[in] oxmSelValue Method of multiple ownership transfer (ref. oic.sec.oxm) + * @param[in] resultCallback callback provided by API user, callback will be called when + * POST 'oxmsel' request recieves a response from resource server. + * @return OC_STACK_OK in case of success and other value otherwise. + */ +OCStackResult OCSelectMOTMethod(void *ctx, const OCProvisionDev_t *targetDeviceInfo, + const OicSecOxm_t oxmSelValue, OCProvisionResultCB resultCallback); +#endif //MULTIPLE_OWNER + /** * Function to unlink devices. * This function will remove the credential & relasionship between the two devices. @@ -249,6 +424,20 @@ OCStackResult OCResetDevice(void* ctx, unsigned short waitTimeForOwnedDeviceDisc OCProvisionResultCB resultCallback); /** + * This function resets SVR DB to its factory setting. + * + *@return OC_STACK_OK in case of successful reset and other value otherwise. + */ +OCStackResult OCResetSVRDB(void); + +/** + * This function configures SVR DB as self-ownership. + * + *@return OC_STACK_OK in case of successful configue and other value otherwise. + */ +OCStackResult OCConfigSelfOwnership(void); + +/** * API to get status of all the devices in current subnet. The status include endpoint information * and doxm information which can be extracted duing owned and unowned discovery. Along with this * information. The API will provide information about devices' status @@ -310,19 +499,6 @@ void OCDeletePdAclList(OicSecPdAcl_t* pPdAcl); #if defined(__WITH_DTLS__) || defined(__WITH_TLS__) /** - * this function sends CRL information to resource. - * - * @param[in] ctx Application context would be returned in result callback. - * @param[in] selectedDeviceInfo Selected target device. - * @param[in] crl CRL to provision. - * @param[in] resultCallback callback provided by API user, callback will be called when provisioning - request recieves a response from resource server. - * @return OC_STACK_OK in case of success and other value otherwise. - */ -OCStackResult OCProvisionCRL(void* ctx, const OCProvisionDev_t *selectedDeviceInfo, OicSecCrl_t *crl, - OCProvisionResultCB resultCallback); - -/** * function to provision Trust certificate chain to devices. * * @param[in] ctx Application context would be returned in result callback. @@ -347,6 +523,46 @@ OCStackResult OCProvisionTrustCertChain(void *ctx, OicSecCredType_t type, uint16 */ OCStackResult OCSaveTrustCertChain(uint8_t *trustCertChain, size_t chainSize, OicEncodingType_t encodingType, uint16_t *credId); +/** + * function to register callback, for getting notification for TrustCertChain change. + * + * @param[in] TrustCertChainChangeCB notifier callback function + * @return OC_STACK_OK in case of success and other value otherwise. + */ +OCStackResult OCRegisterTrustCertChainNotifier(void *cb, TrustCertChainChangeCB CB); + +/** + * function to de-register TrustCertChain notification callback. + */ +void OCRemoveTrustCertChainNotifier(void); + +/* + * Function to read Trust certificate chain from SVR. + * Caller must free when done using the returned trust certificate + * @param[in] credId CredId of trust certificate chain in SVR. + * @param[out] trustCertChain Trust certificate chain. + * @param[out] chainSize Size of trust certificate chain + * @return OC_STACK_OK in case of success and other value otherwise. + */ +OCStackResult OCReadTrustCertChain(uint16_t credId, uint8_t **trustCertChain, + size_t *chainSize); + +/** + * Function to select appropriate security provisioning method. + * + * @param[in] supportedMethods Array of supported methods + * @param[in] numberOfMethods number of supported methods + * @param[out] selectedMethod Selected methods + * @param[in] ownerType type of owner device (SUPER_OWNER or SUB_OWNER) + * @return OC_STACK_OK on success + */ +OCStackResult OCSelectOwnershipTransferMethod(const OicSecOxm_t *supportedMethods, + size_t numberOfMethods, OicSecOxm_t *selectedMethod, OwnerType_t ownerType); + +/** + * This function sets the callback to utilize peer certificate information + */ +OCStackResult OCSetPeerCertCallback(void *ctx, PeerCertCallback peerCertCallback); #endif // __WITH_DTLS__ || __WITH_TLS__