|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.tomp2p.natpmp.Message
net.tomp2p.natpmp.MapRequestMessage
public class MapRequestMessage
This class manages an External Address message. This class is thread-safe. After instantiation, this class may be
added to the message queue on the NatPmpDevice
. It is important to remove the mapping before shutdown of the
NatPmpDevice
. Refer to the parameters of
#MapRequestMessage(boolean, int, int, long, com.hoodcomputing.natpmp.MessageResponseInterface)
for details of
how to perform this.
Constructor Summary | |
---|---|
MapRequestMessage(boolean isTCP,
int internalPort,
int requestedExternalPort,
int requestedPortMappingLifetime,
MessageResponseInterface listener)
Constructs a new MapRequestMessage . |
Method Summary | |
---|---|
Integer |
getExternalPort()
Gets the external port that was assigned. |
int |
getInternalPort()
Gets the internal port on which mapped data will arrive. |
Integer |
getPortMappingLifetime()
Gets the assigned port mapping lifetime. |
int |
getRequestedExternalPort()
Get sthe external port that was requested. |
int |
getRequestedPortMappingLifetime()
Gets the requested port mapping lifetime. |
Methods inherited from class net.tomp2p.natpmp.Message |
---|
getResponseException, getResultCode, getSecondsSinceEpoch |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MapRequestMessage(boolean isTCP, int internalPort, int requestedExternalPort, int requestedPortMappingLifetime, MessageResponseInterface listener)
MapRequestMessage
. If requestedPortMappingLifetime is zero, an existing port mapping is
removed. If both internalPort and requestedPortMappingLifetime are zero, then all mappings for this host are
removed.
isTCP
- A value of true indicates that this is a TCP mapping. A value of false indicates that this is a UDP
mapping.internalPort
- The port on which this client is listening. A value of zero, along with a lifetime of zero
indicates that all port mappings for this client are to be removed.requestedExternalPort
- The external port to request. This port may not be available. Always check the
result of the Message to determine which external port is assigned. A value of zero indicates that the
NAT-PMP Gateway should choose a port on its own.requestedPortMappingLifetime
- The time, in seconds, to request the mapping for. A value of zero requests
that this mapping is removed. Always check the result of the Message to determine the actual lifetime
that was assigned, as it may be different than the requested. The recommended port mapping lifetime is
3600 seconds. The protocol specifies an unsigned integer for this parameter, however Java will not
support that as a data type. Therefore, the parameter is given as a long. Do not assign values larger
than an unsigned int can handle to this parameter.listener
- The MessageResponseInterface
that will respond to the message result.Method Detail |
---|
public int getInternalPort()
public int getRequestedExternalPort()
public Integer getExternalPort() throws NatPmpException
NatPmpException
- Thrown if there was an exception generated during the parsing of the respnse.public int getRequestedPortMappingLifetime()
public Integer getPortMappingLifetime() throws NatPmpException
NatPmpException
- Thrown if there was an exception generated during the parsing of the respnse.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |