|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjist.swans.trans.TransTcp
public class TransTcp
Implementation of TCP Transport Layer.
Nested Class Summary | |
---|---|
static class |
TransTcp.TcpMessage
Data structure for TCP Message. |
static class |
TransTcp.TcpOptions
Implementation for TCP Options. |
Nested classes/interfaces inherited from interface jist.swans.trans.TransInterface |
---|
TransInterface.SocketHandler, TransInterface.TransMessage, TransInterface.TransTcpInterface, TransInterface.TransUdpInterface |
Field Summary | |
---|---|
private static int |
DROP_PROBABILITY
probability (in percent) that a message will not be sent |
private java.util.HashMap |
handlers
Hashmap to hold references to socket callbacks. |
private NetInterface |
netEntity
Entity reference to network layer. |
private TransInterface.TransTcpInterface |
self
Entity reference to itself. |
Constructor Summary | |
---|---|
TransTcp()
Constructor. |
Method Summary | |
---|---|
void |
addSocketHandler(int port,
TransInterface.SocketHandler socketCallback)
Register socket handler. |
boolean |
checkSocketHandler(int port)
Return whether socket bound to port. |
void |
delSocketHandler(int port)
Unregister socket handler. |
TransInterface.TransTcpInterface |
getProxy()
Returns an entity reference to this object. |
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 |
setNetEntity(NetInterface netEntity)
Sets the reference to the network layer. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final int DROP_PROBABILITY
private TransInterface.TransTcpInterface self
private NetInterface netEntity
private java.util.HashMap handlers
Constructor Detail |
---|
public TransTcp()
Method Detail |
---|
public TransInterface.TransTcpInterface getProxy()
public void setNetEntity(NetInterface netEntity)
netEntity
- entity reference to network layerpublic void addSocketHandler(int port, TransInterface.SocketHandler socketCallback)
addSocketHandler
in interface TransInterface
port
- bound socket portsocketCallback
- callback handlerpublic void delSocketHandler(int port)
delSocketHandler
in interface TransInterface
port
- bound socket portpublic boolean checkSocketHandler(int port)
checkSocketHandler
in interface TransInterface.TransTcpInterface
port
- port to check
public void receive(Message msg, NetAddress src, MacAddress lastHop, byte macId, NetAddress dst, byte priority, byte ttl)
receive
in interface NetInterface.NetHandler
msg
- message receivedsrc
- source network addresslastHop
- source link addressmacId
- incoming interfacedst
- destination network addresspriority
- packet priorityttl
- packet time-to-livepublic void send(Message msg, NetAddress dst, int dstPort, int srcPort, byte priority)
send
in interface TransInterface
msg
- packet payload (usually from application layer)dst
- packet destination addressdstPort
- packet destination portsrcPort
- packet source portpriority
- packet priority
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |