NS2 添加新协议

#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

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值