1 //******************************************************************
3 // Copyright 2014 Intel Corporation All Rights Reserved.
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
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 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
26 #include <occoaptoken.h>
28 typedef struct ClientCB {
29 // callback method defined in application address space
30 OCClientResponseHandler callBack;
31 // callback context data
33 // when a response is recvd with this token, above callback will be invoked
35 // Invocation handle tied to original call to OCDoResource()
37 // This is used to determine if all responses should be consumed or not. (For now, only pertains to OC_REST_OBSERVE_ALL Vs. OC_REST_OBSERVE functionality)
39 // This is the sequence identifier the server applies to the invocation tied to 'handle'.
40 uint32_t sequenceNumber;
41 // next node in this list
42 struct ClientCB *next;
45 //-- AddClientCB -----------------------------------------------------------
48 * This method is used to add a client callback method in cbList.
50 * @param[out] clientCB
51 * The resulting node from making this call. Null if out of memory.
53 * address to client callback function.
55 * identifier for OTA CoAP comms.
57 * Masked in the public API as an 'invocation handle' - Used for callback management.
59 * @brief If the handle you're looking for does not exist, the stack will reply with a RST message.
61 * @retval OC_STACK_OK for Success, otherwise some error value
63 //------------------------------------------------------------------------
64 OCStackResult AddClientCB(ClientCB** clientCB, OCCallbackData *cbData, OCCoAPToken * token, OCDoHandle handle, OCMethod method);
66 //-- DeleteClientCB -----------------------------------------------------------
69 * This method is used to remove a callback node from cbList.
72 * address to client callback node.
74 //------------------------------------------------------------------------
75 void DeleteClientCB(ClientCB *cbNode);
78 //-- GetClientCB -----------------------------------------------------------
81 * This method is used to search a cb node in cbList.
84 * token to search for.
86 * handle to search for.
88 * @brief You can search by token OR by handle. Not both.
90 * @retval address of the node if found, otherwise NULL
92 //------------------------------------------------------------------------
93 ClientCB* GetClientCB(OCCoAPToken * token, OCDoHandle * handle);
95 //-- DeleteClientCBList -----------------------------------------------------------
98 * This method is used to clear the cbList.
101 //------------------------------------------------------------------------
102 void DeleteClientCBList();
104 #endif //OC_CLIENT_CB