CIMIndicationListener¶
-
class
lmiwbem.lmiwbem_core.
CIMIndicationListener
(listen_address, port, certfile=None, keyfile=None, trust_store=None)¶ Parameters: - listen_address (unicode) – Bind address
- port (int) – Listening port
- certfile (unicode) – Path to X509 certificate
- keyfile (unicode) – Path to X509 private key; may be None, if cert_file also contains private key
- trust_store (unicode) – Path to trust store
-
__repr__
()¶ Returns: Pretty string of the object Return type: unicode
-
add_handler
(name, handler, *args, **kwargs)¶ Adds callback for specific indication.
Parameters: - name (str) – Indication name
- handler – Callable for indication
- *args – Positional arguments passed to handler
- **kwargs – Keyword arguments passed to handler
Example
Simple indication handler:
def indication_handler(ind, *args, **kwargs): ''' Indication handler. Args: ind (CIMInstance): Exported indication *args: Positional arguments passed from CIMIndicationListener.add_handler() **kwargs: Keyword arguments passed from CIMIndicationListener.add_handler() ''' # Do something with the indication pass
-
handlers
¶ Returns: List of indication names which the listener accepts.
-
is_alive
¶ Returns: True, if the listener is running; False otherwise.
-
listen_address
¶
-
port
¶
-
remove_handler
(name)¶ Removes a specified handler from indication listener.
Parameters: name (str) – Indication name Raises: KeyError
– When such indication is not registered
-
start
(retries=1)¶ Starts indication listener.
Parameters: retries (int) – Number of bind retries Raises: ConnectionError
– When the listener can’t bind to specified port.Example
Let’s assume, ports 12345, 12346 are in use and 12347 is unused; but we can bind to ports in range <12345-12355>:
listener = CIMIndicationListener('localhost', 12345) listener.start(10) listener.port == 12347 # True
-
stop
()¶ Stops indication listener.
-
uses_ssl
¶ Returns: True, if the listener uses secure connection; False otherwise.