package SSF.OS.UDP; import SSF.OS.*; /** Simplified UDP Header. */ public class UDP_Header extends ProtocolMessage { /********************* Standard UDP Header Variables *********************/ /** destination port number */ public int DEST_port; /** source port number */ public int SOURCE_port; /** UDP payload length */ public int length; public int seqno=-1; public double sendtime=-1.0; /************************* Constructors ************************/ public UDP_Header(int src_port, int dest_port, int data_length, int sn, double stime) { SOURCE_port = src_port; DEST_port = dest_port; length = data_length; seqno=sn; sendtime=stime; } /************************ Class Methods ***********************/ /** print out the UDP message*/ public String toString() { return "[UDP hdr .. sPort " + SOURCE_port + " dPort " + DEST_port + " size " + length + " seqno="+seqno+ " sendtime="+sendtime+ "]"; } /** number of bytes in the header of this UDP message */ public int header_bytecount(){ return 8; } /** total number of bytes in this UDP message */ public int bytecount(){ return (8 + length); } }