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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
acceptMessage(AddressedByteBuf msg)
Is called for incoming messages and returns true if the message should be consumed and removed from the pipeline.void
handleMessage(HandlerContext ctx, AddressedByteBuf msg)
Is called for incoming messages and thus enables this method to react to relevant messages.void
start(HandlerContext ctx, NodeUpEvent event, Runnable onFailure)
Tells the method to create a port forwarding and renew it independently.void
stop(HandlerContext ctx)
Shall remove any existing port forwarding again.
-
-
-
Method Detail
-
start
void start(HandlerContext ctx, NodeUpEvent event, Runnable onFailure)
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 contextevent
- the node up eventonFailure
- will be called once on failure
-
stop
void stop(HandlerContext ctx)
Shall remove any existing port forwarding again.- Parameters:
ctx
- the handler context
-
handleMessage
void handleMessage(HandlerContext ctx, AddressedByteBuf msg)
Is called for incoming messages and thus enables this method to react to relevant messages.- Parameters:
ctx
- the handler contextmsg
- the message
-
acceptMessage
boolean acceptMessage(AddressedByteBuf msg)
Is called for incoming messages and returns true if the message should be consumed and removed from the pipeline.- Parameters:
msg
- the message- Returns:
true
if the message is relevant for the current port forwarding method. Otherwisefalse
-
-