replace : iotivity -> iotivity-sec
[platform/upstream/iotivity.git] / resource / csdk / security / provisioning / include / internal / otmcontextlist.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_CONTEXT_LIST_H_
22 #define _OTM_CONTEXT_LIST_H_
23
24 #include "pmtypes.h"
25 #include "ocstack.h"
26 #include "octypes.h"
27 #include "securevirtualresourcetypes.h"
28 #include "ownershiptransfermanager.h"
29
30 #ifdef __cplusplus
31 extern "C" {
32 #endif // __cplusplus
33
34 typedef struct OTMContextItem {
35     OTMContext_t* otmCtx;
36     OCDevAddr endpoint;
37     struct OTMContextItem* next;
38 }OTMContextItem_t;
39
40 /**
41  * API to remove OTMContext from OTMContext list.
42  *
43  * @param[in] addr IP address of peer
44  * @param[in] port secure port number of peer
45  */
46 void RemoveOTMContext(const char* addr, uint16_t port);
47
48 /**
49  * API to add OTMContext to OTMContext list.
50  * If same OTMContext exist, will be ignored.
51  *
52  * @param[in] ctx new OTMContext
53  * @param[in] addr IP address of peer
54  * @param[in] port secure port number of peer
55  *
56  * @return OC_STACK_OK in case of success and other value otherwise.
57  */
58 OCStackResult AddOTMContext(OTMContext_t* ctx, const char* addr, uint16_t port);
59
60 /**
61  * API to read OTMContext from OTMContext list
62  *
63  * @param[in] addr IP address of peer
64  * @param[in] port secure port number of peer
65  *
66  * @return OTMContext in case of context found, otherwise NULL.
67  */
68 OTMContext_t* GetOTMContext(const char* addr, uint16_t port);
69
70
71 /**
72  * API to delete all OTM context from list.
73  * NOTE : This API should be invoked after OCStop API.
74  */
75 void DeleteOTMContextList();
76
77 #ifdef __cplusplus
78 }
79 #endif //__cplusplus
80
81 #endif //_OTM_CONTEXT_LIST_H_