jist.swans.trans
Class TransUdp

java.lang.Object
  extended by jist.swans.trans.TransUdp
All Implemented Interfaces:
JistAPI.Proxiable, JistAPI.Timeless, NetInterface.NetHandler, TransInterface, TransInterface.TransUdpInterface

public class TransUdp
extends java.lang.Object
implements TransInterface.TransUdpInterface

UDP implementation. Does not perform fragmentation.

Since:
SWANS1.0

Nested Class Summary
static class TransUdp.UdpMessage
          UDP packet structure.
 
Nested classes/interfaces inherited from interface jist.swans.trans.TransInterface
TransInterface.SocketHandler, TransInterface.TransMessage, TransInterface.TransTcpInterface, TransInterface.TransUdpInterface
 
Field Summary
static org.apache.log4j.Logger log
          UDP logger.
 
Constructor Summary
TransUdp()
          Initialize UDP transport implementation.
 
Method Summary
 void addSocketHandler(int port, TransInterface.SocketHandler handler)
          Register socket handler.
 void delSocketHandler(int port)
          Unregister socket handler.
 void dropNotify(Message msg, MacAddress nextHopMac, Reason reason)
          Notification mechanism for packet dropped due to various "Reasons"
 TransInterface.TransUdpInterface getProxy()
          Return self-referencing proxy entity.
 void receive(Message msg, NetAddress src, MacAddress lastHop, byte macId, NetAddress dst, byte priority, byte ttl)
          Receive a message from network layer.
 void send(Message msg, NetAddress dst, int dstPort, int srcPort, byte priority)
          Send message (from APPLICATON).
 void send(NetMessage msg)
          Send a message through the routing protocol
 void setNetEntity(NetInterface netEntity)
          Set network layer entity.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

public static final org.apache.log4j.Logger log
UDP logger.

Constructor Detail

TransUdp

public TransUdp()
Initialize UDP transport implementation.

Method Detail

send

public void send(NetMessage msg)
Description copied from interface: NetInterface.NetHandler
Send a message through the routing protocol

Specified by:
send in interface NetInterface.NetHandler

dropNotify

public void dropNotify(Message msg,
                       MacAddress nextHopMac,
                       Reason reason)
Description copied from interface: NetInterface.NetHandler
Notification mechanism for packet dropped due to various "Reasons"

Specified by:
dropNotify in interface NetInterface.NetHandler

getProxy

public TransInterface.TransUdpInterface getProxy()
Return self-referencing proxy entity.

Returns:
self-referencing proxy entity

setNetEntity

public void setNetEntity(NetInterface netEntity)
Set network layer entity.

Parameters:
netEntity - network layer entity

addSocketHandler

public void addSocketHandler(int port,
                             TransInterface.SocketHandler handler)
Register socket handler.

Specified by:
addSocketHandler in interface TransInterface
Parameters:
port - bound socket port
handler - callback handler

delSocketHandler

public void delSocketHandler(int port)
Unregister socket handler.

Specified by:
delSocketHandler in interface TransInterface
Parameters:
port - bound socket port

send

public void send(Message msg,
                 NetAddress dst,
                 int dstPort,
                 int srcPort,
                 byte priority)
Send message (from APPLICATON).

Specified by:
send in interface TransInterface
Parameters:
msg - packet payload (usually from application layer)
dst - packet destination address
dstPort - packet destination port
srcPort - packet source port
priority - packet priority

receive

public void receive(Message msg,
                    NetAddress src,
                    MacAddress lastHop,
                    byte macId,
                    NetAddress dst,
                    byte priority,
                    byte ttl)
Receive a message from network layer.

Specified by:
receive in interface NetInterface.NetHandler
Parameters:
msg - message received
src - source network address
lastHop - source link address
macId - incoming interface
dst - destination network address
priority - packet priority
ttl - packet time-to-live