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

📄 cell.java

📁 一个小型网络仿真器的实现
💻 JAVA
字号:
/*
   JaNetSim  ---  Java Network Simulator
   -------------------------------------

   This software was developed at the Network Research Lab, Faculty of
   Computer Science and Information Technology (FCSIT), University of Malaya.
   This software may be used and distributed freely. FCSIT assumes no responsibility
   whatsoever for its use by other parties, and makes no guarantees, expressed or
   implied, about its quality, reliability, or any other characteristic.

   We would appreciate acknowledgement if the software is used.

   FCSIT ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION AND
   DISCLAIM ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING
   FROM THE USE OF THIS SOFTWARE.
*/

package janetsim.component;

import janetsim.*;

public class Cell implements Bits,java.io.Serializable {
  public int vpi=0; //8bit (UNI) or 12bit (NNI)
  public int vci=0; //16bit
  public int pti=0; //3bit
  public Object payload=null;

//// Some special VPI/VCI values:
//// 0/5 : UNI Signalling
//// 0/16 : PNNI Signalling
//// 0/32 : IP Signalling (OSPF, MPLS LDP etc.)
//// 0/33 : IP over ATM with L3 routing (experimental)


////////////////////////////// AAL5 ////////////////////////////////

  public int len=0; //number of cells instead of pdu length
  public int crc=0; //just match the number in the first and the last cell


////////////////////// admin purpose only //////////////////////////

  public Object forwardEntry=null;


////////////////////// constructors ////////////////////////////////

  public Cell() {}

  public int length() { return 424; }

/*
  Cell(SimComponent thesender,long tick) {
    sender=thesender;
    sendingTick=tick;
  }
*/

//////////////////////////////////////////////////////////////////////

/*

///////////////// IP ////////////////////
  boolean isDummy=false;
  int numDummy=0; //number of dummy cells before this cell
                  //to simulate complete IP packet
                  //(used during forwarding)

  boolean isIP=false;
  int sourceIP;
  int destIP;
  int TOS=0;
  int protocol=0;

  //multicast IP address constants
  static final int IP_ALL_ROUTER = 0xe0000002; //224.0.0.2
  static final int IP_ALLOSPF_ROUTER = 0xe0000005; //224.0.0.5

  //TOS constants
  static final int TOS_EF = 0xB8; //expedited forwarding
  static final int TOS_AF1 = 0x28; //assured forwarding (class 1 low drop)
  static final int TOS_AF2 = 0x48; //assured forwarding (class 1 low drop)
  static final int TOS_AF3 = 0x68; //assured forwarding (class 1 low drop)
  static final int TOS_AF4 = 0x88; //assured forwarding (class 1 low drop)
  static final int TOS_BE = 0; //default best-effort

  //protocol constants
  static final int PRO_OSPF = 89;

  //protocol cheats (NOTE: these are just cheats)
  static final int PRO_BGP = 179; //this number is actually the TCP port
                                  //number for BGP
  static final int PRO_LDP = 646; //this number is actually the UDP/TCP
                                  //port number for LDP
  static final int PRO_PING = 7777;
  static final int PRO_PING_ACK = 7778;
  static final int PRO_PING_NACK = 7779;
  static final int PRO_OSPF_STUB_REG = 7780;
  static final int PRO_DATA = 7781; //actually should be UPD or TCP
  static final int PRO_BB_REQ = 7782; //diffserv bb request
              //fill in reg_cost for bandwidth (in kpbs)
  static final int PRO_BB_ACK = 7783; //diffserv bb ack (accept call)
  static final int PRO_BB_NACK = 7784; //diffserv bb reject
  static final int PRO_BB_REL = 7785; //diffserv bb call release

  //for PRO_DATA
  int port;
  int sourceport;

/////////////////////////////////////////////

/////////////////// TCP ////////////////////

  Object tcp_ip_info; //carrying a TCP Packet object

/////////////////////////////////////////////


///////////////// MPLS LDP //////////////////

  int LDP_ID; //actually the first 4 bytes in LDP_ID
  int LDP_lspace; //actually the last 2 bytes in LDP_ID (for label space)
  int LDP_msgtype; //message type
  int LDP_msgID; //message ID

  //message type constants
  static final int LDP_NOTIFICATION = 0x0001;
  static final int LDP_HELLO = 0x0100;
  static final int LDP_INIT = 0x0200;
  static final int LDP_KEEPALIVE = 0x0201;
  static final int LDP_ADDRESS = 0x0300;
  static final int LDP_ADDRESS_WITHDRAW = 0x0301;
  static final int LDP_LABEL_MAPPING = 0x0400;
  static final int LDP_LABEL_REQUEST = 0x0401;
  static final int LDP_LABEL_ABORT_REQUEST = 0x0404;
  static final int LDP_LABEL_WITHDRAW = 0x0402;
  static final int LDP_LABEL_RELEASE = 0x0403;

  //for LDP_NOTIFICATION
  int LDP_status;

  //status constants
  static final int LDP_STATUS_NO_ROUTE = 0x000D;

  //for LDP_LABEL_REQUEST
  java.util.List FEC=null; //element type ATMLSR.FECElement (private)

  //for LDP_LABEL_MAPPING
  int label_vpi;
  int label_vci;

  //for others
  //also use the LDP_msgID as the REQUEST msgID
  //also use the FEC when needed

/////////////////////////////////////////////

///////////////// BGP //////////////////

  Object bgp_info=null; //cast into a BGP_Packet object

////////////////////////////////////////

///////////////// OSPF //////////////////

  int packettype;
  int RouterID;
  int AreaID;

  //packet type constants
  static final int OSPF_HELLO = 1;
  static final int OSPF_DD = 2;
  static final int OSPF_LSREQ = 3;
  static final int OSPF_LSUPD = 4;
  static final int OSPF_LSACK = 5;

  //for OSPF_HELLO
  java.util.List neighbors; //all seen neighbor IDs

  //for OSPF_DD
  boolean init;
  boolean more;
  boolean master;
  int DDseq;
  java.util.List LSAHeaders=null; //element type is LSAHeader

  //for OSPF_LSREQ
    //use LSAHeaders in OSPF_DD

  //for OSPF_LSUPD
  java.util.List LSAs=null; //element type is LSA

  //for OSPF_LSACK
    //use LSAHeaders in OSPF_DD

  //fake stub network registration
  int reg_ip;
  int reg_mask;
  int reg_cost;

  //cheat as number
  int as_num;

/////////////////////////////////////////



/////////// Delay measurement //////////////////

  //check compInfo of application class components for usage
  SimComponent sender=null;
  long sendingTick;

/////////////////////////////////////////////

*/

}

⌨️ 快捷键说明

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