merge master code to build iotivity
[platform/upstream/iotivity.git] / resource / csdk / security / provisioning / include / pmtypes.h
1 /* *****************************************************************
2  *
3  * Copyright 2015 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 OC_PROVISIONING_TYPES_H
22 #define OC_PROVISIONING_TYPES_H
23
24 #include <stdbool.h>
25 #include "securevirtualresourcetypes.h"
26
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30
31 /**
32  * Device Information of discoverd unowned/owned device(s) for provisioning.
33  */
34 typedef struct OCProvisionDev
35 {
36     OCDevAddr       endpoint;        /**< target address **/
37     OicSecPstat_t   *pstat;          /**< Pointer to target's pstat resource. **/
38     OicSecDoxm_t    *doxm;           /**< Pointer to target's doxm resource. **/
39     uint16_t        securePort;      /**< secure port **/
40     struct OCProvisionDev  *next;           /**< Next pointer. **/
41 }OCProvisionDev_t;
42
43 /**
44  * Result information for each target device.
45  */
46 typedef struct OCPMResult{
47     OicUuid_t      deviceId;
48     OCStackResult  res;
49 }OCProvisionResult_t;
50
51 /**
52  * Callback function definition of provisioning API
53  *
54  * @param[OUT] ctx - If user set his/her context, it will be returned here.
55  * @param[OUT] nOfRes - total number of results, it depends on using which provisioning API.
56  * @param[OUT] arr - Array of OCPMResult_t, each OCPMResult_t contains result for target Device.
57  * @param[OUT} hasError - If there is no error, it's returned with 'false' but if there is a single
58  *                        or more error is/are occured during operation, it will be 'true'.
59  */
60 typedef void (*OCProvisionResultCB)(void* ctx, int nOfRes, OCProvisionResult_t *arr, bool hasError);
61
62 #ifdef __cplusplus
63 }
64 #endif
65
66 #endif //OC_PROVISIONING_TYPES_H