replace : iotivity -> iotivity-sec
[platform/upstream/iotivity.git] / resource / csdk / stack / include / oickeepalive.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 /**
22  * @file
23  * This file contains the APIs for KeepAlive Mechanism.
24  * In order to ensure that the connection between an OIC Devices,
25  * when using CoAP over TCP, OIC Device should send application layer
26  * KeepAlive messages.
27  */
28 #ifndef KEEP_ALIVE_H_
29 #define KEEP_ALIVE_H_
30
31 #include "octypes.h"
32
33 #ifdef __cplusplus
34 extern "C"
35 {
36 #endif
37
38 /**
39  * This function discovers on a /oic/ping resource.
40  *
41  * @param handle            To refer to the request sent out on behalf of
42  *                          calling this API. This handle can be used to cancel this operation
43  *                          via the OCCancel API.
44  *                          @note: This reference is handled internally, and should not be free'd by
45  *                          the consumer.  A NULL handle is permitted in the event where the caller
46  *                          has no use for the return value.
47  * @param remoteAddr        The target device address to discovery a resource.
48  * @param cbData            Asynchronous callback function that is invoked by the stack when
49  *                          discovery or resource interaction is received. The discovery could be
50  *                          related to filtered/scoped/particular resource. The callback is
51  *                          generated for each response received.
52  *
53  * @return ::OC_STACK_OK on success, some other value upon failure.
54  */
55 OCStackResult OCFindKeepAliveResource(OCDoHandle *handle, const char *remoteAddr,
56                                       OCCallbackData *cbData);
57
58 /**
59  * Send ping message to remote endpoint.
60  *
61  * @param handle            To refer to the request sent out on behalf of
62  *                          calling this API. This handle can be used to cancel this operation
63  *                          via the OCCancel API.
64  *                          @note: This reference is handled internally, and should not be free'd by
65  *                          the consumer.  A NULL handle is permitted in the event where the caller
66  *                          has no use for the return value.
67  * @param remoteAddr        The target device address to discovery a resource.
68  * @param payload           Encoded request payload.
69  * @param cbData            Asynchronous callback function that is invoked by the stack when
70  *                          discovery or resource interaction is received. The discovery could be
71  *                          related to filtered/scoped/particular resource. The callback is
72  *                          generated for each response received.
73  *
74  * @return ::OC_STACK_OK on success, some other value upon failure.
75  */
76 OCStackResult OCSendKeepAliveRequest(OCDoHandle *handle, const char *remoteAddr,
77                                      OCPayload *payload, OCCallbackData *cbData);
78
79
80 #ifdef __cplusplus
81 } // extern "C"
82 #endif
83
84 #endif // KEEP_ALIVE_H_