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 TypeMethodDescriptionboolean
acceptMessage
(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.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.void
Tells the method to create a port forwarding and renew it independently.void
stop
(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,onFailure
must be called once.- Parameters:
ctx
- the handler contextport
- theUdpServer.Port
portonFailure
- 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 ofmsg
is 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:
true
if the message is relevant for the current port forwarding method. Otherwisefalse
-