1 //******************************************************************
3 // Copyright 2014 Intel Corporation All Rights Reserved.
4 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
7 #include "occlientcb.h"
13 #define MOD_NAME PCF("occlientcb")
15 static struct ClientCB *cbList = NULL;
17 int AddClientCB(OCCallbackData* cbData, OCToken * token) {
19 cbNode = (ClientCB*)malloc(sizeof(ClientCB));
21 cbNode->callBack = cbData->cb;
22 cbNode->context = cbData->context;
23 cbNode->token = token;
24 LL_APPEND(cbList, cbNode);
27 return OC_STACK_NO_MEMORY;
30 void DeleteClientCB(ClientCB * cbNode) {
31 LL_DELETE(cbList, cbNode);
36 ClientCB* GetClientCB(OCToken *token) {
38 LL_FOREACH(cbList, out) {
39 if((out->token->tokenLength == token->tokenLength) && (memcmp(out->token->token, token->token, token->tokenLength) == 0) ) {
43 OC_LOG(INFO, MOD_NAME, PCF("Callback Not found !!"));
48 void DeleteClientCBList() {
51 LL_FOREACH_SAFE(cbList, out, tmp) {