1 /* ****************************************************************
3 * Copyright 2016 Samsung Electronics All Rights Reserved.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 ******************************************************************/
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
39 * This function discovers on a /oic/ping resource.
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.
53 * @return ::OC_STACK_OK on success, some other value upon failure.
55 OCStackResult OCFindKeepAliveResource(OCDoHandle *handle, const char *remoteAddr,
56 OCCallbackData *cbData);
59 * Send ping message to remote endpoint.
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.
74 * @return ::OC_STACK_OK on success, some other value upon failure.
76 OCStackResult OCSendKeepAliveRequest(OCDoHandle *handle, const char *remoteAddr,
77 OCPayload *payload, OCCallbackData *cbData);
84 #endif // KEEP_ALIVE_H_