TSDuck v3.43-4426
MPEG Transport Stream Toolkit
Loading...
Searching...
No Matches

Common arguments for IP clients and servers, UDP and TCP. More...

#include <tsIPArgs.h>

Inheritance diagram for ts::IPArgs:
Collaboration diagram for ts::IPArgs:

Public Member Functions

 IPArgs (const UString &description=u"server", const UString &prefix=UString())
 Constructor.
 
virtual void defineClientArgs (Args &args)
 Add some command line options for a client in an Args.
 
virtual void defineServerArgs (Args &args)
 Add command line options for a server in an Args.
 
bool isAllowed (const IPAddress &client) const
 On the server side, check if a client address is allowed, based on sets of allowed and denied clients.
 
bool loadAllowedClients (Args &args, const UChar *option)
 Load the set of allowed clients from a command line (server side).
 
virtual bool loadClientArgs (Args &args, const UChar *server_option=nullptr)
 Load arguments for a client from a command line.
 
bool loadDeniedClients (Args &args, const UChar *option)
 Load the set of denied clients from a command line (server side).
 
virtual bool loadServerArgs (Args &args, const UChar *server_option=nullptr)
 Load arguments for a server from a command line.
 

Public Attributes

IPAddressSet allowed_clients {}
 White-list of allowed incoming clients.
 
cn::milliseconds connection_timeout {0}
 Connection timeout in milliseconds (zero means none).
 
IPAddressSet denied_clients {}
 Black-list of denied incoming clients.
 
cn::milliseconds receive_timeout {0}
 Reception timeout in milliseconds (zero means none).
 
bool reuse_port = true
 Reuse-port socket option.
 
IPSocketAddress server_addr {}
 Server address and port. The address is optional on server side.
 
UString server_name {}
 Server host name (required in addition to server address in some cases).
 

Protected Attributes

UString _description
 Short description of the TLS service.
 
UString _prefix
 Option prefix, ready to use in other option names.
 

Detailed Description

Common arguments for IP clients and servers, UDP and TCP.

Can be set by fields or using command line options.

Constructor & Destructor Documentation

◆ IPArgs()

ts::IPArgs::IPArgs ( const UString description = u"server",
const UString prefix = UString() 
)

Constructor.

Parameters
[in]descriptionShort description of the TLS service. Example: "control port". Use no initial cap, no final dot.
[in]prefixOptional prefix for all command line options. Example: when prefix is "foo", the option –certificate-path becomes –foo-certificate-path.

Member Function Documentation

◆ defineServerArgs()

virtual void ts::IPArgs::defineServerArgs ( Args args)
virtual

Add command line options for a server in an Args.

No options is defined for server [addr:]port because the description is probably too specific. Same for lists of allowed and denied clients.

Parameters
[in,out]argsCommand line arguments to update.

Reimplemented in ts::TLSArgs, and ts::RestArgs.

◆ defineClientArgs()

virtual void ts::IPArgs::defineClientArgs ( Args args)
virtual

Add some command line options for a client in an Args.

No options is defined for server addr:port because the description is probably too specific.

Parameters
[in,out]argsCommand line arguments to update.

Reimplemented in ts::TLSArgs, and ts::RestArgs.

◆ loadServerArgs()

virtual bool ts::IPArgs::loadServerArgs ( Args args,
const UChar server_option = nullptr 
)
virtual

Load arguments for a server from a command line.

Args error indicator is set in case of incorrect arguments.

Parameters
[in,out]argsCommand line arguments.
[in]server_optionOptional name of an option which defines the server port and optional address.
Returns
True on success, false on error in argument line.

Reimplemented in ts::TLSArgs, and ts::RestArgs.

◆ loadClientArgs()

virtual bool ts::IPArgs::loadClientArgs ( Args args,
const UChar server_option = nullptr 
)
virtual

Load arguments for a client from a command line.

Args error indicator is set in case of incorrect arguments.

Parameters
[in,out]argsCommand line arguments.
[in]server_optionOptional name of an option which defines the server name and address.
Returns
True on success, false on error in argument line.

Reimplemented in ts::TLSArgs, and ts::RestArgs.

◆ loadAllowedClients()

bool ts::IPArgs::loadAllowedClients ( Args args,
const UChar option 
)
inline

Load the set of allowed clients from a command line (server side).

Parameters
[in,out]argsCommand line arguments.
[in]optionOption which defines the client addresses.
Returns
True on success, false on error in argument line.

◆ loadDeniedClients()

bool ts::IPArgs::loadDeniedClients ( Args args,
const UChar option 
)
inline

Load the set of denied clients from a command line (server side).

Parameters
[in,out]argsCommand line arguments.
[in]optionOption which defines the client addresses.
Returns
True on success, false on error in argument line.

◆ isAllowed()

bool ts::IPArgs::isAllowed ( const IPAddress client) const

On the server side, check if a client address is allowed, based on sets of allowed and denied clients.

Parameters
[in]clientIncoming client address.
Returns
True if the client is allowed, false if it is denied.

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