public class StunDatagramPacketFilter extends Object implements DatagramPacketFilter
Modifier and Type | Field and Description |
---|---|
protected TransportAddress |
stunServer
The TransportAddress of the STUN server DatagramPackets
representing STUN messages from and to which are accepted by this
instance.
|
Constructor and 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).
|
Modifier and Type | Method and 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.
|
protected boolean |
acceptMethod(char method)
Determines whether this DatagramPacketFilter accepts a
DatagramPacket which represents a STUN message with a specific
STUN method.
|
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.
|
protected final TransportAddress stunServer
public StunDatagramPacketFilter()
public StunDatagramPacketFilter(TransportAddress stunServer)
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.public boolean accept(DatagramPacket p)
accept
in interface DatagramPacketFilter
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 instanceprotected boolean acceptMethod(char method)
method
- the STUN method of a STUN message represented by a
DatagramPacket to be checked whether it is accepted by this
DatagramPacketFilterpublic boolean equals(Object obj)
public int hashCode()
public static boolean isStunPacket(DatagramPacket p)
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 instanceCopyright © 2018. All rights reserved.