CAResult_t CAIPSetNetworkMonitorCallback(CAIPAdapterStateChangeCallback callback,
CATransportAdapter_t adapter)
{
- return CAIPSetNetworkMonitorCallbackInternal(callback, adapter, g_adapterCallbackList);
+ return CAIPSetNetworkMonitorCallbackInternal(callback, adapter, &g_adapterCallbackList);
}
CAResult_t CAIPUnSetNetworkMonitorCallback(CATransportAdapter_t adapter)
{
- return CAIPUnSetNetworkMonitorCallbackInternal(adapter, g_adapterCallbackList);
+ return CAIPUnSetNetworkMonitorCallbackInternal(adapter, &g_adapterCallbackList);
}
u_arraylist_t *CAFindInterfaceChange()
}
CAResult_t CAIPSetNetworkMonitorCallbackInternal(CAIPAdapterStateChangeCallback callback,
- CATransportAdapter_t adapter, CAIPCBData_t *adapterCallbackList)
+ CATransportAdapter_t adapter, CAIPCBData_t **adapterCallbackList)
{
if (!callback)
{
}
CAIPCBData_t *cbitem = NULL;
- LL_FOREACH(adapterCallbackList, cbitem)
+ CAIPCBData_t *list = *adapterCallbackList;
+ LL_FOREACH(list, cbitem)
{
if (cbitem && adapter == cbitem->adapter && callback == cbitem->callback)
{
cbitem->adapter = adapter;
cbitem->callback = callback;
- LL_APPEND(adapterCallbackList, cbitem);
+ LL_APPEND(list, cbitem);
+ *adapterCallbackList = list;
return CA_STATUS_OK;
}
CAResult_t CAIPUnSetNetworkMonitorCallbackInternal(CATransportAdapter_t adapter,
- CAIPCBData_t *adapterCallbackList)
+ CAIPCBData_t **adapterCallbackList)
{
CAIPCBData_t *cbitem = NULL;
CAIPCBData_t *tmpCbitem = NULL;
- LL_FOREACH_SAFE(adapterCallbackList, cbitem, tmpCbitem)
+ CAIPCBData_t *list = *adapterCallbackList;
+ LL_FOREACH_SAFE(list, cbitem, tmpCbitem)
{
if (cbitem && adapter == cbitem->adapter)
{
OIC_LOG(DEBUG, TAG, "remove specific callback");
- LL_DELETE(adapterCallbackList, cbitem);
+ LL_DELETE(list, cbitem);
+ *adapterCallbackList = list;
OICFree(cbitem);
return CA_STATUS_OK;
}
CAIPCBData_t *adapterCallbackList, CAIPAdapterPlatform_t platform);
CAResult_t CAIPSetNetworkMonitorCallbackInternal(CAIPAdapterStateChangeCallback callback,
- CATransportAdapter_t adapter, CAIPCBData_t *adapterCallbackList);
+ CATransportAdapter_t adapter, CAIPCBData_t **adapterCallbackList);
CAResult_t CAIPUnSetNetworkMonitorCallbackInternal(CATransportAdapter_t adapter,
- CAIPCBData_t *adapterCallbackList);
+ CAIPCBData_t **adapterCallbackList);
#ifdef __cplusplus
}
CAResult_t CAIPSetNetworkMonitorCallback(CAIPAdapterStateChangeCallback callback,
CATransportAdapter_t adapter)
{
- return CAIPSetNetworkMonitorCallbackInternal(callback, adapter, g_adapterCallbackList);
+ return CAIPSetNetworkMonitorCallbackInternal(callback, adapter, &g_adapterCallbackList);
}
CAResult_t CAIPUnSetNetworkMonitorCallback(CATransportAdapter_t adapter)
{
- return CAIPUnSetNetworkMonitorCallbackInternal(adapter, g_adapterCallbackList);
+ return CAIPUnSetNetworkMonitorCallbackInternal(adapter, &g_adapterCallbackList);
}
static CAInterface_t *CANewInterfaceItem(int index, const char *name, int family,
CAResult_t CAIPSetNetworkMonitorCallback(CAIPAdapterStateChangeCallback callback,
CATransportAdapter_t adapter)
{
- return CAIPSetNetworkMonitorCallbackInternal(callback, adapter, g_adapterCallbackList);
+ return CAIPSetNetworkMonitorCallbackInternal(callback, adapter, &g_adapterCallbackList);
}
CAResult_t CAIPUnSetNetworkMonitorCallback(CATransportAdapter_t adapter)
{
- return CAIPUnSetNetworkMonitorCallbackInternal(adapter, g_adapterCallbackList);
+ return CAIPUnSetNetworkMonitorCallbackInternal(adapter, &g_adapterCallbackList);
}
u_arraylist_t *CAFindInterfaceChange()