![]() |
TSDuck v3.43-4426
MPEG Transport Stream Toolkit
|
Common arguments for REST API usage. More...
#include <tsRestArgs.h>
Public Types | |
using | SuperClass = TLSArgs |
Explicit definition of the superclass. | |
Public Member Functions | |
RestArgs (const UString &description=u"server", const UString &prefix=UString()) | |
Constructor. | |
virtual void | defineClientArgs (Args &args) override |
Add some command line options for a client in an Args. | |
virtual void | defineServerArgs (Args &args) override |
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) override |
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) override |
Load arguments for a server from a command line. | |
Public Attributes | |
IPAddressSet | allowed_clients {} |
White-list of allowed incoming clients. | |
UString | api_root {} |
Optional root path for api (e.g. "/serve/api"). | |
UString | auth_token {} |
Authentication token. | |
UString | certificate_path {} |
TLS server certificate path. | |
UString | certificate_store {} |
TLS server certificate store. | |
cn::milliseconds | connection_timeout {0} |
Connection timeout in milliseconds (zero means none). | |
IPAddressSet | denied_clients {} |
Black-list of denied incoming clients. | |
bool | insecure = false |
Do not verify TLS server's certificate. | |
UString | key_path {} |
TLS server private key path. | |
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). | |
bool | use_tls = false |
Use SSL/TLS. | |
Protected Attributes | |
UString | _description |
Short description of the TLS service. | |
UString | _opt_certificate_path |
Option name for –[prefix-]certificate-path. | |
UString | _opt_certificate_store |
Option name for –[prefix-]store. | |
UString | _opt_insecure |
Option name for –[prefix-]insecure. | |
UString | _opt_key_path |
Option name for –[prefix-]key-path. | |
UString | _opt_tls |
Option name for –[prefix-]tls. | |
UString | _opt_token |
Option name for –[prefix-]token. | |
UString | _prefix |
Option prefix, ready to use in other option names. | |
Common arguments for REST API usage.
Can be set by fields or using command line options.
ts::RestArgs::RestArgs | ( | const UString & | description = u"server" , |
const UString & | prefix = UString() |
||
) |
Constructor.
[in] | description | Short description of the REST service. Example: "control port" . Use no initial cap, no final dot. |
[in] | prefix | Optional prefix for all command line options. Example: when prefix is "foo" , the option –certificate-path becomes –foo-certificate-path . |
|
overridevirtual |
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.
[in,out] | args | Command line arguments to update. |
Reimplemented from ts::TLSArgs.
|
overridevirtual |
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.
[in,out] | args | Command line arguments to update. |
Reimplemented from ts::TLSArgs.
|
overridevirtual |
Load arguments for a server from a command line.
Args error indicator is set in case of incorrect arguments.
[in,out] | args | Command line arguments. |
[in] | server_option | Optional name of an option which defines the server port and optional address. |
Reimplemented from ts::TLSArgs.
|
overridevirtual |
Load arguments for a client from a command line.
Args error indicator is set in case of incorrect arguments.
[in,out] | args | Command line arguments. |
[in] | server_option | Optional name of an option which defines the server name and address. |
Reimplemented from ts::TLSArgs.
Load the set of allowed clients from a command line (server side).
[in,out] | args | Command line arguments. |
[in] | option | Option which defines the client addresses. |
Load the set of denied clients from a command line (server side).
[in,out] | args | Command line arguments. |
[in] | option | Option which defines the client addresses. |
|
inherited |
On the server side, check if a client address is allowed, based on sets of allowed and denied clients.
[in] | client | Incoming client address. |
|
inherited |
TLS server certificate store.
|
inherited |
TLS server certificate path.
|
inherited |
TLS server private key path.