tfNatConfigNapt
Table of Contents >> Optional Protocols >> NAT
| #include <trsocket.h> |
| int tfNatConfigNapt | ( |
| ttUserInterface interfaceHandle, | |
| ttUserIpAddress ipPublic, | |
| ttUserIpPort portPublicMin, | |
| ttUserIpPort portPublicMax | |
| ); |
Function Description
This function defines a range of port numbers that are used to route traffic from multiple private machines through the NAT router to the public network.
The user should call tfNatConfigNapt() only once on a public NAT interface. Also, the user should not use the ipPublic value in any other NAT configuration function but the one call to tfNatConfigNapt() except for the tfNatConfigInnter...Server() functions (tfNatConfigInnerFtpServer(), tfNatConfigInnerTcpServer(), and tfNatConfigInnerUdpServer()).
tfNatConfigNapt() should be called before any tfNatConfigStatic() or tfNatConfigDynamic() calls on the same interface. In that case, NAPT would only be used for non-statically assigned machines after all dynamic associations were already in use.
Though UDP ports never conflict with TCP ports, there is only one "next port" maintained, so ports are allocated as if they did conflict.
Parameters
- interfaceHandle
- The interface handle of the public NAT device on which to configure routing.
- ipPublic
- The public IP address in network byte order.
- portPublicMax
- Inclusive range of port numbers in host byte order.
- portPublicMin
- Inclusive range of port numbers in host byte order.
Returns
- TM_ENOERROR
- Success.
- TM_EINVAL
- The 'portPublicMin' value is greater than the 'portPublicMax' value.
- TM_ENOMEM
- Insufficient memory to complete the operation.