📄 hgpsagent.h
字号:
#ifndef _HGPSAgent_h#define _HGPSAgent_h#include <stdarg.h>#include <object.h>#include <agent.h>#include <trace.h>#include <packet.h>#include <random.h>#include <cmu/priqueue.h>#include <cmu/cmu-trace.h>#include <cmu/mac.h>#include "hdr_hgps.h"#include "hgpsrouter.h"#include "locserver.h"#define BUFFER_CHECK 0.03#define HGPS_IP_DEF_TTL 16#define SEND_BUF_SIZE 80#define ARP_TIMEOUT 30.0e-3#define SEND_TIMEOUT 30.0#define CACHE_TIMEOUT 10.2class HGPSAgent;struct HGPSSendBufEntry{ double t; Packet *p;};class HGPSSendBufferTimer : public TimerHandler { public: HGPSSendBufferTimer(HGPSAgent *a): TimerHandler() { a_ = a;} void expire(Event *e); protected: HGPSAgent *a_;};class HGPSSleepHandler : public Handler { public: HGPSSleepHandler(HGPSAgent *a): Handler() { a_ = a;} void handle(Event *e); protected: HGPSAgent *a_;};class HGPSAgent : public Agent{ public: virtual int command(int argc, const char*const* argv); virtual void recv(Packet*, Handler* callback =0); void startUp(); void sleep(); void Terminate(); void forwardHGPSPkt(Packet *p); void handlePktWithoutLoc(Packet *& p,bool retry); void handlePktReceipt(Packet *p); void notifyLocation(nsaddr_t id, location loc); void stickPacketInSendBuffer(Packet *p); void dropSendBuff(Packet *& p); void sendBufferCheck(); void trace(char *fmt, ...); HGPSAgent(); ~HGPSAgent(); double wakeup_time; bool asleep; int update_distance_; PriQueue *ifq; protected: HGPSRouter *router; LocServer *locserver; private: Trace *logtarget; Event *sleepevent; HGPSSleepHandler *sleephandler; int off_mac_; int off_ll_; int off_ip_; int off_hgps_; int verbose_; nsaddr_t myaddr_; NsObject *ll; LL *real_ll; HGPSSendBufEntry send_buf[SEND_BUF_SIZE]; HGPSSendBufferTimer send_buf_timer; friend class HGPSRouter; friend class LocServer; friend class LocServerTriggerHandler;};#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -