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


C++ ACE_InputCDR::read_octet_array方法代码示例

本文整理汇总了C++中ACE_InputCDR::read_octet_array方法的典型用法代码示例。如果您正苦于以下问题:C++ ACE_InputCDR::read_octet_array方法的具体用法?C++ ACE_InputCDR::read_octet_array怎么用?C++ ACE_InputCDR::read_octet_array使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ACE_InputCDR的用法示例。


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

示例1:

//COFP13MPAggregateFlowStatsRequestMsg
CmResult COFP13MPAggregateFlowStatsRequestMsg::
StreamFrom(ACE_InputCDR &is)
{
    if (COFP13MultipartMsg::StreamFrom(is) != CM_OK)
    {
        return CM_ERROR_FAILURE;
    }

    is>>m_stats_request.table_id;
    is.read_octet_array(m_stats_request.pad,sizeof(m_stats_request.pad));

    is>>m_stats_request.out_port;
    is>>m_stats_request.out_group;

    is.read_octet_array(m_stats_request.pad2,sizeof(m_stats_request.pad2));

    
    is>>m_stats_request.cookie;
    is>>m_stats_request.cookie_mask;

    bool bGood = is.good_bit();
    CM_ASSERT_RETURN(bGood, CM_ERROR_FAILURE);
    return m_match.StreamFrom(is);

}
开发者ID:chenbk85,项目名称:WOAL,代码行数:26,代码来源:COFPMPAggregateFlowStatisticsMsg.cpp

示例2: data

CmResult COFP13PacketOutMsg::StreamFrom(ACE_InputCDR &is)
{
    ACE_INT32 remainActLen = 0;
    ACE_INT32 packet_length = 0;
    ACE_CDR::Octet pad[6];
    CmResult lRet = CM_ERROR_FAILURE;
    
    lRet = COFPMessage::StreamFrom(is);
    if (CM_FAILED(lRet))
    {
        ACE_ERROR((LM_ERROR, ACE_TEXT("COFP13PacketOutMsg::StreamFrom(), COFPMessage::StreamFrom fail\n")));
        return lRet;
    }

    ACE_DEBUG((LM_DEBUG, ACE_TEXT("COFP13PacketOutMsg::StreamFrom(): \n")));
    
    is>>m_buffer_id;
    is>>m_in_port;
    is>>m_actions_len;
    is.read_octet_array(pad, sizeof(pad));
    
    bool bGood = is.good_bit();
    CM_ASSERT_RETURN(bGood, CM_ERROR_FAILURE);

    ACE_DEBUG((LM_DEBUG, ACE_TEXT("m_actions_len=%u\n"), m_actions_len));
    
    if (m_actions_len>0)
    {
        remainActLen = m_actions_len;
        ACE_UINT16 i = 0;
        while (remainActLen > 0)
        {
            COFP13Action *action = nullptr;
            CmResult result = COFP13Action::DecodeAction(is, action);
            if (CM_SUCCEEDED(result))
            {
                m_action_list.push_back(action);
                ACE_DEBUG((LM_DEBUG, ACE_TEXT("action[%u], len=%u\n"), i++, action->GetStreamLen()));
                remainActLen = remainActLen - (action->GetStreamLen());
            }
            else
            {
                ACE_ERROR((LM_ERROR, ACE_TEXT("COFP13Action::DecodeAction failed.\n")));
                return CM_ERROR_FAILURE;
            }
        }
    }

    ACE_UINT32 length = sizeof(m_buffer_id)+sizeof(m_in_port)+sizeof(m_actions_len)+sizeof(m_pad);
    ACE_DEBUG((LM_DEBUG, ACE_TEXT("length=%u\n"), length));

    packet_length = m_wLength-COFPMessage::GetStreamLen()-length-m_actions_len;
    ACE_DEBUG((LM_DEBUG, ACE_TEXT("packet_length=%d, GetStreamLen=%u\n"), packet_length, GetStreamLen()));
    if (packet_length < 0)
    {
        ACE_ERROR((LM_ERROR, 
                   ACE_TEXT("COFP13PacketOutMsg::StreamFrom, error, length=%u, actionlength=%u\n"), 
                   length, 
                   m_actions_len));
        return CM_ERROR_FAILURE;
    }

    ACE_Message_Block data(packet_length);

    ACE_DEBUG((LM_DEBUG, 
               ACE_TEXT("COFP13PacketOutMsg::StreamFrom, wr_ptr=%p, space=%u\n"),
               data.wr_ptr(),
               data.space()));
    
    bGood = is.read_char_array(data.wr_ptr(), packet_length);
    CM_ASSERT_RETURN(bGood, CM_ERROR_FAILURE);

    data.wr_ptr((size_t)packet_length);
    
    if (m_PacketData)
    {
        m_PacketData->append(data.duplicate());
    }
    else
    {
        m_PacketData = data.duplicate();
    }

    return CM_OK;
}
开发者ID:chenbk85,项目名称:WOAL,代码行数:85,代码来源:COFPPacketOutMsg.cpp

示例3: while

CmResult COFP13HelloMsg::StreamFrom(ACE_InputCDR &is)
{
    CmResult lRet = CM_ERROR_FAILURE;
    ACE_UINT16 i = 0;
    bool bGood;

    lRet = COFPMessage::StreamFrom(is);
    if (CM_FAILED(lRet))
    {
        ACE_ERROR((LM_ERROR, ACE_TEXT("COFP13HelloMsg::StreamFrom(), COFPMessage::StreamFrom fail\n")));
        return lRet;
    }
    
    if (m_wLength < COFPMessage::GetStreamLen())
    {
        ACE_ERROR((LM_ERROR, 
                   ACE_TEXT("COFP13HelloMsg::StreamFrom(): "),
                   ACE_TEXT("m_wLength(%u) is less than COFPMessage::GetStreamLen()(%u).\n"), 
                   m_wLength,
                   COFPMessage::GetStreamLen()));
        return CM_ERROR_FAILURE;
    }

    ACE_UINT16 wElemListLen = m_wLength - COFPMessage::GetStreamLen();
    ACE_UINT16 data_size    = wElemListLen;
    ACE_UINT16 iter_size    = 0;
    ACE_CDR::Octet  *pElem        = m_pElemList;

    while (iter_size < wElemListLen)
    {
        ACE_UINT16 elem_type = 0;
        ACE_UINT16 elem_size = 0;  // length of the element, excluding paddings
        
        is>>elem_type;
        is>>elem_size;
        
        bGood = is.good_bit();
        CM_ASSERT_RETURN(bGood, CM_ERROR_FAILURE);
        
        ACE_DEBUG((LM_DEBUG, ACE_TEXT("COFP13HelloMsg::StreamFrom(): parse hello elem %u.\n"), i++));
        ACE_DEBUG((LM_DEBUG, ACE_TEXT("elem_type=%u, elem_size=%u\n"), elem_type, elem_size));

        SetHelloElemType(pElem, elem_type);
        SetHelloElemLen(pElem, elem_size);
        
        if (elem_size < 4)
        {
            ACE_ERROR((LM_ERROR, 
                       ACE_TEXT("COFP13HelloMsg::StreamFrom(): elem_size(%u) error, less than 4.\n"),
                       elem_size));
            return CM_ERROR_FAILURE;
        }

        if (((elem_size + 7)/8*8) > data_size)
        {
            ACE_ERROR((LM_ERROR, 
                       ACE_TEXT("COFP13HelloMsg::StreamFrom(): "),
                       ACE_TEXT("((elem_size + 7)/8*8)=%u, greater than data_size(%u)\n"),
                       ((elem_size + 7)/8*8),
                       data_size));
            return CM_ERROR_FAILURE;
        }
        
        if (elem_type != OFPHET_VERSIONBITMAP)
        {
            ACE_ERROR((LM_ERROR, 
                       ACE_TEXT("COFP13HelloMsg::StreamFrom(): elem_type(%u) isnot OFPHET_VERSIONBITMAP(%u)\n"),
                       elem_type,
                       OFPHET_VERSIONBITMAP));
            return CM_ERROR_FAILURE;
        }

        ACE_UINT16 bitmap_size      = elem_size-4;
        CM_ASSERT_RETURN((bitmap_size/4*4 == bitmap_size), CM_ERROR_INVALID_ARG);
        
        ACE_UINT16 iter_bitmap_size = 0;
        ACE_UINT16 bitmap_index     = 0;

        while (iter_bitmap_size < bitmap_size)//(bitmap_size > 0)
        {
            ACE_UINT32 bitmap = 0;
            is>>bitmap;
            bGood = is.good_bit();
            CM_ASSERT_RETURN(bGood, CM_ERROR_FAILURE);
            ACE_DEBUG((LM_DEBUG, ACE_TEXT("bitmap[%u]=%u\n"), bitmap_index, bitmap));

            SetVerBMHelloElemBitmap(pElem, bitmap_index++, bitmap);
            //bitmap_size -= sizeof(bitmap);
            iter_bitmap_size += sizeof(bitmap);
        }

        // deal with paddings
        ACE_UINT16 pad_size = (elem_size + 7)/8*8 - elem_size;
        is.read_octet_array(pElem + 4 + bitmap_index * sizeof(ACE_UINT32), pad_size);
        bGood = is.good_bit();
        CM_ASSERT_RETURN(bGood, CM_ERROR_FAILURE);
        
        data_size      -= (elem_size + pad_size);
        iter_size      += (elem_size + pad_size);
        pElem          += (elem_size + pad_size);
//.........这里部分代码省略.........
开发者ID:chenbk85,项目名称:WOAL,代码行数:101,代码来源:COFPHelloMsg.cpp


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