An application programming interface for translation of transport-layer
sessions is presented. The system includes kernel-mode support for
application-controlled network address translation and user-mode
implementation of the redirect API routines. An application process may
request that a network gateway modify the source and/or destination of a
given network session in a manner transparent to the original source host
and/or the replacement destination host. With the generalized NAT (gNAT)
of the instant invention and its associated API, both the source and the
destination addresses of message packets may be changed. The address
changes are mapped in the gNAT, and may result in apparent sessions
between different clients and servers. Depending on the protocol in use
(e.g. TCP or UDP), the address translation may be made dynamically by the
gNAT, under the command of the application, and take place at the kernel
level.