📄 mip.h
字号:
/* * Copyright (c) Sun Microsystems, Inc. 1998 All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Sun Microsystems, Inc. * * 4. The name of the Sun Microsystems, Inc nor may not be used to endorse or * promote products derived from this software without specific prior * written permission. * * SUN MICROSYSTEMS MERCHANTABILITY OF THIS SOFTWARE OR THE SUITABILITY OF THIS * SOFTWARE FOR ANY PARTICULAR PURPOSE. The software is provided "as is" * without express or implied warranty of any kind. * * These notices must be retained in any copies of any part of this software. *//* Ported by Ya Xu to official ns release Jan. 1999 */#ifndef ns_mip_h#define ns_mip_h#include <assert.h>#include "agent.h"#include "classifier-addr.h"#include "hawaii.h"#define MIP_TIMER_SIMPLE 0#define MIP_TIMER_AGTLIST 1struct hdr_ipinip { hdr_ip hdr_; struct hdr_ipinip *next_; // XXX multiple encapsulation OK};typedef enum { MIPT_REG_REQUEST, MIPT_REG_REPLY, MIPT_ADS, MIPT_SOL} MipRegType;/* Wan: add Pcoa_ for PFANE in MIP messages */struct hdr_mip { int haddr_; int ha_; int coa_; int Pcoa_; MipRegType type_; double lifetime_; int seqno_;};class MIPEncapsulator : public Connector {public: MIPEncapsulator(); void recv(Packet *p, Handler *h);protected: ns_addr_t here_; int mask_; int shift_; int off_ip_; int off_ipinip_; int defttl_;};class MIPDecapsulator : public AddressClassifier {public: MIPDecapsulator(); void recv(Packet* p, Handler* h); protected: //int command(int argc, const char*const*argv); int off_ipinip_; /* XXX to be removed */ int off_ip_; //NsObject *def_target_;};class SimpleTimer : public TimerHandler {public: SimpleTimer(Agent *a) : TimerHandler() { a_ = a; }protected: inline void expire(Event *) { a_->timeout(MIP_TIMER_SIMPLE); } Agent *a_;};/* Wan: Let BS know about PFANE and Hawaii Msg header * (1) also add a method genHawaii() to generate Hawaii messages. * (2) Let Agent knows about domain_root_router-> drr_addr_. */class MIPBSAgent : public Agent {public: MIPBSAgent(); virtual void recv(Packet *, Handler *); virtual void genHawaii(HwMsgType, int, int); virtual void genMIPreply(int, int); void timeout(int);protected: int command(int argc, const char*const*argv); void send_ads(int dst = -1, NsObject *target = NULL); void sendOutBCastPkt(Packet *p); double beacon_; /* beacon period */ NsObject *bcast_target_; /* where to send out ads */ NsObject *ragent_; /* where to send reg-replies to MH */ SimpleTimer timer_; int mask_; int shift_;#ifndef notdef int seqno_; /* current ad seqno */#endif double adlftm_; /* ads lifetime */ int off_mip_; // Wan: Hawaii specific int off_hawaii_; int drr_addr_; /* Address for Domain Root Router */ int hawaii_msf_; /* Flag to enable/disable HAWAII MSF */ int Pcoa_; };class MIPMHAgent;class AgtListTimer : public TimerHandler {public: AgtListTimer(MIPMHAgent *a) : TimerHandler() { a_ = a; }protected: void expire(Event *e); MIPMHAgent *a_;};typedef struct _agentList { int node_; double expire_time_; double lifetime_; struct _agentList *next_;} AgentList;/* Let MH agent know about PFANE */class MIPMHAgent : public Agent {public: MIPMHAgent(); void recv(Packet *, Handler *); void timeout(int);protected: int command(int argc, const char*const*argv); void reg(); /* change reg function to add PFANE */ void send_sols(); void sendOutBCastPkt(Packet *p); int ha_; int coa_; int Pcoa_; /* Wan:to store the previous used COA,need static */ double reg_rtx_; double beacon_; NsObject *bcast_target_; /* where to send out solicitations */ AgentList *agts_; SimpleTimer rtx_timer_; AgtListTimer agtlist_timer_; int mask_; int shift_;#ifndef notdef int seqno_; /* current registration seqno */#endif double reglftm_; /* registration lifetime */ double adlftm_; /* current ads lifetime */ int off_mip_; int off_hawaii_; MobileNode *node_; /* ptr to my mobilenode,if appl. */};#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -