Imported Upstream version 1.2.0
[platform/upstream/iotivity.git] / resource / csdk / security / provisioning / include / internal / multipleownershiptransfermanager.h
1 /* *****************************************************************
2  *
3  * Copyright 2016 Samsung Electronics All Rights Reserved.
4  *
5  *
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *     http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  * *****************************************************************/
20
21 #ifndef OTM_MULTIPLE_OWNERSHIPTRANSFERMANAGER_H_
22 #define OTM_MULTIPLE_OWNERSHIPTRANSFERMANAGER_H_
23
24 #include "pmtypes.h"
25 #include "ocstack.h"
26 #include "octypes.h"
27 #include "securevirtualresourcetypes.h"
28
29 #ifdef __cplusplus
30 extern "C" {
31 #endif // __cplusplus
32
33 /**********************************************************************
34  * API for Super Owner
35  **********************************************************************/
36
37 /**
38  * API to add 'doxm.oxms' to resource server.
39  *
40  * @param[in] targetDeviceInfo Selected target device.
41  * @param[in] newOxm  OxMs to be added (ref. oic.sec.oxm)
42  * @param[in] resultCallback callback provided by API user, callback will be called when
43  *            POST 'oxms' request recieves a response from resource server.
44  * @return OC_STACK_OK in case of success and other value otherwise.
45  */
46 OCStackResult MOTAddMOTMethod(void *ctx, OCProvisionDev_t *targetDeviceInfo,
47                                  const OicSecOxm_t newOxm, OCProvisionResultCB resultCallback);
48
49 /**
50  * API to update 'doxm.oxmsel' to resource server.
51  *
52  * @param[in] targetDeviceInfo Selected target device.
53  * @param[in] oxmSelValue Method of multiple ownership transfer (ref. oic.sec.oxm)
54  * @param[in] resultCallback callback provided by API user, callback will be called when
55  *            POST 'oxmsel' request recieves a response from resource server.
56  * @return OC_STACK_OK in case of success and other value otherwise.
57  */
58 OCStackResult MOTSelectMOTMethod(void *ctx, const OCProvisionDev_t *targetDeviceInfo,
59         const OicSecOxm_t oxmSelValue, OCProvisionResultCB resultCallback);
60
61 /**
62  * API to update 'doxm.mom' to resource server.
63  *
64  * @param[in] targetDeviceInfo Selected target device.
65  * @param[in] momType Mode of multiple ownership transfer (ref. oic.sec.mom)
66  * @param[in] resultCallback callback provided by API user, callback will be called when
67  *            POST 'mom' request recieves a response from resource server.
68  * @return OC_STACK_OK in case of success and other value otherwise.
69  */
70 OCStackResult MOTChangeMode(void *ctx, const OCProvisionDev_t *targetDeviceInfo,
71         const OicSecMomType_t momType, OCProvisionResultCB resultCallback);
72
73 /**
74  * API to provision preconfigured PIN to resource server.
75  *
76  * @param[in] targetDeviceInfo Selected target device.
77  * @param[in] preconfPIN Preconfig PIN which is used while multiple owner authentication
78  * @param[in] preconfPINLen Byte length of preconfig PIN
79  * @param[in] resultCallback callback provided by API user, callback will be called when
80  *            POST credential request recieves a response from resource server.
81  * @return OC_STACK_OK in case of success and other value otherwise.
82  */
83 OCStackResult MOTProvisionPreconfigPIN(void *ctx, const OCProvisionDev_t *targetDeviceInfo,
84                                  const char* preconfPIN, size_t preconfPINLen, OCProvisionResultCB resultCallback);
85
86 /**********************************************************************
87  * API for Sub Owner
88  **********************************************************************/
89
90 /**
91  * API to perform the multiple ownership transfer.
92  *
93  * @param[in] ctx Application context would be returned in result callback
94  * @param[in] selectedDeviceList linked list of multiple ownership transfer candidate devices.
95  * @param[in] resultCB Result callback function to be invoked when multiple ownership transfer finished.
96  * @return OC_STACK_OK in case of success and other value otherwise.
97  */
98 OCStackResult MOTDoOwnershipTransfer(void* ctx,
99                                      OCProvisionDev_t *selectedDevicelist,
100                                      OCProvisionResultCB resultCallback);
101
102
103 /**
104  * API to add preconfigured PIN to local SVR DB.
105  *
106  * @param[in] targetDeviceInfo Selected target device.
107  * @param[in] preconfPIN Preconfig PIN which is used while multiple owner authentication
108  * @param[in] preconfPINLen Byte length of preconfig PIN
109  * @return OC_STACK_OK in case of success and other value otherwise.
110  */
111 OCStackResult MOTAddPreconfigPIN(const OCProvisionDev_t *targetDeviceInfo,
112                                  const char* preconfPIN, size_t preconfPINLen);
113
114 #ifdef __cplusplus
115 }
116 #endif
117 #endif //OTM_MULTIPLE_OWNERSHIPTRANSFERMANAGER_H_