Package 

Class StunDatagramPacketFilter

  • All Implemented Interfaces:
    org.ice4j.socket.DatagramPacketFilter

    
    public class StunDatagramPacketFilter
     implements DatagramPacketFilter
                        

    Implements a DatagramPacketFilter which only accepts DatagramPackets which represent STUN messages defined in RFC 5389 "Session Traversal Utilities for NAT (STUN)" i.e. with method Binding or the reserved method 0x000 and 0x002/SharedSecret.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
      StunDatagramPacketFilter() Initializes a new StunDatagramPacketFilter which will accept DatagramPackets which represent STUN messages received from any destination.
      StunDatagramPacketFilter(TransportAddress stunServer) Initializes a new StunDatagramPacketFilter which will accept DatagramPackets which represent STUN messages and which are part of the communication with a specific STUN server (or any server if stunServer is null).
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      boolean accept(DatagramPacket p) Determines whether a specific DatagramPacket represents a STUN message and whether it is part of the communication with the STUN server if one was associated with this instance.
      boolean equals(Object obj) Indicates whether some other object is "equal to" this one.
      int hashCode() Returns a hash code value for this object for the benefit of hashtables such as those provided by Hashtable.
      static boolean isStunPacket(DatagramPacket p) Determines whether a specific DatagramPacket represents a STUN (or TURN) packet.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • StunDatagramPacketFilter

        StunDatagramPacketFilter()
        Initializes a new StunDatagramPacketFilter which will accept DatagramPackets which represent STUN messages received from any destination.
      • StunDatagramPacketFilter

        StunDatagramPacketFilter(TransportAddress stunServer)
        Initializes a new StunDatagramPacketFilter which will accept DatagramPackets which represent STUN messages and which are part of the communication with a specific STUN server (or any server if stunServer is null).
        Parameters:
        stunServer - the TransportAddress of the STUN server DatagramPackets representing STUN messages from and to which will be accepted by the new instance or null if we would like to accept stun messages from any destination.
    • Method Detail

      • accept

         boolean accept(DatagramPacket p)

        Determines whether a specific DatagramPacket represents a STUN message and whether it is part of the communication with the STUN server if one was associated with this instance.

        Parameters:
        p - the DatagramPacket which is to be checked whether it is a STUN message which is part of the communicator with the STUN server associated with this instance
      • equals

         boolean equals(Object obj)

        Indicates whether some other object is "equal to" this one.

        Parameters:
        obj - the reference object with which to compare.
      • hashCode

         int hashCode()

        Returns a hash code value for this object for the benefit of hashtables such as those provided by Hashtable.

      • isStunPacket

         static boolean isStunPacket(DatagramPacket p)

        Determines whether a specific DatagramPacket represents a STUN (or TURN) packet.

        Parameters:
        p - the DatagramPacket which is to be checked whether it is a STUN message which is part of the communicator with the STUN server associated with this instance