Tls Dtls Controller Module
- class mtf.network_port.tls_dtls_controller.TLSController
TLSController is responsible for creating and managing secure TLS client and server instances.
It provides methods to create, retrieve, and manage TLSClient and TLSServer instances using specified configurations and optional callbacks.
- Attributes:
_secure_clients (dict): A dictionary to store TLSClient instances keyed by their names. _secure_servers (dict): A dictionary to store TLSServer instances keyed by their names.
- classmethod create_secure_client(name: str, config: TLSConfigurator) TLSClient
Creates a TLSClient instance with the provided name and configuration.
- Args:
name (str): Name of the client. config (TLSConfigurator): Configuration for the client.
- Returns:
TLSClient: Instance of the created TLSClient.
- classmethod create_secure_server(name: str, config: TLSConfigurator, callback=None) TLSServer
Creates a TLSServer instance with the provided name, configuration, and callback.
- Args:
name (str): Name of the server. config (TLSConfigurator): Configuration for the server. callback (function, optional): Callback function for the server.
- Returns:
TLSServer: Instance of the created TLSServer.
- classmethod get_secure_client(name: str) TLSClient
Retrieves a TLSClient instance by name.
- Args:
name (str): Name of the client.
- Returns:
TLSClient: TLSClient instance associated with the provided name, if exists.
- classmethod get_secure_server(name: str) TLSServer
Retrieves a TLSServer instance by name.
- Args:
name (str): Name of the server.
- Returns:
TLSServer: TLSServer instance associated with the provided name, if exists.
- clean_up() bool
Simple cleanup method to clear all registered clients and servers.
- Returns:
True if the cleanup was done successfully.
- static __new__(cls, *args, **kwargs)
Initialize a new instance of the ControllerBase.
The instance will be automatically added to the list of controllers.
- classmethod controllers_cleanup()
Clean up all controller instances.
Calls the clean_up() method for each instance.