FreeRDP
Loading...
Searching...
No Matches
freerdp_udp_listener Struct Reference

Internal library implementation of include/freerdp/server/udp.h and the server UDP API, including the listener, flows, relays, and peer flow hooks. More...

Collaboration diagram for freerdp_udp_listener:

Data Fields

CRITICAL_SECTION lock
udpListenerSocket sockets [UDPLISTENER_MAX_SOCKETS]
size_t socketCount
udpListenerSocket retired [UDPLISTENER_MAX_SOCKETS]
size_t retiredCount
wHashTable * entriesByHash
wHashTable * entriesByAddress
udpListenerRelay * relays
size_t relayCount
HANDLE relayThread
LONG relayStop
LONG relayFailed
SOCKET relayWake [2]
HANDLE thread
HANDLE wake
LONG stop
BOOL shared
BOOL freed
BYTE buffer [0x10000]

Detailed Description

Internal library implementation of include/freerdp/server/udp.h and the server UDP API, including the listener, flows, relays, and peer flow hooks.

FreeRDP: A Remote Desktop Protocol Implementation Server UDP listener for multitransport tunnels

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Following [MS-RDPEMT] 1.3, clients send RDP-UDP SYN packets to the TCP connection's address and port. The listener demultiplexes incoming datagrams by routing them to the corresponding flow, where a per-flow tunnel thread processes them. The listener thread performs no protocol work to prevent slow clients from blocking others.

  • freerdp_udp_listener owns the sockets and demuxes datagrams by client. It runs in its own thread or via an event loop.
  • rdpUdpFlow represents the datagram path for one client and is the only network component a tunnel requires.
  • rdpUdpPeerHooks allows a peer to specify the datagram source for its flow, track UDP connection progress, and pace transmissions.

Servers that fork per connection or delegate to per-user processes serve clients outside the process owning the port. Such servers keep the listener in the port-owning process and use a socket pair per connection via freerdp_udp_socket_pair(). One end of the pair is passed to the child process:

  • In the connection process: OfferTunnel calls freerdp_udp_flow_set_socket() with one end and passes the other end along with cookieHash.
  • In the port-owning process: freerdp_udp_listener_add_relay() handles the remaining setup.

The connection process never accesses the shared socket, preventing it from reading other users' datagrams. Listener and socket-pair sockets are close-on-exec; a child that forks without exec must call freerdp_udp_listener_close_after_fork() instead of freerdp_udp_listener_free(). The relay ends when either socket in the pair closes.

Datagrams are identified by source address; only the client's SYN ties a datagram to a connection via a cleartext hash. A UDP connection is unproven until the security cookie arrives within the TLS session (see FreeRDP_UdpLinkState). A source address remains bound to its connection until termination; new connections from the same address/port (e.g., via NAT) remain on TCP until then. The flow binds to the address of the first SYN and its cookie hash; if the client's NAT assigns a new port, the tunnel ends.

A tunnel allows at most 4096 datagrams in flight (~5 MB per round trip, e.g., 50 MB/s at 100 ms), though the congestion window may be smaller.

Definition at line 165 of file udplistener_internal.h.

Field Documentation

◆ buffer

BYTE freerdp_udp_listener::buffer[0x10000]

Definition at line 196 of file udplistener_internal.h.

◆ entriesByAddress

wHashTable* freerdp_udp_listener::entriesByAddress

Definition at line 178 of file udplistener_internal.h.

◆ entriesByHash

wHashTable* freerdp_udp_listener::entriesByHash

Definition at line 177 of file udplistener_internal.h.

◆ freed

BOOL freerdp_udp_listener::freed

Definition at line 194 of file udplistener_internal.h.

◆ lock

CRITICAL_SECTION freerdp_udp_listener::lock

Definition at line 167 of file udplistener_internal.h.

◆ relayCount

size_t freerdp_udp_listener::relayCount

Definition at line 182 of file udplistener_internal.h.

◆ relayFailed

LONG freerdp_udp_listener::relayFailed

Definition at line 186 of file udplistener_internal.h.

◆ relays

udpListenerRelay* freerdp_udp_listener::relays

Definition at line 181 of file udplistener_internal.h.

◆ relayStop

LONG freerdp_udp_listener::relayStop

Definition at line 184 of file udplistener_internal.h.

◆ relayThread

HANDLE freerdp_udp_listener::relayThread

Definition at line 183 of file udplistener_internal.h.

◆ relayWake

SOCKET freerdp_udp_listener::relayWake[2]

Definition at line 187 of file udplistener_internal.h.

◆ retired

udpListenerSocket freerdp_udp_listener::retired[UDPLISTENER_MAX_SOCKETS]

Definition at line 173 of file udplistener_internal.h.

◆ retiredCount

size_t freerdp_udp_listener::retiredCount

Definition at line 174 of file udplistener_internal.h.

◆ shared

BOOL freerdp_udp_listener::shared

Definition at line 193 of file udplistener_internal.h.

◆ socketCount

size_t freerdp_udp_listener::socketCount

Definition at line 170 of file udplistener_internal.h.

◆ sockets

udpListenerSocket freerdp_udp_listener::sockets[UDPLISTENER_MAX_SOCKETS]

Definition at line 169 of file udplistener_internal.h.

◆ stop

LONG freerdp_udp_listener::stop

Definition at line 191 of file udplistener_internal.h.

◆ thread

HANDLE freerdp_udp_listener::thread

Definition at line 189 of file udplistener_internal.h.

◆ wake

HANDLE freerdp_udp_listener::wake

Definition at line 190 of file udplistener_internal.h.


The documentation for this struct was generated from the following file: