当前位置: 首页>>代码示例>>C++>>正文


C++ OICFree函数代码示例

本文整理汇总了C++中OICFree函数的典型用法代码示例。如果您正苦于以下问题:C++ OICFree函数的具体用法?C++ OICFree怎么用?C++ OICFree使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了OICFree函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: OICCalloc

ProvisioningInfo *PrepareProvisioingStatusCB(OCClientResponse *clientResponse,
                                             ProvStatus provStatus) {

    ProvisioningInfo *provInfo = (ProvisioningInfo *) OICCalloc(1, sizeof(ProvisioningInfo));

    if (provInfo == NULL) {
        OIC_LOG_V(ERROR, ES_PROV_TAG, "Failed to allocate memory");
        return NULL;
    }

    OCDevAddr *devAddr = (OCDevAddr *) OICCalloc(1, sizeof(OCDevAddr));

    if (devAddr == NULL) {
        OIC_LOG_V(ERROR, ES_PROV_TAG, "Failed to allocate memory");
        OICFree(provInfo);
        return NULL;
    }

    OICStrcpy(devAddr->addr, sizeof(devAddr->addr), clientResponse->addr->addr);

    devAddr->port = clientResponse->addr->port;

    provInfo->provDeviceInfo.addr = devAddr;

    provInfo->provStatus = provStatus;

    return provInfo;
}
开发者ID:KonexyIoT,项目名称:iotivity,代码行数:28,代码来源:provisioning.cpp

示例2: CASendMulticastData

CAResult_t CASendMulticastData(const CAEndpoint_t *endpoint, const void *data, uint32_t length)
{
    u_arraylist_t *list = CAGetSelectedNetworkList();
    if (!list)
    {
        OIC_LOG(DEBUG, TAG, "No selected network");
        return CA_SEND_FAILED;
    }

    CATransportFlags_t requestedAdapter = endpoint->adapter ? endpoint->adapter : CA_ALL_ADAPTERS;
    size_t selectedLength = u_arraylist_length(list);
    for (size_t i = 0; i < selectedLength; i++)
    {
        void* ptrType = u_arraylist_get(list, i);

        if(ptrType == NULL)
        {
            continue;
        }

        CATransportAdapter_t connType = *(CATransportAdapter_t *)ptrType;
        if ((connType & requestedAdapter) == 0)
        {
            continue;
        }

        int index = CAGetAdapterIndex(connType);
        if (0 > index)
        {
            OIC_LOG(DEBUG, TAG, "unknown connectivity type!");
            continue;
        }

        uint32_t sentDataLen = 0;

        if (g_adapterHandler[index].sendDataToAll != NULL)
        {
            void *payload = (void *) OICMalloc(length);
            if (!payload)
            {
                OIC_LOG(ERROR, TAG, "Out of memory!");
                return CA_MEMORY_ALLOC_FAILED;
            }
            memcpy(payload, data, length);
            sentDataLen = g_adapterHandler[index].sendDataToAll(endpoint, payload, length);
            OICFree(payload);
        }

        if (sentDataLen != length)
        {
            OIC_LOG(ERROR, TAG, "sendDataToAll failed! Error will be reported from adapter");
#ifdef SINGLE_THREAD
            //in case of single thread, no error handler. Report error immediately
            return CA_SEND_FAILED;
#endif
        }
    }

    return CA_STATUS_OK;
}
开发者ID:KonexyIoT,项目名称:iotivity,代码行数:60,代码来源:cainterfacecontroller.c

示例3: OCFreeLinksResource

void OCFreeLinksResource(OCLinksPayload *payload)
{
    if (!payload)
    {
        return;
    }
    OICFree(payload->href);
    OCFreeOCStringLL(payload->rt);
    OCFreeOCStringLL(payload->itf);
    OICFree(payload->rel);
    OICFree(payload->title);
    OICFree(payload->uri);
    OCFreeOCStringLL(payload->mt);
    OCFreeLinksResource(payload->next);
    OICFree(payload);
}
开发者ID:TianyouLi,项目名称:iotivity,代码行数:16,代码来源:rdpayload.c

示例4: OCFreeLinksResource

void OCFreeLinksResource(OCLinksPayload *links)
{
    if (!links)
    {
        return;
    }
    OICFree(links->href);
    OICFree(links->rel);
    OCFreeOCStringLL(links->rt);
    OCFreeOCStringLL(links->itf);
    OICFree(links->title);
    OICFree(links->anchor);
    OCFreeOCStringLL(links->type);
    OCFreeLinksResource(links->next);
    OICFree(links);
}
开发者ID:alexgg,项目名称:iotivity,代码行数:16,代码来源:rdpayload.c

示例5: u_linklist_free

CAResult_t u_linklist_free(u_linklist_t **linklist)
{
    VERIFY_NON_NULL(linklist, TAG, "linklist is null");
    if (!(*linklist))
    {
        OIC_LOG(DEBUG, TAG, "List is already Empty");
        return CA_STATUS_OK;
    }

    u_linklist_data_t *free_node=NULL;
    while((*linklist)->size)
    {
        free_node = (*linklist)->list;
        (*linklist)->list = (*linklist)->list->next;

        if(free_node != NULL)
        {
            OICFree(free_node);
            free_node=NULL;
        }

        (*linklist)->size -= 1;
    }
    *linklist=NULL;

    return CA_STATUS_OK;
}
开发者ID:TianyouLi,项目名称:iotivity,代码行数:27,代码来源:ulinklist.c

示例6: CAEDRNativeRemoveAllDeviceSocket

void CAEDRNativeRemoveAllDeviceSocket(JNIEnv *env)
{
    OIC_LOG(DEBUG, TAG, "CANativeRemoveAllDeviceObjsList");

    if (!g_deviceObjectList)
    {
        OIC_LOG(ERROR, TAG, "gdeviceObjectList is null");
        return;
    }

    jint length = u_arraylist_length(g_deviceStateList);
    for (jint index = 0; index < length; index++)
    {
        jobject jarrayObj = (jobject) u_arraylist_get(g_deviceObjectList, index);
        if (!jarrayObj)
        {
            OIC_LOG(ERROR, TAG, "jarrayObj is null");
            return;
        }
        (*env)->DeleteGlobalRef(env, jarrayObj);
    }

    OICFree(g_deviceObjectList);
    g_deviceObjectList = NULL;
    return;
}
开发者ID:InfiniteDevelopment,项目名称:iotivity,代码行数:26,代码来源:caedrutils.c

示例7: DeleteSVCList

void DeleteSVCList(OicSecSvc_t* svc)
{
    if (svc)
    {
        OicSecSvc_t *svcTmp1 = NULL, *svcTmp2 = NULL;
        LL_FOREACH_SAFE(svc, svcTmp1, svcTmp2)
        {
            LL_DELETE(svc, svcTmp1);

            // Clean Owners
            OICFree(svcTmp1->owners);

            // Clean SVC node itself
            OICFree(svcTmp1);
        }
    }
开发者ID:Lyoncore,项目名称:iotivity-demo-uc15,代码行数:16,代码来源:svcresource.c

示例8: CABleGattDiscoverCharacteristics

CAResult_t CABleGattDiscoverCharacteristics(bt_gatt_attribute_h service,
        const char *remoteAddress)
{
    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "IN");

    VERIFY_NON_NULL_RET(service, TZ_BLE_CLIENT_TAG, "service is NULL", CA_STATUS_FAILED);

    VERIFY_NON_NULL_RET(remoteAddress, TZ_BLE_CLIENT_TAG, "remoteAddress is NULL", CA_STATUS_FAILED);

    char *addr = OICStrdup(remoteAddress);
    VERIFY_NON_NULL_RET(addr, TZ_BLE_CLIENT_TAG, "Malloc failed", CA_STATUS_FAILED);

    int32_t ret = bt_gatt_discover_characteristics(service, CABleGattCharacteristicsDiscoveredCb,
                  (void *)addr); // addr will be freed in callback.
    if (BT_ERROR_NONE != ret)
    {
        OIC_LOG_V(ERROR, TZ_BLE_CLIENT_TAG,
                  "bt_gatt_discover_characteristics failed with error [%d]", ret);
        OICFree(addr);
        return CA_STATUS_FAILED;
    }

    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "OUT");
    return CA_STATUS_OK;
}
开发者ID:Lyoncore,项目名称:iotivity-demo-uc15,代码行数:25,代码来源:cableclient.c

示例9: OCPayloadDestroy

void OCPayloadDestroy(OCPayload* payload)
{
    if(!payload)
    {
        return;
    }

    switch(payload->type)
    {
        case PAYLOAD_TYPE_REPRESENTATION:
            OCRepPayloadDestroy((OCRepPayload*)payload);
            break;
        case PAYLOAD_TYPE_DISCOVERY:
            OCDiscoveryPayloadDestroy((OCDiscoveryPayload*)payload);
            break;
        case PAYLOAD_TYPE_DEVICE:
            OCDevicePayloadDestroy((OCDevicePayload*)payload);
            break;
        case PAYLOAD_TYPE_PLATFORM:
            OCPlatformPayloadDestroy((OCPlatformPayload*)payload);
            break;
        case PAYLOAD_TYPE_PRESENCE:
            OCPresencePayloadDestroy((OCPresencePayload*)payload);
            break;
        case PAYLOAD_TYPE_SECURITY:
            OCSecurityPayloadDestroy((OCSecurityPayload*)payload);
            break;
        default:
            OC_LOG_V(ERROR, TAG, "Unsupported payload type in destroy: %d", payload->type);
            OICFree(payload);
            break;
    }
}
开发者ID:rzr,项目名称:iotivity-1,代码行数:33,代码来源:ocpayload.c

示例10: CATimeoutCallback

static void CATimeoutCallback(const CAEndpoint_t *endpoint, const void *pdu, uint32_t size)
{
    OIC_LOG(DEBUG, TAG, "IN");
    CAEndpoint_t* ep = CACloneEndpoint(endpoint);
    if (NULL == ep)
    {
        OIC_LOG(ERROR, TAG, "clone failed");
        return;
    }

    CAResponseInfo_t* resInfo = (CAResponseInfo_t*) OICCalloc(1, sizeof(CAResponseInfo_t));

    if (NULL == resInfo)
    {
        OIC_LOG(ERROR, TAG, "calloc failed");
        CAFreeEndpoint(ep);
        return;
    }

    resInfo->result = CA_RETRANSMIT_TIMEOUT;
    resInfo->info.type = CAGetMessageTypeFromPduBinaryData(pdu, size);
    resInfo->info.messageId = CAGetMessageIdFromPduBinaryData(pdu, size);

    if (g_responseHandler)
    {
        g_responseHandler(ep, resInfo);
    }

    CAFreeEndpoint(ep);
    OICFree(resInfo);

    OIC_LOG(DEBUG, TAG, "OUT");
}
开发者ID:darcyg,项目名称:iotivity-1,代码行数:33,代码来源:camessagehandler_singlethread.c

示例11: CABleGattDiscoverServices

CAResult_t CABleGattDiscoverServices(const char *remoteAddress)
{
    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "IN");

    VERIFY_NON_NULL_RET(remoteAddress, TZ_BLE_CLIENT_TAG,
                        "remote address is NULL", CA_STATUS_FAILED);

    char *addr = OICStrdup(remoteAddress);
    VERIFY_NON_NULL_RET(addr, TZ_BLE_CLIENT_TAG, "Malloc failed", CA_STATUS_FAILED);

    int32_t ret = bt_gatt_foreach_primary_services(remoteAddress, CABleGattPrimaryServiceCb,
                  (void *)addr); // addr memory will be free in callback.
    if (BT_ERROR_NONE != ret)
    {
        OIC_LOG_V(ERROR, TZ_BLE_CLIENT_TAG,
                  "bt_gatt_foreach_primary_services Failed with ret value [%d] ", ret);
        OICFree(addr);
        return CA_STATUS_FAILED;
    }
    else
    {
        OIC_LOG_V(DEBUG, TZ_BLE_CLIENT_TAG,
                  "bt_gatt_foreach_primary_services success for address [%s]", remoteAddress);
    }

    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "OUT");
    return CA_STATUS_OK;
}
开发者ID:Lyoncore,项目名称:iotivity-demo-uc15,代码行数:28,代码来源:cableclient.c

示例12: CAEDRNativeRemoveDevice

void CAEDRNativeRemoveDevice(const char *remoteAddress)
{
    OIC_LOG(DEBUG, TAG, "CAEDRNativeRemoveDeviceforStateList");

    if(!g_deviceStateList)
    {
        OIC_LOG(ERROR, TAG, "[EDR][Native] gdeviceStateList is null");
        return;
    }
    if (!remoteAddress) {
        OIC_LOG(ERROR, TAG, "[EDR][Native] remoteAddress is null");
        return;
    }

    jint index;
    for (index = 0; index < u_arraylist_length(g_deviceStateList); index++)
    {
        state_t* state = (state_t*) u_arraylist_get(g_deviceStateList, index);
        if(!state)
        {
            OIC_LOG(DEBUG, TAG, "[EDR][Native] state_t object is null");
            continue;
        }

        if(!strcmp(state->address, remoteAddress))
        {
            OIC_LOG_V(DEBUG, TAG, "[EDR][Native] remove state : %s", remoteAddress);
            OICFree(state);

            CAEDRReorderingDeviceList(index);
            break;
        }
    }
    return;
}
开发者ID:MCherifiOSS,项目名称:iotivity,代码行数:35,代码来源:caedrclient.c

示例13: OIC_LOG

u_queue_message_t *u_queue_get_element(u_queue_t *queue)
{
    u_queue_element *element = NULL;
    u_queue_message_t *message = NULL;

    if (NULL == queue)
    {
        OIC_LOG(DEBUG, TAG, "QueueAddElement FAIL, Invalid Queue");
        return NULL;
    }

    element = queue->element;

    if (NULL == element)
    {
        return NULL;
    }

    queue->element = element->next;;
    queue->count--;

    message = element->message;
    OICFree(element);
    return message;
}
开发者ID:InfiniteDevelopment,项目名称:iotivity,代码行数:25,代码来源:uqueue.c

示例14: OCParseSecurityPayload

static OCStackResult OCParseSecurityPayload(OCPayload** outPayload, CborValue* rootValue)
{
    OCStackResult ret = OC_STACK_MALFORMED_RESPONSE;
    CborError err;
    char *securityData = NULL;

    VERIFY_PARAM_NON_NULL(TAG, outPayload, "Invalid parameter");
    VERIFY_PARAM_NON_NULL(TAG, outPayload, "Invalid cbor");

    CborValue strVal;

    err = cbor_value_enter_container(rootValue, &strVal);
    VERIFY_CBOR_SUCCESS(TAG, err, "Failed entering container");
    if (cbor_value_is_text_string(&strVal))
    {
        size_t len = 0;
        err = cbor_value_dup_text_string(&strVal, &securityData, &len, NULL);
        VERIFY_CBOR_SUCCESS(TAG, err, "Failed reading security data");
        *outPayload = (OCPayload *)OCSecurityPayloadCreate(securityData);
        VERIFY_PARAM_NON_NULL(TAG, *outPayload, "Invalid cbor");
        ret = OC_STACK_OK;
    }

exit:
    OICFree(securityData);
    return ret;

}
开发者ID:rajesh89s,项目名称:iotivity,代码行数:28,代码来源:ocpayloadparse.c

示例15: CAIPTerminateServer

void CAIPTerminateServer()
{
    OIC_LOG(DEBUG, IP_SERVER_TAG, "IN");
    ca_mutex_lock(g_mutexAdapterServerContext);
    if (!g_adapterIPServerContext)
    {
        OIC_LOG(ERROR, IP_SERVER_TAG, "g_adapterIPServerContext NULL");
        ca_mutex_unlock(g_mutexAdapterServerContext);
        return;
    }

    OICFree(g_adapterIPServerContext);
    g_adapterIPServerContext = NULL;

    ca_mutex_unlock(g_mutexAdapterServerContext);

    ca_mutex_lock(g_mutexServerInfoList);

    CAClearServerInfoList(g_serverInfoList);
    g_serverInfoList = NULL;

    ca_mutex_unlock(g_mutexServerInfoList);
    // Destroy mutex
    CAIPServerDestroyMutex();

    OIC_LOG(DEBUG, IP_SERVER_TAG, "OUT");

}
开发者ID:darcyg,项目名称:iotivity-1,代码行数:28,代码来源:caipserver.c


注:本文中的OICFree函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。