|
Rice Pastry API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.mpisws.p2p.transport.nat.FirewallTLImpl<Identifier,MessageType>
Identifier - MessageType - public class FirewallTLImpl<Identifier,MessageType>
Drops all incoming TCP connections. Drops all incoming UDP connections that we didn't initiate, or that are since UDP_OPEN_MILLIS
| Field Summary | |
|---|---|
protected TransportLayerCallback<Identifier,MessageType> |
callback
|
protected Environment |
environment
|
protected Logger |
logger
|
protected TimeSource |
timeSource
|
protected TransportLayer<Identifier,MessageType> |
tl
|
protected int |
UDP_OPEN_MILLIS
|
protected java.util.Map<Identifier,java.lang.Long> |
udpTable
Holds when we last refreshed the UDP connection |
| Constructor Summary | |
|---|---|
FirewallTLImpl(TransportLayer<Identifier,MessageType> tl,
int udp_open_millis,
Environment env)
|
|
| Method Summary | |
|---|---|
void |
acceptMessages(boolean b)
Toggle accepting incoming messages. |
void |
acceptSockets(boolean b)
Toggle accepting new sockets. |
void |
destroy()
|
Identifier |
getLocalIdentifier()
The local node. |
void |
incomingSocket(P2PSocket<Identifier> s)
Only allow outgoing sockets. |
void |
messageReceived(Identifier i,
MessageType m,
java.util.Map<java.lang.String,java.lang.Object> options)
Called when a new message is received. |
SocketRequestHandle<Identifier> |
openSocket(Identifier i,
SocketCallback<Identifier> deliverSocketToMe,
java.util.Map<java.lang.String,java.lang.Object> options)
Open a socket to the Identifier |
MessageRequestHandle<Identifier,MessageType> |
sendMessage(Identifier i,
MessageType m,
MessageCallback<Identifier,MessageType> deliverAckToMe,
java.util.Map<java.lang.String,java.lang.Object> options)
Send the message to the identifier |
void |
setCallback(TransportLayerCallback<Identifier,MessageType> callback)
Set the callback for incoming sockets/messages |
void |
setErrorHandler(ErrorHandler<Identifier> handler)
To be notified of problems not related to an outgoing messaage/socket. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final int UDP_OPEN_MILLIS
protected java.util.Map<Identifier,java.lang.Long> udpTable
protected TransportLayer<Identifier,MessageType> tl
protected TransportLayerCallback<Identifier,MessageType> callback
protected TimeSource timeSource
protected Environment environment
protected Logger logger
| Constructor Detail |
|---|
public FirewallTLImpl(TransportLayer<Identifier,MessageType> tl,
int udp_open_millis,
Environment env)
tl - udp_open_millis - how long the udp hole remains open| Method Detail |
|---|
public MessageRequestHandle<Identifier,MessageType> sendMessage(Identifier i,
MessageType m,
MessageCallback<Identifier,MessageType> deliverAckToMe,
java.util.Map<java.lang.String,java.lang.Object> options)
TransportLayer
sendMessage in interface TransportLayer<Identifier,MessageType>i - the destinationm - the messagedeliverAckToMe - layer dependent notification when the message is sent (can indicate placed on the wire, point-to-point acknowledgement, or end-to-end acknowledgement)options - delivery options (don't source route, encrypt etc) (may not be respected if layer cannot provide service)
public void messageReceived(Identifier i,
MessageType m,
java.util.Map<java.lang.String,java.lang.Object> options)
throws java.io.IOException
TransportLayerCallback
messageReceived in interface TransportLayerCallback<Identifier,MessageType>i - The node it is coming fromm - the messageoptions - describe how the message arrived (udp/tcp, encrypted etc)
java.io.IOException - if there is a problem decoding the message
public void incomingSocket(P2PSocket<Identifier> s)
throws java.io.IOException
incomingSocket in interface TransportLayerCallback<Identifier,MessageType>s - the incoming socket
java.io.IOExceptionpublic void acceptMessages(boolean b)
TransportLayer
acceptMessages in interface TransportLayer<Identifier,MessageType>public void acceptSockets(boolean b)
TransportLayer
acceptSockets in interface TransportLayer<Identifier,MessageType>public Identifier getLocalIdentifier()
TransportLayer
getLocalIdentifier in interface TransportLayer<Identifier,MessageType>
public SocketRequestHandle<Identifier> openSocket(Identifier i,
SocketCallback<Identifier> deliverSocketToMe,
java.util.Map<java.lang.String,java.lang.Object> options)
TransportLayer
openSocket in interface TransportLayer<Identifier,MessageType>i - who to open the socket todeliverSocketToMe - the callback when the socket is openedoptions - options on how to open the socket (don't source route, encrypt etc) (may not be respected if layer cannot provide service)
public void setCallback(TransportLayerCallback<Identifier,MessageType> callback)
TransportLayer
setCallback in interface TransportLayer<Identifier,MessageType>callback - the callback for incoming sockets/messagespublic void setErrorHandler(ErrorHandler<Identifier> handler)
TransportLayer
setErrorHandler in interface TransportLayer<Identifier,MessageType>handler - to be notified of problems not related to a specific messaage/socket.public void destroy()
destroy in interface Destructable
|
Rice Pastry API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||