#ifndef ns_pings_h
#define ns_pings_h#include "agent.h"
#include "tclcl.h"
#include "packet.h"
#include "address.h"
#include "ip.h"struct hdr_pings {
char ret; //ret,如果包由来自发送方到被ping的节点时将会被设置为‘0’,在返回的路上,它将会被设置为‘1’。
double send_time; // send_time 是一个时间戳,发送的时候设置,将会被用来计算来回的时间。
/*
double rcv_time; // when ping arrived to receiver
int seq; // sequence number
// Header access methods
static int offset_; // required by PacketHeaderManager
inline static int& offset() { return offset_; }
inline static hdr_ping* access(const Packet* p) {
return (hdr_ping*) p->access(offset_);
}
*/
};class PingsAgent : public Agent {
public:
PingsAgent();
//int seq; // a send sequence number like in real ping
//int oneway; // enable seq number and one-way delay printouts
int command(int argc, const char*const* argv);
void recv(Packet*, Handler*);
protected:
int off_ping_;
};#endif // ns_pings_h
NS2 添加新协议
最新推荐文章于 2023-02-24 13:54:27 发布