Interface PortMapping
- All Known Implementing Classes:
NatPmpPortMapping,PcpPortMapping,UpnpIgdPortMapping
public interface PortMapping
Represents a method for creating port forwarding (e.g., PCP, NAT-PMP, or UPnP-IGD).
-
Method Summary
Modifier and TypeMethodDescriptionbooleanacceptMessage(InetSocketAddress sender, io.netty.buffer.ByteBuf msg) Is called for incoming messages and returns true if the message should be consumed and removed from the pipeline.voidhandleMessage(io.netty.channel.ChannelHandlerContext ctx, InetSocketAddress sender, io.netty.buffer.ByteBuf msg) Is called for incoming messages and thus enables this method to react to relevant messages.voidTells the method to create a port forwarding and renew it independently.voidstop(io.netty.channel.ChannelHandlerContext ctx) Shall remove any existing port forwarding again.
-
Method Details
-
start
Tells the method to create a port forwarding and renew it independently. If no forwarding can be created,onFailuremust be called once.- Parameters:
ctx- the handler contextport- theUdpServer.PortportonFailure- will be called once on failure
-
stop
void stop(io.netty.channel.ChannelHandlerContext ctx) Shall remove any existing port forwarding again.- Parameters:
ctx- the handler context
-
handleMessage
void handleMessage(io.netty.channel.ChannelHandlerContext ctx, InetSocketAddress sender, io.netty.buffer.ByteBuf msg) Is called for incoming messages and thus enables this method to react to relevant messages.ReferenceCounted.release()ownership ofmsgis transferred to thisPartialReadMessage.- Parameters:
ctx- the handler contextsender- the sender of the messagemsg- the message
-
acceptMessage
Is called for incoming messages and returns true if the message should be consumed and removed from the pipeline.- Parameters:
sender- the sender of the messagemsg- the message- Returns:
trueif the message is relevant for the current port forwarding method. Otherwisefalse
-