floodidqueueentry.java

来自「DSr project for the java applications」· Java 代码 · 共 45 行

JAVA
45
字号
package dsr;import java.io.*;import java.util.*;import java.net.*;//this class implements the entry of a FloodIDQueueclass FloodIDQueueEntry {  InetAddress srcIP;      //source IP address. from where the packet was originated  InetAddress dstIP;      //destination IP address, where the packet is headed to  int floodID;            //flood ID of that particular packet  long lifetime;          //the amount fo time this entry is valid  static int tmpID=0;     //static int to generate a unique flood ID  //default constructor  public FloodIDQueueEntry() {}  //constructor  public FloodIDQueueEntry(InetAddress srcIP, InetAddress dstIP, long lifetime) {    floodID = ++tmpID;    this.srcIP = srcIP;    this.dstIP = dstIP;    this.lifetime = lifetime;  }  //copy constructor  public FloodIDQueueEntry (FloodIDQueueEntry rhs) {       srcIP = rhs.srcIP;       dstIP = rhs.dstIP;       floodID = rhs.floodID;       lifetime = rhs.lifetime;  }  //toString method for printing the entries in a string format  public String toString(){    final String EOLN = java.lang.System.getProperty("line.separator");    String value = "flood ID: " + floodID + EOLN +                   "lifetime: " + lifetime + EOLN +                   "Source IP Address: " + srcIP.toString() + EOLN +                   "Destination IP Address: " + dstIP.toString() + EOLN;    return value;  }}

⌨️ 快捷键说明

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