|
Rice Pastry API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.mpisws.p2p.transport.wire.WireTransportLayerImpl
public class WireTransportLayerImpl
Field Summary | |
---|---|
protected java.net.InetSocketAddress |
bindAddress
|
protected Environment |
environment
|
protected ErrorHandler<java.net.InetSocketAddress> |
errorHandler
|
boolean |
forceBindAddress
true for modelnet, who needs to set the bind address even on outgoing sockets |
protected Logger |
logger
|
protected TCPLayer |
tcp
|
protected UDPLayer |
udp
|
Fields inherited from interface org.mpisws.p2p.transport.wire.WireTransportLayer |
---|
OPTION_TRANSPORT_TYPE, TRANSPORT_TYPE_DATAGRAM, TRANSPORT_TYPE_GUARANTEED |
Constructor Summary | |
---|---|
WireTransportLayerImpl(java.net.InetSocketAddress bindAddress,
Environment env,
ErrorHandler<java.net.InetSocketAddress> errorHandler)
|
|
WireTransportLayerImpl(java.net.InetSocketAddress bindAddress,
Environment env,
ErrorHandler<java.net.InetSocketAddress> errorHandler,
boolean enableServer)
|
|
WireTransportLayerImpl(java.net.InetSocketAddress bindAddress,
Environment env,
ErrorHandler<java.net.InetSocketAddress> errorHandler,
boolean enableTCPServer,
boolean enableUDPServer)
|
Method Summary | |
---|---|
void |
acceptMessages(boolean b)
Toggle accepting incoming messages. |
void |
acceptSockets(boolean b)
Toggle accepting new sockets. |
void |
addSocketCountListener(SocketCountListener<java.net.InetSocketAddress> listener)
|
void |
addTransportLayerListener(TransportLayerListener<java.net.InetSocketAddress> listener)
|
void |
broadcastChannelClosed(java.net.InetSocketAddress addr,
java.util.Map<java.lang.String,java.lang.Object> options)
|
void |
broadcastChannelOpened(java.net.InetSocketAddress addr,
java.util.Map<java.lang.String,java.lang.Object> options,
boolean outgoing)
|
void |
destroy()
|
java.net.InetSocketAddress |
getLocalIdentifier()
Notification methods |
protected java.lang.Iterable<SocketCountListener<java.net.InetSocketAddress>> |
getSlisteners()
|
protected java.lang.Iterable<TransportLayerListener<java.net.InetSocketAddress>> |
getTLlisteners()
|
protected void |
incomingSocket(P2PSocket<java.net.InetSocketAddress> sm)
|
boolean |
isDestroyed()
|
protected void |
messageReceived(java.net.InetSocketAddress address,
java.nio.ByteBuffer buffer,
java.util.Map<java.lang.String,java.lang.Object> options)
|
SocketRequestHandle<java.net.InetSocketAddress> |
openSocket(java.net.InetSocketAddress destination,
SocketCallback<java.net.InetSocketAddress> deliverSocketToMe,
java.util.Map<java.lang.String,java.lang.Object> options)
Open a socket to the Identifier |
void |
removeSocketCountListener(SocketCountListener<java.net.InetSocketAddress> listener)
|
void |
removeTransportLayerListener(TransportLayerListener<java.net.InetSocketAddress> listener)
|
MessageRequestHandle<java.net.InetSocketAddress,java.nio.ByteBuffer> |
sendMessage(java.net.InetSocketAddress destination,
java.nio.ByteBuffer m,
MessageCallback<java.net.InetSocketAddress,java.nio.ByteBuffer> deliverAckToMe,
java.util.Map<java.lang.String,java.lang.Object> options)
Send the message to the identifier |
void |
setCallback(TransportLayerCallback<java.net.InetSocketAddress,java.nio.ByteBuffer> callback)
Set the callback for incoming sockets/messages |
void |
setErrorHandler(ErrorHandler<java.net.InetSocketAddress> 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 java.net.InetSocketAddress bindAddress
protected UDPLayer udp
protected TCPLayer tcp
protected Logger logger
protected Environment environment
protected ErrorHandler<java.net.InetSocketAddress> errorHandler
public boolean forceBindAddress
Constructor Detail |
---|
public WireTransportLayerImpl(java.net.InetSocketAddress bindAddress, Environment env, ErrorHandler<java.net.InetSocketAddress> errorHandler) throws java.io.IOException
bindAddress
- the address to bind to, if it fails, it will throw an exceptionenv
- will acquire the SelectorManager from the env
java.io.IOException
public WireTransportLayerImpl(java.net.InetSocketAddress bindAddress, Environment env, ErrorHandler<java.net.InetSocketAddress> errorHandler, boolean enableServer) throws java.io.IOException
java.io.IOException
public WireTransportLayerImpl(java.net.InetSocketAddress bindAddress, Environment env, ErrorHandler<java.net.InetSocketAddress> errorHandler, boolean enableTCPServer, boolean enableUDPServer) throws java.io.IOException
java.io.IOException
Method Detail |
---|
public void setCallback(TransportLayerCallback<java.net.InetSocketAddress,java.nio.ByteBuffer> callback)
TransportLayer
setCallback
in interface TransportLayer<java.net.InetSocketAddress,java.nio.ByteBuffer>
callback
- the callback for incoming sockets/messagespublic SocketRequestHandle<java.net.InetSocketAddress> openSocket(java.net.InetSocketAddress destination, SocketCallback<java.net.InetSocketAddress> deliverSocketToMe, java.util.Map<java.lang.String,java.lang.Object> options)
TransportLayer
openSocket
in interface TransportLayer<java.net.InetSocketAddress,java.nio.ByteBuffer>
destination
- 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 MessageRequestHandle<java.net.InetSocketAddress,java.nio.ByteBuffer> sendMessage(java.net.InetSocketAddress destination, java.nio.ByteBuffer m, MessageCallback<java.net.InetSocketAddress,java.nio.ByteBuffer> deliverAckToMe, java.util.Map<java.lang.String,java.lang.Object> options)
TransportLayer
sendMessage
in interface TransportLayer<java.net.InetSocketAddress,java.nio.ByteBuffer>
destination
- the destinationm
- the messagedeliverAckToMe
- layer dependent notification when the message is sent (can indicate placed on the wire, point-to-point acknowledgment, or end-to-end acknowledgement)options
- delivery options (don't source route, encrypt etc) (may not be respected if layer cannot provide service)
public java.net.InetSocketAddress getLocalIdentifier()
getLocalIdentifier
in interface TransportLayer<java.net.InetSocketAddress,java.nio.ByteBuffer>
destination
- msg
- i
- data
- transport_type
- WireTransportLayer.TRANSPORT_TYPE_DATAGRAM or WireTransportLayer.TRANSPORT_TYPE_GUARANTEED
public void destroy()
destroy
in interface Destructable
public boolean isDestroyed()
public void setErrorHandler(ErrorHandler<java.net.InetSocketAddress> handler)
TransportLayer
setErrorHandler
in interface TransportLayer<java.net.InetSocketAddress,java.nio.ByteBuffer>
handler
- to be notified of problems not related to a specific messaage/socket.public void acceptMessages(boolean b)
TransportLayer
acceptMessages
in interface TransportLayer<java.net.InetSocketAddress,java.nio.ByteBuffer>
public void acceptSockets(boolean b)
TransportLayer
acceptSockets
in interface TransportLayer<java.net.InetSocketAddress,java.nio.ByteBuffer>
protected void messageReceived(java.net.InetSocketAddress address, java.nio.ByteBuffer buffer, java.util.Map<java.lang.String,java.lang.Object> options) throws java.io.IOException
java.io.IOException
protected void incomingSocket(P2PSocket<java.net.InetSocketAddress> sm) throws java.io.IOException
java.io.IOException
public void addTransportLayerListener(TransportLayerListener<java.net.InetSocketAddress> listener)
public void removeTransportLayerListener(TransportLayerListener<java.net.InetSocketAddress> listener)
protected java.lang.Iterable<TransportLayerListener<java.net.InetSocketAddress>> getTLlisteners()
public void addSocketCountListener(SocketCountListener<java.net.InetSocketAddress> listener)
addSocketCountListener
in interface SocketOpeningTransportLayer<java.net.InetSocketAddress>
public void removeSocketCountListener(SocketCountListener<java.net.InetSocketAddress> listener)
removeSocketCountListener
in interface SocketOpeningTransportLayer<java.net.InetSocketAddress>
protected java.lang.Iterable<SocketCountListener<java.net.InetSocketAddress>> getSlisteners()
public void broadcastChannelOpened(java.net.InetSocketAddress addr, java.util.Map<java.lang.String,java.lang.Object> options, boolean outgoing)
public void broadcastChannelClosed(java.net.InetSocketAddress addr, java.util.Map<java.lang.String,java.lang.Object> options)
|
Rice Pastry API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |