TURN module (rfc5766)

FiveTuple

TURN allocation identity tuple: client remote address, server local address, and transport protocol.

FiveTuple

#include <icy/turn/fivetuple.h>

TURN allocation identity tuple: client remote address, server local address, and transport protocol.

The TURN 5-tuple consists of a local address, a remote address, and the transport protocol used by the client to communicate with the server.

                                                          +---------+
                                                          |         |
                                                          | External|
                                                        / | Client  |
                                                      //  |         |
                                                     /    |         |
                                                   //     +---------+
                                                  /
                                                //
                +-+                            /
                | |                           /
                | |                         //
 +---------+    | |          +---------+   /              +---------+
 |         |    |N|          |         | //               |         |
 | TURN    |    | |          |         |/                 | External|
 | Client  |----|A|----------|   TURN  |------------------| Client  |
 |         |    | |^        ^|  Server |^                ^|         |
 |         |    |T||        ||         ||                ||         |
 +---------+    | ||        |+---------+|                |+---------+
    ^           | ||        |           |                |
    |           | ||        |           |                |
    |           +-+|        |           |                |
    |              |        |           |                |
    |
               Internal     Internal    External         External
Client         Remote       Local       Local            Remote
Performing     Transport    Transport   Transport        Transport
Allocations    Address      Address     Address          Address

                   |          |            |                |
                   +-----+----+            +--------+-------+
                         |                          |
                         |                          |

                       Internal                External
                       5-Tuple                 5-tuple

Public Methods

ReturnNameDescription
FiveTupleConstructs a default FiveTuple with empty addresses and UDP transport.
FiveTupleConstructs a FiveTuple from explicit addresses and transport.
FiveTupleCopy constructor.
const net::Address &remote const inline#### Returns
const net::Address &local const inline#### Returns
const net::TransportType &transport const inline#### Returns
voidremote inlineSets the remote address.
voidlocal inlineSets the local address.
voidtransport inlineSets the transport protocol.
booloperator== constEquality comparison; all three components must match.
booloperator< constLess-than ordering based on remote then local port; used as std::map key.
std::stringtoString const#### Returns

FiveTuple

FiveTuple()

Constructs a default FiveTuple with empty addresses and UDP transport.


FiveTuple

FiveTuple(const net::Address & remote, const net::Address & local, net::TransportType transport)

Constructs a FiveTuple from explicit addresses and transport.

Parameters

  • remote Client's remote transport address (as seen by the server).

  • local Server's local transport address.

  • transport Protocol in use (net::UDP or net::TCP).


FiveTuple

FiveTuple(const FiveTuple & r)

Copy constructor.


remote

const inline

inline const net::Address & remote() const

Returns

The remote (client-side) transport address.


local

const inline

inline const net::Address & local() const

Returns

The local (server-side) transport address.


transport

const inline

inline const net::TransportType & transport() const

Returns

The transport protocol for this tuple.


remote

inline

inline void remote(const net::Address & remote)

Sets the remote address.

Parameters

  • remote New remote address.

local

inline

inline void local(const net::Address & local)

Sets the local address.

Parameters

  • local New local address.

transport

inline

inline void transport(const net::TransportType & transport)

Sets the transport protocol.

Parameters

  • transport New transport type.

operator==

const

bool operator==(const FiveTuple & r) const

Equality comparison; all three components must match.


operator<

const

bool operator<(const FiveTuple & r) const

Less-than ordering based on remote then local port; used as std::map key.


toString

const

std::string toString() const

Returns

A human-readable string of the form "FiveTuple[remote:local:transport]".

Private Attributes

ReturnNameDescription
net::Address_remote
net::Address_local
net::TransportType_transport

_remote

net::Address _remote

_local

net::Address _local

_transport

net::TransportType _transport