ippacket.java
来自「一个小型网络仿真器的实现」· Java 代码 · 共 53 行
JAVA
53 行
/*
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 IPPacket implements java.io.Serializable {
public int sourceIP; //4 bytes
public int destIP; //4 bytes
public int TOS=0; //1 byte
public int protocol; //1 byte
public int len; //2 bytes (length including header+payload, in bytes)
//(for IP on Ethernet, use range 46-1500)
public Object payload=null;
/////////////////////////// constants /////////////////////////////////////
//multicast IP address constants
public static final int IP_ALL_ROUTER = 0xe0000002; //224.0.0.2
public static final int IP_ALLOSPF_ROUTER = 0xe0000005; //224.0.0.5
//TOS constants
public static final int TOS_EF = 0xB8; //expedited forwarding
public static final int TOS_AF1 = 0x28; //assured forwarding (class 1 low drop)
public static final int TOS_AF2 = 0x48; //assured forwarding (class 1 low drop)
public static final int TOS_AF3 = 0x68; //assured forwarding (class 1 low drop)
public static final int TOS_AF4 = 0x88; //assured forwarding (class 1 low drop)
public static final int TOS_BE = 0; //default best-effort
//protocol constants
public static final int PRO_TCP = 6;
public static final int PRO_UDP = 17;
public static final int PRO_OSPF = 89;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?