jist.swans.trans
Class TransUdp.UdpMessage

java.lang.Object
  extended by jist.swans.trans.TransInterface.TransMessage
      extended by jist.swans.trans.TransUdp.UdpMessage
All Implemented Interfaces:
JistAPI.Timeless, Message
Enclosing class:
TransUdp

public static class TransUdp.UdpMessage
extends TransInterface.TransMessage

UDP packet structure. UDP packet: (size = 8 + payload) src port size: 2 dst port size: 2 payload length size: 2 checksum size: 2 payload size: variable


Field Summary
private  int dstPort
          packet destination address.
static int HEADER_SIZE
          UDP packet header size.
private  Message payload
          packet payload.
private  int srcPort
          packet source address.
 
Fields inherited from interface jist.swans.misc.Message
NULL
 
Constructor Summary
TransUdp.UdpMessage(int srcPort, int dstPort, Message payload)
          Create an new UDP packet.
 
Method Summary
 void getBytes(byte[] msg, int offset)
          Store packet into byte array.
 int getDstPort()
          Return packet destination port.
 Message getPayload()
          Return packet payload.
 int getSize()
          Return packet size or Constants.ZERO_WIRE_SIZE.
 int getSrcPort()
          Return packet source port.
 java.lang.String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

HEADER_SIZE

public static final int HEADER_SIZE
UDP packet header size.

See Also:
Constant Field Values

srcPort

private int srcPort
packet source address.


dstPort

private int dstPort
packet destination address.


payload

private Message payload
packet payload.

Constructor Detail

TransUdp.UdpMessage

public TransUdp.UdpMessage(int srcPort,
                           int dstPort,
                           Message payload)
Create an new UDP packet.

Parameters:
srcPort - message source port
dstPort - message destination port
payload - message payload
Method Detail

getSrcPort

public int getSrcPort()
Return packet source port.

Returns:
packet source port

getDstPort

public int getDstPort()
Return packet destination port.

Returns:
packet destination port

getPayload

public Message getPayload()
Return packet payload.

Returns:
packet payload

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object

getSize

public int getSize()
Return packet size or Constants.ZERO_WIRE_SIZE.

Returns:
packet size

getBytes

public void getBytes(byte[] msg,
                     int offset)
Store packet into byte array.

Parameters:
msg - destination byte array
offset - byte array starting offset