java.lang.Object
org.freenetproject.ForwardPort
Direct Known Subclasses:
UPnP.IPv6ForwardPort

public class ForwardPortextends Object
A public Internet Protocol port on the node which needs to be forwarded if the node is NATed.
  • Field Summary

    Modifier and Type
    Field
    Description
    private final int
    Precomputed hash of the forwarding rule.
    final boolean
    IPv4 vs IPv6?
    final String
    Name of the interface e.g.
    final int
    Port number to forward
    final int
    Protocol number.
    static final int
    PROTOCOL_TCP_IPV4.
    static final int
    PROTOCOL_UDP_IPV4.
  • Constructor Summary

    Constructors
    Constructor
    Description
    ForwardPort(String name, boolean isIP6, int protocol, int portNumber)
    Records one interface, protocol and port to forward, and its hash.
  • Method Summary

    All Methods
    Modifier and Type
    Method
    Description
    boolean
    Compares name, family, protocol and port against another port.
    int
    Returns the name, family, protocol and port combined.

    Methods inherited from class Object

    clone, getClass, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • name

      public final String name
      Name of the interface e.g. "opennet"
    • isIP6

      public final boolean isIP6
      IPv4 vs IPv6?
    • protocol

      public final int protocol
      Protocol number. See constants.
    • PROTOCOL_UDP_IPV4

      public static final int PROTOCOL_UDP_IPV4
      PROTOCOL_UDP_IPV4.
      See Also:
    • PROTOCOL_TCP_IPV4

      public static final int PROTOCOL_TCP_IPV4
      PROTOCOL_TCP_IPV4.
      See Also:
    • portNumber

      public final int portNumber
      Port number to forward
    • hashCode

      private final int hashCode
      Precomputed hash of the forwarding rule. The rule names no internal interface - binding to one would be complicated, as different interfaces may be on different LANs and an IGD is normally on only one LAN.
  • Constructor Details

    • ForwardPort

      public ForwardPort(String name, boolean isIP6, int protocol, int portNumber)
      Records one interface, protocol and port to forward, and its hash.
      Parameters:
      name - name of the interface the port belongs to, e.g. "opennet"
      isIP6 - true for an IPv6 port, false for IPv4
      protocol - IP protocol number, PROTOCOL_UDP_IPV4 or PROTOCOL_TCP_IPV4
      portNumber - port to forward, on the named interface
  • Method Details

    • hashCode

      public int hashCode()
      Returns the name, family, protocol and port combined.
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object o)
      Compares name, family, protocol and port against another port.
      Overrides:
      equals in class Object