⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 node.h

📁 模拟器提供了一个简单易用的平台
💻 H
字号:
/* * File: node.h * Author: Suman Banerjee <suman@cs.umd.edu> * Date: July 31, 2001 * Terms: GPL * * myns simulator */#ifndef _NODE_H_#define _NODE_H_#include <linked-list.h>#include <packet.h>#include "scheduler.h"#include <timer.h>#include "rt.h"enum NodeEventType {  NODE_START,  NODE_STOP,  RECV_PACKET};struct NodeEvent {  NodeEventType t;  Packet *p;  NodeEvent (NodeEventType type, Packet *pkt) {    t = type;    p = pkt;  }};class Node;struct NeighborInfo {  Node *n;  double cost; /* Link cost */  NeighborInfo (Node *N, double c) {   n = N;   cost = c;  };};class Agent;class Node {  public :    int id; // Id assigned to the node  int index; // Index of this node in node array  bool started; // If the node is active currently or not  LinkedList<NeighborInfo*,int> neighbor_list;  RoutingTable *rt;  Agent *a;  Node(void);  virtual ~Node (void);  inline int get_id (void) { return id; }  void start (void);  void stop (void);  /* void InitRT (int num_nodes); */  inline bool is_started (void) { return started; }  void send_pkt(Packet *p, int dst);  void tx_pkt (Packet *p, Node *next_hop, double link_delay, bool instant_route_pkt);  bool forward_pkt (Packet *p);  void rx_pkt_handler(Packet *p);  /* This would be used in the derived class to do some specific   * processing on each packet received at a node.   * Mostly this would be for statistic maintenance hooks.   */  virtual void specific_tx_pkt (Packet *p, int dst) {};  virtual void specific_rx_pkt_handler (Packet *p, bool is_src) {};  void display_packet (Packet *p, char *prefix);  void add_neighbor (Node *n, double cost);  void empty_neighbor_list (void);  void EventHandler (NodeEvent *ne);  virtual void display_on_stop_simulation (void) {};};#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -