我是 Veins 的新手,并试图实现一种机制来检测之前是否收到了 WSM 数据包。我使用“psid”作为主要变量来识别数据包 - 是否正确?
这种类型的代码会起作用吗?:
bool MyVeinsApp::msgReceivedBefore(int psid){
/*
This function will be used to determine if the message was received before
and should be discarded or processed further
*/
if(msg_log.find(psid) == msg_log.end()){
return false
}
else {
return true;
}
}
这里的 msg.log 是一个基于 psid 存储 WSM 的 C++ 数据结构。