• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ OICFree函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: InitDoxmResource

/**
 * Initialize DOXM resource by loading data from persistent storage.
 *
 * @retval  OC_STACK_OK for Success, otherwise some error value
 */
OCStackResult InitDoxmResource()
{
    OCStackResult ret = OC_STACK_ERROR;

    //Read DOXM resource from PS
    char* jsonSVRDatabase = GetSVRDatabase();
    if(jsonSVRDatabase)
    {
        //Convert JSON DOXM into binary format
        gDoxm = JSONToDoxmBin(jsonSVRDatabase);
    }
    /*
     * If SVR database in persistent storage got corrupted or
     * is not available for some reason, a default doxm is created
     * which allows user to initiate doxm provisioning again.
     */
    if(!jsonSVRDatabase || !gDoxm)
    {
        gDoxm = GetDoxmDefault();
    }
    CheckDeviceID();
    //Instantiate 'oic.sec.doxm'
    ret = CreateDoxmResource();
    OICFree(jsonSVRDatabase);
    return ret;
}
开发者ID:HoTaeWang,项目名称:iotivity,代码行数:31,代码来源:doxmresource.c


示例17: CAInitLEGattServer

CAResult_t CAInitLEGattServer()
{
    OIC_LOG(DEBUG, TAG, "IN");

    int ret =  bt_gatt_server_initialize();
    if (0 != ret)
    {
        OIC_LOG_V(ERROR, TAG, "bt_gatt_server_initialize failed with ret[%s]",
                  CALEGetErrorMsg(ret));
        return CA_STATUS_FAILED;
    }

    bt_gatt_server_h server;

    ret = bt_gatt_server_create(&server);
    if (0 != ret)
    {
        OIC_LOG_V(ERROR, TAG, "bt_gatt_server_create failed with ret[%s]",
                  CALEGetErrorMsg(ret));
        return CA_STATUS_FAILED;
    }

    if (NULL != g_gattServer)
    {
        OICFree(g_gattServer);
        g_gattServer = NULL;
    }
    g_gattServer = server;

    OIC_LOG(DEBUG, TAG, "OUT");
    return CA_STATUS_OK;
}
开发者ID:aaronkim,项目名称:iotivity,代码行数:32,代码来源:caleserver.c


示例18: ca_mutex_free

bool ca_mutex_free(ca_mutex mutex)
{
    bool bRet=false;

    ca_mutex_internal *mutexInfo = (ca_mutex_internal*) mutex;
    if (mutexInfo)
    {
        int ret = pthread_mutex_destroy(&mutexInfo->mutex);
        if (0 == ret)
        {
            OICFree(mutexInfo);
            bRet=true;
        }
        else
        {
            OIC_LOG_V(ERROR, TAG, "%s Failed to free mutex !", __func__);
        }
    }
    else
    {
        OIC_LOG_V(ERROR, TAG, "%s Invalid mutex !", __func__);
    }

    return bRet;
}
开发者ID:WojciechLuczkow,项目名称:iotivity,代码行数:25,代码来源:camutex_pthreads.c


示例19: InitPstatResource

/**
 * Initialize pstat resource by loading data from persistent storage.
 *
 * @retval  OC_STACK_OK for Success, otherwise some error value
 */
OCStackResult InitPstatResource()
{
    OCStackResult ret = OC_STACK_ERROR;

    // Read Pstat resource from PS
    char* jsonSVRDatabase = GetSVRDatabase();
    if (jsonSVRDatabase)
    {
        // Convert JSON Pstat into binary format
        gPstat = JSONToPstatBin(jsonSVRDatabase, true);
    }
    /*
     * If SVR database in persistent storage got corrupted or
     * is not available for some reason, a default pstat is created
     * which allows user to initiate pstat provisioning again.
     */
    if(!jsonSVRDatabase || !gPstat)
    {
        gPstat = GetPstatDefault();
    }
    // Instantiate 'oic.sec.pstat'
    ret = CreatePstatResource();

    OICFree(jsonSVRDatabase);
    return ret;
}
开发者ID:chetan336,项目名称:iotivity,代码行数:31,代码来源:pstatresource.c


示例20: CAIPErrorHandler

void CAIPErrorHandler (const CAEndpoint_t *endpoint, const void *data,
                       uint32_t dataLength, CAResult_t result)
{
    OIC_LOG(DEBUG, TAG, "IN");

    VERIFY_NON_NULL_VOID(endpoint, TAG, "endpoint is NULL");

    VERIFY_NON_NULL_VOID(data, TAG, "data is NULL");

    void *buf = (void*)OICMalloc(sizeof(char) * dataLength);
    if (!buf)
    {
        OIC_LOG(ERROR, TAG, "Memory Allocation failed!");
        return;
    }
    memcpy(buf, data, dataLength);
    if (g_errorCallback)
    {
        g_errorCallback(endpoint, buf, dataLength, result);
    }
    else
    {
        OICFree(buf);
    }

    OIC_LOG(DEBUG, TAG, "OUT");
}
开发者ID:Dosercyan,项目名称:iotivity,代码行数:27,代码来源:caipadapter.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ OICStrcpy函数代码示例发布时间:2022-05-30
下一篇:
C++ OICCalloc函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap