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


C++ VERIFY_NON_NULL函数代码示例

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


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

示例1: CAEDRClientSendMulticastData

CAResult_t CAEDRClientSendMulticastData(const uint8_t *data, uint32_t dataLength)
{
    VERIFY_NON_NULL(data, TAG, "data is null");
    OIC_LOG(DEBUG, TAG, "IN");

    CAResult_t result = CAEDRSendMulticastMessage(data, dataLength);
    OIC_LOG(DEBUG, TAG, "OUT");
    return result;
}
开发者ID:chetan336,项目名称:iotivity,代码行数:9,代码来源:caedrclient.c

示例2: u_linklist_add_head

CAResult_t u_linklist_add_head(u_linklist_t *linklist, void *data)
{
    VERIFY_NON_NULL(linklist, TAG, "list is null");
    VERIFY_NON_NULL(data, TAG, "data is null");

    u_linklist_data_t *add_node = NULL;
    add_node = (u_linklist_data_t *) OICMalloc(sizeof(u_linklist_data_t));
    if (NULL == add_node)
    {
        OIC_LOG(DEBUG, TAG, "LinklistAdd FAIL, memory allocation failed");
        return CA_MEMORY_ALLOC_FAILED;
    }
    add_node->data = data;
    add_node->next = linklist->list;
    linklist->list = add_node;
    linklist->size += 1;
    return CA_STATUS_OK;
}
开发者ID:TianyouLi,项目名称:iotivity,代码行数:18,代码来源:ulinklist.c

示例3: CAStartUnicastServer

static CAResult_t CAStartUnicastServer(const char *localAddress, uint16_t *port,
                                       bool isSecured, int *serverFD)
{
    OIC_LOG(DEBUG, IP_SERVER_TAG, "IN");

    VERIFY_NON_NULL(serverFD, IP_SERVER_TAG, "serverFD");
    VERIFY_NON_NULL(localAddress, IP_SERVER_TAG, "localAddress");
    VERIFY_NON_NULL(port, IP_SERVER_TAG, "port");

    CAResult_t ret = CACreateSocket(serverFD, localAddress, port, isSecured);
    if (CA_STATUS_OK != ret)
    {
        OIC_LOG(ERROR, IP_SERVER_TAG, "Failed to create unicast socket");
    }

    OIC_LOG(DEBUG, IP_SERVER_TAG, "OUT");
    return ret;
}
开发者ID:darcyg,项目名称:iotivity-1,代码行数:18,代码来源:caipserver.c

示例4: CAGetIPInterfaceInformation

CAResult_t CAGetIPInterfaceInformation(CAEndpoint_t **info, uint32_t *size)
{
    OIC_LOG(DEBUG, TAG, "IN");

    VERIFY_NON_NULL(info, TAG, "info is NULL");
    VERIFY_NON_NULL(size, TAG, "size is NULL");

    u_arraylist_t *iflist = CAIPGetInterfaceInformation(0);
    if (!iflist)
    {
        OIC_LOG(ERROR, TAG, "get interface info failed");
        return CA_STATUS_FAILED;
    }

    uint32_t len = u_arraylist_length(iflist);

    CAEndpoint_t *eps = (CAEndpoint_t *)OICCalloc(len, sizeof (CAEndpoint_t));
    if (!eps)
    {
        OIC_LOG(ERROR, TAG, "Malloc Failed");
        u_arraylist_destroy(iflist);
        return CA_MEMORY_ALLOC_FAILED;
    }

    for (uint32_t i = 0, j = 0; i < len; i++)
    {
        CAInterface_t *ifitem = (CAInterface_t *)u_arraylist_get(iflist, i);

        OICStrcpy(eps[j].addr, CA_INTERFACE_NAME_SIZE, ifitem->name);
        eps[j].flags = CA_IPV4;
        eps[j].adapter = CA_ADAPTER_IP;
        eps[j].interface = 0;
        eps[j].port = 0;
        j++;
    }

    *info = eps;
    *size = len;

    u_arraylist_destroy(iflist);

    OIC_LOG(DEBUG, TAG, "OUT");
    return CA_STATUS_OK;
}
开发者ID:WojciechLuczkow,项目名称:iotivity,代码行数:44,代码来源:caipserver_eth.cpp

示例5: CAIPGetInterfaceSubnetMask

CAResult_t CAIPGetInterfaceSubnetMask(const char *ipAddress, char **subnetMask)
{
    OIC_LOG(DEBUG, IP_MONITOR_TAG, "IN");

    VERIFY_NON_NULL(subnetMask, IP_MONITOR_TAG, "subnet mask");
    VERIFY_NON_NULL(ipAddress, IP_MONITOR_TAG, "ipAddress is null");
    VERIFY_NON_NULL(g_networkMonitorContext, IP_MONITOR_TAG, "g_networkMonitorContext is null");
    VERIFY_NON_NULL(g_networkMonitorContextMutex, IP_MONITOR_TAG,
                    "g_networkMonitorContextMutex is null");

    // Get the interface and ipaddress information from cache
    ca_mutex_lock(g_networkMonitorContextMutex);
    if (!g_networkMonitorContext->netInterfaceList
        || (0 == u_arraylist_length(g_networkMonitorContext->netInterfaceList)))
    {
        OIC_LOG(DEBUG, IP_MONITOR_TAG, "Network not enabled");
        ca_mutex_unlock(g_networkMonitorContextMutex);
        return CA_ADAPTER_NOT_ENABLED;
    }

    uint32_t list_length = u_arraylist_length(g_networkMonitorContext->netInterfaceList);
    OIC_LOG_V(DEBUG, IP_MONITOR_TAG, "list lenght [%d]", list_length);
    for (uint32_t list_index = 0; list_index < list_length; list_index++)
    {
        CANetInfo_t *info = (CANetInfo_t *) u_arraylist_get(
                g_networkMonitorContext->netInterfaceList, list_index);
        if (!info)
        {
            continue;
        }

        if (strncmp(info->ipAddress, ipAddress, strlen(ipAddress)) == 0)
        {
            OIC_LOG_V(DEBUG, IP_MONITOR_TAG,
                      "CAIPGetInterfaceSubnetMask subnetmask is %s", info->subnetMask);
            *subnetMask = OICStrdup(info->subnetMask);
            break;
        }
    }
    ca_mutex_unlock(g_networkMonitorContextMutex);

    OIC_LOG(DEBUG, IP_MONITOR_TAG, "OUT");
    return CA_STATUS_OK;
}
开发者ID:darcyg,项目名称:iotivity-1,代码行数:44,代码来源:caipnwmonitor.c

示例6: CAUpdateCharacteristicsToAllGattClients

CAResult_t CAUpdateCharacteristicsToAllGattClients(const uint8_t *charValue, uint32_t charValueLen)
{
    OIC_LOG(DEBUG, TAG, "IN");

    VERIFY_NON_NULL(charValue, TAG, "charValue");

    oc_mutex_lock(g_leCharacteristicMutex);

    if (!g_LEConnectedState)
    {
        OIC_LOG(ERROR, TAG, "g_LEConnectedState is false");
        oc_mutex_unlock(g_leCharacteristicMutex);
        return CA_STATUS_FAILED;
    }

    if (NULL  == g_gattReadCharPath)
    {
        OIC_LOG(ERROR, TAG, "g_gattReadCharPath is NULL");
        oc_mutex_unlock(g_leCharacteristicMutex);
        return CA_STATUS_FAILED;
    }

    int ret = bt_gatt_set_value(g_gattReadCharPath, (char *)charValue, charValueLen);
    if (0 != ret)
    {
        OIC_LOG_V(ERROR, TAG, "bt_gatt_set_value failed with return[%s]", CALEGetErrorMsg(ret));
        oc_mutex_unlock(g_leCharacteristicMutex);
        return CA_STATUS_FAILED;
    }

#ifdef BLE_TIZEN_30
    ret = bt_gatt_server_notify_characteristic_changed_value(g_gattReadCharPath,
                                                             CALEServerNotificationSentCB,
                                                             NULL, NULL);
#else
    ret = bt_gatt_server_notify(g_gattReadCharPath, false, CALEServerNotificationSentCB,
                                NULL);
#endif
    if (0 != ret)
    {
        OIC_LOG_V(ERROR, TAG,
#ifdef BLE_TIZEN_30
                  "bt_gatt_server_notify_characteristic_changed_value failed with return[%s]",
#else
                  "bt_gatt_server_notify failed with return[%s]",
#endif
                  CALEGetErrorMsg(ret));
        oc_mutex_unlock(g_leCharacteristicMutex);
        return CA_STATUS_FAILED;
    }

    oc_mutex_unlock(g_leCharacteristicMutex);

    OIC_LOG(DEBUG, TAG, "OUT");
    return CA_STATUS_OK;
}
开发者ID:drashti304,项目名称:TizenRT,代码行数:56,代码来源:caleserver_vd.c

示例7: CAUpdateCharacteristicsToGattClient

CAResult_t CAUpdateCharacteristicsToGattClient(const char *address, const uint8_t *charValue,
                                               uint32_t charValueLen)
{
    OIC_LOG(DEBUG, TAG, "IN");

    VERIFY_NON_NULL(charValue, TAG, "charValue");
    VERIFY_NON_NULL(address, TAG, "address");

    OIC_LOG_V(DEBUG, TAG, "Client's Unicast address for sending data [%s]", address);

    ca_mutex_lock(g_leCharacteristicMutex);

    if (NULL  == g_gattReadCharPath)
    {
        OIC_LOG(ERROR, TAG, "g_gattReadCharPath is NULL");
        ca_mutex_unlock(g_leCharacteristicMutex);
        return CA_STATUS_FAILED;
    }

    int ret = bt_gatt_set_value(g_gattReadCharPath, (char *)charValue, charValueLen);
    if (0 != ret)
    {
        OIC_LOG_V(ERROR, TAG,
                  "bt_gatt_set_value failed with return [%s]", CALEGetErrorMsg(ret));
        ca_mutex_unlock(g_leCharacteristicMutex);
        return CA_STATUS_FAILED;
    }

    ret = bt_gatt_server_notify(g_gattReadCharPath, false, CALEServerNotificationSentCB,
                                address, NULL);
    if (0 != ret)
    {
        OIC_LOG_V(ERROR, TAG,
                  "bt_gatt_server_notify failed with return [%s]", CALEGetErrorMsg(ret));
        ca_mutex_unlock(g_leCharacteristicMutex);
        return CA_STATUS_FAILED;
    }

    ca_mutex_unlock(g_leCharacteristicMutex);

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

示例8: CAManagerStartAutoConnection

CAResult_t CAManagerStartAutoConnection(JNIEnv *env, jstring remote_le_address)
{
    VERIFY_NON_NULL(env, TAG, "env is null");
    VERIFY_NON_NULL(remote_le_address, TAG, "remote_le_address is null");

    OIC_LOG(DEBUG, TAG, "IN - CAManagerStartAutoConnection");

    if (true == CAManagerGetAutoConnectionFlag(env, remote_le_address))
    {
        OIC_LOG(INFO, TAG, "auto connecting.");
        return CA_STATUS_FAILED;
    }

    ca_mutex_lock(g_connectRetryMutex);

    CAResult_t res = CA_STATUS_OK;
    for (size_t retry_cnt = 0 ; retry_cnt < MAX_RETRY_COUNT ; retry_cnt++)
    {
        // there is retry logic 5 times when connectGatt call has failed
        // because BT adapter might be not ready yet.
        res = CAManagerConnectGatt(env, remote_le_address);
        if (CA_STATUS_OK != res)
        {
            OIC_LOG_V(INFO, TAG, "retry will be started at least %d times after delay 1sec",
                      MAX_RETRY_COUNT - retry_cnt - 1);
            if (ca_cond_wait_for(g_connectRetryCond, g_connectRetryMutex, TIMEOUT) == 0)
            {
                OIC_LOG(INFO, TAG, "request to connect gatt was canceled");
                ca_mutex_unlock(g_connectRetryMutex);
                return CA_STATUS_OK;
            }
            // time out. retry connection
        }
        else
        {
            OIC_LOG(INFO, TAG, "ConnectGatt has called successfully");
            break;
        }
    }
    ca_mutex_unlock(g_connectRetryMutex);
    OIC_LOG(DEBUG, TAG, "OUT - CAManagerStartAutoConnection");
    return res;
}
开发者ID:Lyoncore,项目名称:iotivity-simple-client-server-uc16,代码行数:43,代码来源:caleautoconnector.c

示例9: CAInitializeIP

CAResult_t CAInitializeIP(CARegisterConnectivityCallback registerCallback,
                          CANetworkPacketReceivedCallback networkPacketCallback,
                          CANetworkChangeCallback netCallback,
                          CAErrorHandleCallback errorCallback, ca_thread_pool_t handle)
{
    OIC_LOG(DEBUG, TAG, "IN");
    VERIFY_NON_NULL(registerCallback, TAG, "registerCallback");
    VERIFY_NON_NULL(networkPacketCallback, TAG, "networkPacketCallback");
    VERIFY_NON_NULL(netCallback, TAG, "netCallback");
#ifndef SINGLE_THREAD
    VERIFY_NON_NULL(handle, TAG, "thread pool handle");
#endif

    g_networkChangeCallback = netCallback;
    g_networkPacketCallback = networkPacketCallback;
    g_errorCallback = errorCallback;

    CAInitializeIPGlobals();
    caglobals.ip.threadpool = handle;

    CAIPSetPacketReceiveCallback(CAIPPacketReceivedCB);
#ifdef __WITH_DTLS__
    CAAdapterNetDtlsInit();

    CADTLSSetAdapterCallbacks(CAIPPacketReceivedCB, CAIPPacketSendCB, 0);
#endif

    CAConnectivityHandler_t ipHandler;
    ipHandler.startAdapter = CAStartIP;
    ipHandler.startListenServer = CAStartIPListeningServer;
    ipHandler.stopListenServer = CAStopIPListeningServer;
    ipHandler.startDiscoveryServer = CAStartIPDiscoveryServer;
    ipHandler.sendData = CASendIPUnicastData;
    ipHandler.sendDataToAll = CASendIPMulticastData;
    ipHandler.GetnetInfo = CAGetIPInterfaceInformation;
    ipHandler.readData = CAReadIPData;
    ipHandler.stopAdapter = CAStopIP;
    ipHandler.terminate = CATerminateIP;
    registerCallback(ipHandler, CA_ADAPTER_IP);

    OIC_LOG(INFO, TAG, "OUT IntializeIP is Success");
    return CA_STATUS_OK;
}
开发者ID:Dosercyan,项目名称:iotivity,代码行数:43,代码来源:caipadapter.c

示例10: CAEDRServerInitialize

CAResult_t CAEDRServerInitialize(ca_thread_pool_t handle)
{
    OIC_LOG(DEBUG, TAG, "CAEDRServerInitialize");
    VERIFY_NON_NULL(handle, TAG, "handle is NULL");

    g_threadPoolHandle = handle;
    CAEDRServerJniInit();

    return CAEDRServerCreateMutex();
}
开发者ID:drashti304,项目名称:TizenRT,代码行数:10,代码来源:caedrserver.c

示例11: CAGetErrorInfoFromPDU

CAResult_t CAGetErrorInfoFromPDU(const coap_pdu_t *pdu, const CAEndpoint_t *endpoint,
                                 CAErrorInfo_t *errorInfo)
{
    VERIFY_NON_NULL(pdu, TAG, "pdu");

    uint32_t code = 0;
    CAResult_t ret = CAGetInfoFromPDU(pdu, endpoint, &code, &errorInfo->info);

    return ret;
}
开发者ID:drashti304,项目名称:TizenRT,代码行数:10,代码来源:caprotocolmessage.c

示例12: provisionCredentialCB1

/**
 * Callback handler for handling callback of provisioning device 1.
 *
 * @param[in] ctx             ctx value passed to callback from calling function.
 * @param[in] UNUSED          handle to an invocation
 * @param[in] clientResponse  Response from queries to remote servers.
 * @return  OC_STACK_DELETE_TRANSACTION to delete the transaction
 *          and  OC_STACK_KEEP_TRANSACTION to keep it.
 */
static OCStackApplicationResult provisionCredentialCB1(void *ctx, OCDoHandle UNUSED,
                                                       OCClientResponse *clientResponse)
{
    VERIFY_NON_NULL(TAG, ctx, ERROR, OC_STACK_DELETE_TRANSACTION);
    (void)UNUSED;
    CredentialData_t* credData = (CredentialData_t*) ctx;
    OICFree(credData->credInfoFirst);
    const OCProvisionDev_t *deviceInfo = credData->deviceInfo2;
    OicSecCred_t *credInfo = credData->credInfo;
    const OCProvisionResultCB resultCallback = credData->resultCallback;
    if (clientResponse)
    {
        if (OC_STACK_RESOURCE_CREATED == clientResponse->result)
        {
            // send credentials to second device
            registerResultForCredProvisioning(credData, OC_STACK_RESOURCE_CREATED,1);
            OCStackResult res = provisionCredentials(credInfo, deviceInfo, credData,
                    provisionCredentialCB2);
            DeleteCredList(credInfo);
            if (OC_STACK_OK != res)
            {
                registerResultForCredProvisioning(credData, res,2);
                ((OCProvisionResultCB)(resultCallback))(credData->ctx, credData->numOfResults,
                                                        credData->resArr,
                                                        true);
                OICFree(credData->resArr);
                OICFree(credData);
                credData = NULL;
            }
        }
        else
        {
            registerResultForCredProvisioning(credData, OC_STACK_ERROR,1);
            ((OCProvisionResultCB)(resultCallback))(credData->ctx, credData->numOfResults,
                                                    credData->resArr,
                                                    true);
            OICFree(credData->resArr);
            OICFree(credData);
            credData = NULL;
        }
    }
    else
    {
        OC_LOG(INFO, TAG, "provisionCredentialCB received Null clientResponse for first device");
        registerResultForCredProvisioning(credData, OC_STACK_ERROR,1);
       ((OCProvisionResultCB)(resultCallback))(credData->ctx, credData->numOfResults,
                                                     credData->resArr,
                                                     true);
        DeleteCredList(credInfo);
        OICFree(credData->resArr);
        OICFree(credData);
        credData = NULL;
    }
    return OC_STACK_DELETE_TRANSACTION;
}
开发者ID:WojciechLuczkow,项目名称:iotivity,代码行数:64,代码来源:secureresourceprovider.c

示例13: SendDisconnectMessage

OCStackResult SendDisconnectMessage(const KeepAliveEntry_t *entry)
{
    VERIFY_NON_NULL(entry, FATAL, OC_STACK_INVALID_PARAM);

    /*
     * Send empty message to disconnect a connection.
     * If CA get the empty message from RI, CA will disconnect a connection.
     */
    CARequestInfo_t requestInfo = { .method = CA_PUT };
    return CASendRequest(&entry->remoteAddr, &requestInfo);
}
开发者ID:Lyoncore,项目名称:iotivity-simple-client-server-uc16,代码行数:11,代码来源:oickeepalive.c

示例14: HandleKeepAliveResponse

OCStackResult HandleKeepAliveResponse(const CAEndpoint_t *endPoint,
                                      OCStackResult responseCode,
                                      const OCRepPayload *respPayload)
{
    VERIFY_NON_NULL(endPoint, FATAL, OC_STACK_INVALID_PARAM);

    OIC_LOG(DEBUG, TAG, "HandleKeepAliveResponse IN");

    // Get entry from KeepAlive table.
    uint32_t index = 0;
    KeepAliveEntry_t *entry = GetEntryFromEndpoint(endPoint, &index);
    if (!entry)
    {
        // Receive response message about find /oic/ping request.
        OIC_LOG(ERROR, TAG, "There is no connection info in KeepAlive table");

        if (OC_STACK_NO_RESOURCE == responseCode)
        {
            OIC_LOG(ERROR, TAG, "Server doesn't have a ping resource");
            return OC_STACK_ERROR;
        }
        else if (OC_STACK_OK == responseCode)
        {
            int64_t *recvInterval = NULL;
            size_t dimensions[MAX_REP_ARRAY_DEPTH] = { 0 };
            OCRepPayloadGetIntArray(respPayload, INTERVAL_ARRAY, &recvInterval, dimensions);
            size_t serverIntervalSize = calcDimTotal(dimensions);

            entry = AddKeepAliveEntry(endPoint, OC_CLIENT, recvInterval);
            if (!entry)
            {
                OIC_LOG(ERROR, TAG, "Failed to add new KeepAlive entry");
                return OC_STACK_ERROR;
            }

            if (serverIntervalSize)
            {
                // update interval size with received size of server.
                entry->intervalSize = serverIntervalSize;
            }

            // Send first ping message
            return SendPingMessage(entry);
        }
    }
    else
    {
        // Set sentPingMsg values with false.
        entry->sentPingMsg = false;
    }

    OIC_LOG(DEBUG, TAG, "HandleKeepAliveResponse OUT");
    return OC_STACK_OK;
}
开发者ID:Subh1994,项目名称:iotivity,代码行数:54,代码来源:oickeepalive.c

示例15: HandleKeepAliveRequest

OCStackResult HandleKeepAliveRequest(const CAEndpoint_t* endPoint,
                                     const CARequestInfo_t* requestInfo)
{
    VERIFY_NON_NULL(endPoint, FATAL, OC_STACK_INVALID_PARAM);
    VERIFY_NON_NULL(requestInfo, FATAL, OC_STACK_INVALID_PARAM);

    OIC_LOG(DEBUG, TAG, "HandleKeepAliveRequest IN");

    OCStackResult result = OC_STACK_OK;
    if (CA_PUT == requestInfo->method)
    {
        result = HandleKeepAlivePUTRequest(endPoint, requestInfo);
    }
    else if (CA_GET == requestInfo->method)
    {
        result = HandleKeepAliveGETRequest(endPoint, requestInfo);
    }

    OIC_LOG(DEBUG, TAG, "HandleKeepAliveRequest OUT");
    return result;
}
开发者ID:Subh1994,项目名称:iotivity,代码行数:21,代码来源:oickeepalive.c


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