case CCN_D:
ev << "ccn_node::handleMessage()中消息in是CCN_D(data)类型的消息,开始处理..."<< endl;
cout << "ccn_node::handleMessage()中消息in是CCN_D(data)类型的消息,开始处理..."<< endl;
_data++;
data_msg = (ccn_data* ) in;
//One hop more from the last caching node (useful for distance policy)
data_msg->setD(data_msg -> getD() + 1);
//On hop more from the origin of the node (useful for stretching metrics)
data_msg->setHops(data_msg -> getHops() + 1);
manage_data(data_msg);//核心
delete in;
ev << "ccn_node::handleMessage()中消息in是CCN_D(data)类型的消息,处理结束..."<< endl;
cout << "ccn_node::handleMessage()中消息in是CCN_D(data)类型的消息,处理结束..."<< endl;
break;
上面这段是ccn_node.ccn中handleMessage(cMessage *in)中对CCN_D类型消息的处理,
首先:修改data_msg中D的值,加1;消息经过的跳数也加1;然后调用ccn_node::manage_data(