📄 vanetrbc.h
字号:
/* ------------------------------------------------------------------- * Vehicular Ad Hoc Networks: Regular Broadcasting of messages. * Skeleton for VANET-protocols. This should be considered as an * example to create other VANET protocols! * Apart from channel load, the "protocol" as it is now does not do * anything useful. * * Dan Jungels (daniel.jungels@epfl.ch) * LCA - EPFL * * * Header file for the main protocol * Originally written for ns2.29 * * 2005-12-15: release of first version (dj) * 2005-12-23: update and cleanup, public release (dj) * ------------------------------------------------------------------- */#ifndef vanetrbc_h#define vanetrbc_h#include <agent.h>#include <mobilenode.h>#include <tclcl.h>#include <packet.h>#include <address.h>#include <ip.h>#include <timer-handler.h>#include <rng.h>#include <trace.h>#include "vanetrbc_header.h"#include "vanetrbc_rxdatadb.h"#define JITTER (rng_.uniform(0, 1))class VanetRBCAgent; // forward declaration// Timersclass VanetRBC_PktTimer : public TimerHandler {protected: VanetRBCAgent* agent_; virtual void expire(Event* e);public: VanetRBC_PktTimer(VanetRBCAgent* agent) : TimerHandler() { agent_ = agent; }};// if you need more timers, add the necessary stuff for them hereclass VanetRBCAgent : public Agent { friend class VanetRBC_PktTimer;public: VanetRBCAgent(u_int32_t); virtual int command(int argc, const char*const* argv); virtual void recv(Packet*, Handler*); virtual void timeout(int); protected: VanetRBC_PktTimer pkt_timer_; // timer for sending packets double interval_; // sending interval bool running_; // periodic sending u_int32_t vanetID_; // own ID vanetrbc_rxdatadb rxdb_; // received packets database Trace* logtarget_; // for logging RNG rng_; // random number generator, for the jitter double jitterfactor_; // multiplication-factor for the tx-jitter double crypto_delay_; // signing and verification delay [s] void sendRBC_pkt(); // broadcast a RBC message void recvRBC(Packet*); // processing of received RBC messages void reset_vanetrbc_pkt_timer(); // for the timer // you may of course add here some stuff.. or also remove some, // if you don't need it};#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -