![Texas TMS320C6000 Programmer'S Reference Manual Download Page 205](http://html.mh-extra.com/html/texas/tms320c6000/tms320c6000_programmers-reference-manual_1093844205.webp)
NAT Operation
B-12
B.1.4.3 Stack Support for Proxy Filters
The bad news for the modification procedure discussed above is multifaceted:
1) The creation of the first data connection wildcard entry depends on the
knowledge by some entity that an FTP control connection has occurred,
and what IP/PORT the connection occurred on.
2) The creation of the second data connection wildcard entry depends on the
detection of a PORT command being passed from the client to the server.
3) The modification of the data payload of the packet containing the PORT
command requires that some entity is examining packet payloads.
4) Modification of a TCP packet payload can permanently alter the values of
the TCP sequence and acknowledge fields in the TCP header of all future
packets on the control connection.
The first three problems are very specific to FTP, and the fourth problem (TCP
sequence) is specific to any alteration of a TCP packet payload. The good
news is that the proxy filter support routines remove much of the burden of sup-
porting these transformations.
The solution is twofold. First, the stack allows a programmer to install “proxy
filter” callback functions on specified TCP/UDP port values, either outgoing
(for clients) or incoming (for servers). There are three callback functions in-
volved.
The first callback function “Enable” is called when a new connected is at-
tempted, or when the NAT entry expires. This function allows the programmer
to establish the basic connection state for the protocol in question. In the case
of the FTP client example, the first wildcard data connection mapping would
be installed here. Note that this function can also be used to filter connection
requests. If this function returns zero, the connection request is ignored.
The second and third callback functions are mirrors of the other. They are the
“Tx” and “Rx” functions. The “Tx” callback is called with the IP header of every
packet that passes from the LAN to the WAN for the connection in question,
while the “Rx” callback is called with the IP header of every packet that passes
from the WAN to the LAN. While in these functions, the programmer can call
a “packet modify” function to modify the payload of the packet. The system will
automatically track and perform modifications to the TCP sequence values
(when using TCP).