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


C++ NodeData::StatisticalInfo_sendCcnMsg方法代码示例

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


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

示例1: AppLayerCCNClient


//.........这里部分代码省略.........

            clocktype send_delayTime;
            send_delayTime = ccnMsg->data_genTime - node->getNodeTime();
            if(send_delayTime < 0) send_delayTime = 0;

            nodeData->set_lastChunkNum(ccnMsg);
            nodeData->fibModSend(node, nodeData->NewCcnMsg(ccnMsg), send_delayTime);
            APP_SetTimer(node, APP_CCN_CLIENT, 0, APP_CCN_LISTEN_PORT, APP_TIMER_fakeINTEREST_SEND_PKT, send_delayTime);
          }
          delete ccnMsg;
          break;
        }  // APP_TIMER_fakeINTEREST_SEND_PKT

        case APP_TIMER_REGULAR_SEND_PKT:
        {
            //printf("この表示は 予想ではたくさんでる。APP_TIMER_REGULAR_SEND_PKT\n");
          clocktype send_delayTime;
          uint32_t chunk_num;
          map<uint32_t, clocktype>::iterator it;
          uint32_t next_msgName = global_node_data->return_MsgName();
          uint32_t end_chunk_num = next_msgName % 40 + 10;

          CcnMsg* ccnMsg;
          do {
            ccnMsg = new CcnMsg();
            ccnMsg->resent_times = 0;
            ccnMsg->ccn_method = DEFAULT;
            ccnMsg->msg_type = Interest;
            ccnMsg->msg_name = next_msgName;
            ccnMsg->msg_chunk_num = nodeData->return_lastChunkNum(ccnMsg) + 1;
            ccnMsg->EncodeFullNameMsg();
            ccnMsg->sender_node_id = node->nodeId;
            ccnMsg->source_node_id = source_node_id;
            ccnMsg->payload_length = 30;
            ccnMsg->hops_limit = 20;
            ccnMsg->content_type = CommonData;
            ccnMsg->end_chunk_num = end_chunk_num;
            ccnMsg->interest_genTime = node->getNodeTime();
            ccnMsg->data_genTime     = node->getNodeTime();

            nodeData->set_lastChunkNum(ccnMsg);
            nodeData->reqMapInput(node, ccnMsg);
            nodeData->fibSend_DEFAULT(node, ccnMsg);
            nodeData->make_reTransMsg(node, ccnMsg);

            if(ccnMsg->msg_chunk_num > ccnMsg->end_chunk_num) break;
          } while(nodeData->set_windowSize(node, ccnMsg));

          APP_SetTimer(node, APP_CCN_CLIENT, 0, APP_CCN_LISTEN_PORT, APP_TIMER_REGULAR_SEND_PKT, nodeData->commonPacketGenerateTime);

          break;
        } // APP_TIMER_REGULAR_SEND_PKT

        default:
          ERROR_ReportError("Undefined timer type\n");
      }
      break;
    } // MSG_APP_TimerExpired

    case MSG_APP_FromTransOpenResult:  // TCPでactive open処理が完了
    {
      // データ送信処理 
      // 送信データの操作は出来る限りHostの処理にしておく
      // ここでは送信処理だけ
      TransportToAppOpenResult *openResult;
      openResult = (TransportToAppOpenResult*) MESSAGE_ReturnInfo(msg);

      //TCPコネクションが不成立時(失敗)
      if (openResult->connectionId < 0)
      {
        char buf[MAX_STRING_LENGTH];
        ctoa(node->getNodeTime(),buf);
        node->appData.numAppTcpFailure++;
        break;
      }

      // バッファーからccnメッセージを取り出し
      CcnMsg* ccnMsg;
      ccnMsg = nodeData->BufferRetrieve_Client(node, msg);

      nodeData->StatisticalInfo_sendCcnMsg(node, ccnMsg);

      ccnMsg->App_TcpSendCcnMsg(node, msg);
      break;
    } // MSG_APP_FromTransOpenResult

    case MSG_APP_FromTransDataSent:    // TCPでデータ転送終了
      TransportToAppDataSent *openResult;
      openResult = (TransportToAppDataSent*) MESSAGE_ReturnInfo(msg);

      APP_TcpCloseConnection(node, openResult->connectionId);
      break;

    case MSG_APP_FromTransCloseResult:
      break;
    default:
      ERROR_ReportError("msg->eventType error: undefined eventType\n");
  }
  MESSAGE_Free(node, msg);
}
开发者ID:LXiong,项目名称:ccn,代码行数:101,代码来源:ccn.cpp


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