The Open Master Hearing Aid (openMHA)  openMHA
Open community platform for hearing aid algorithm research
io_asterisk_parser_t Class Reference

The parser interface of the IOAsterisk library. More...

Inheritance diagram for io_asterisk_parser_t:
Inheritance graph

Public Member Functions

virtual const std::string & get_local_address () const
 Read parser variable local_address, this is the address of the network interface that should listen for incoming connections. More...
 
virtual unsigned short get_local_port () const
 Read parser variable local_port, this is the TCP port that should be used for incoming connections. More...
 
virtual void set_local_port (unsigned short port)
 Set parser variable local_port. More...
 
virtual bool get_server_port_open () const
 Return the status of the server port as it is known to the parser. More...
 
virtual void set_server_port_open (bool open)
 Inform the parser of the current status of the server socket. More...
 
virtual bool get_connected () const
 Return the parser's knowledge concerning wether there currently exists an established sound data TCP connection or not. More...
 
virtual void set_connected (bool connected)
 Inform the parser about the existance of a sound data connection. More...
 
virtual void set_new_peer (unsigned short port, const std::string &host)
 Set parser monitor variables peer_port and peer_address, and calls set_connected(true). More...
 
 io_asterisk_parser_t ()
 Constructor initializes parser variables. More...
 
virtual ~io_asterisk_parser_t ()
 Do-nothing destructor. More...
 
virtual void debug (const std::string &message)
 
- Public Member Functions inherited from MHAParser::parser_t
 parser_t (const std::string &help_text="")
 Construct detached node to be used in the configuration tree. More...
 
 ~parser_t ()
 
void insert_item (const std::string &, base_t *)
 Register a parser item into this sub-parser. More...
 
void remove_item (const std::string &)
 Remove an item by name. More...
 
void force_remove_item (const std::string &)
 Remove an item by name. More...
 
void remove_item (const base_t *)
 Remove an item by address. More...
 
- Public Member Functions inherited from MHAParser::base_t
 base_t (const std::string &)
 Constructor for base class of all parser nodes. More...
 
 base_t (const base_t &)
 Copy constructor for base_t. More...
 
base_toperator= (const base_t &)=default
 
 base_t (base_t &&)=delete
 
base_toperator= (base_t &&)=delete
 
virtual ~base_t ()
 
virtual std::string parse (const std::string &)
 Causes this node to process a command in the openMHA configuration language. More...
 
virtual void parse (const char *, char *, unsigned int)
 This function parses a command and writes the parsing result into a C character array. More...
 
virtual void parse (const std::vector< std::string > &, std::vector< std::string > &)
 
virtual std::string query_perm (const std::string &)
 
virtual std::string query_range (const std::string &)
 
std::string query_version (const std::string &)
 
std::string query_id (const std::string &)
 
std::string query_subst (const std::string &)
 
std::string query_addsubst (const std::string &)
 
std::string query_help (const std::string &)
 
std::string query_cmds (const std::string &)
 
void set_node_id (const std::string &)
 Set the identification string of this parser node. More...
 
void set_help (const std::string &)
 Set the help comment of a variable or parser. More...
 
void add_parent_on_insert (parser_t *, std::string)
 
void rm_parent_on_remove (parser_t *)
 
const std::string & fullname () const
 Return the full dot-separated path name of this parser node in the openMHA configuration tree. More...
 

Private Attributes

MHAParser::string_t local_address
 Lets the user set the local network interface to listen on. More...
 
MHAParser::int_t local_port
 Lets the user choose the local tcp port to listen on. More...
 
MHAParser::int_mon_t server_port_open
 Indicates wether the TCP server socket is currently open. More...
 
MHAParser::int_mon_t connected
 Indicator if there currently is a sound data connection over TCP. More...
 
MHAParser::string_mon_t peer_address
 Display the ip address of the currently connected sound data client. More...
 
MHAParser::int_mon_t peer_port
 Display the tcp port used by the current sound data client. More...
 
MHAParser::string_t debug_filename
 filename to write debugging info to (if non-empty) More...
 
FILE * debug_file
 file handle to write debugging info to More...
 

Additional Inherited Members

- Public Attributes inherited from MHAParser::base_t
MHAEvents::emitter_t writeaccess
 Event emitted on write access. More...
 
MHAEvents::emitter_t valuechanged
 Event emitted if the value has changed. More...
 
MHAEvents::emitter_t readaccess
 Event emitted on read access. More...
 
MHAEvents::emitter_t prereadaccess
 Event emitted on read access, before the data field is accessed. More...
 
- Protected Member Functions inherited from MHAParser::parser_t
std::string op_subparse (expression_t &)
 
std::string op_setval (expression_t &)
 
std::string op_query (expression_t &)
 
std::string query_type (const std::string &)
 
std::string query_dump (const std::string &)
 
std::string query_entries (const std::string &)
 
std::string query_readfile (const std::string &)
 
std::string query_savefile (const std::string &)
 
std::string query_savefile_compact (const std::string &)
 
std::string query_savemons (const std::string &)
 
std::string query_val (const std::string &)
 
std::string query_listids (const std::string &)
 
void set_id_string (const std::string &)
 
bool has_entry (const std::string &)
 
- Protected Member Functions inherited from MHAParser::base_t
void activate_query (const std::string &, query_t)
 
void notify ()
 
- Protected Attributes inherited from MHAParser::base_t
query_map_t queries
 
bool data_is_initialized
 

Detailed Description

The parser interface of the IOAsterisk library.

Constructor & Destructor Documentation

◆ io_asterisk_parser_t()

io_asterisk_parser_t::io_asterisk_parser_t ( )

Constructor initializes parser variables.

◆ ~io_asterisk_parser_t()

virtual io_asterisk_parser_t::~io_asterisk_parser_t ( )
inlinevirtual

Do-nothing destructor.

Member Function Documentation

◆ get_local_address()

virtual const std::string& io_asterisk_parser_t::get_local_address ( ) const
inlinevirtual

Read parser variable local_address, this is the address of the network interface that should listen for incoming connections.

Returns
A string containing the address of the local interface as it was set by the user.

◆ get_local_port()

unsigned short io_asterisk_parser_t::get_local_port ( ) const
virtual

Read parser variable local_port, this is the TCP port that should be used for incoming connections.

Returns
The local tcp port to listen on as it was chosen by the user. The port number is between MIN_TCP_PORT and MAX_TCP_PORT.

◆ set_local_port()

void io_asterisk_parser_t::set_local_port ( unsigned short  port)
virtual

Set parser variable local_port.

This is needed when it was set to 0 before: In this case, the OS chooses a free port for the TCP server socket, and the port that it chose has to be published to the user over the parser interface.

Parameters
portThe TCP port number that is currently used. In the range [MIN_TCP_PORT, MAX_TCP_PORT], excluding 0.
Precondition
get_local_port() currently returns 0.

◆ get_server_port_open()

bool io_asterisk_parser_t::get_server_port_open ( ) const
virtual

Return the status of the server port as it is known to the parser.

Returns
false after initialization, or the value most recently set via
See also
set_server_port_open.

◆ set_server_port_open()

void io_asterisk_parser_t::set_server_port_open ( bool  open)
virtual

Inform the parser of the current status of the server socket.

Parameters
openIndicates wether the server socket has just been opened or closed.
Precondition
open may only have the value true if get_server_port_open() currently returns false.
Postcondition
See also
get_server_port_open returns the value of open.

◆ get_connected()

bool io_asterisk_parser_t::get_connected ( ) const
virtual

Return the parser's knowledge concerning wether there currently exists an established sound data TCP connection or not.

Returns
false after initialization, or the value most recently set via
See also
set_connected.

◆ set_connected()

void io_asterisk_parser_t::set_connected ( bool  connected)
virtual

Inform the parser about the existance of a sound data connection.

Parameters
connectedIndicates wether there currently is a connection or not.
Precondition
connected must not have the same value that is currently returned by
See also
get_connected.
Postcondition
See also
get_connected returns the value of open.

◆ set_new_peer()

void io_asterisk_parser_t::set_new_peer ( unsigned short  port,
const std::string &  host 
)
virtual

Set parser monitor variables peer_port and peer_address, and calls set_connected(true).

This method should be called when a new connection is established.

Parameters
portThe TCP port number used by the peer.
hostThe Internet host where the peer is located.
Precondition
See also
get_connected currently returns false.
Postcondition
See also
get_connected returns true.

◆ debug()

virtual void io_asterisk_parser_t::debug ( const std::string &  message)
inlinevirtual

Member Data Documentation

◆ local_address

MHAParser::string_t io_asterisk_parser_t::local_address
private

Lets the user set the local network interface to listen on.

◆ local_port

MHAParser::int_t io_asterisk_parser_t::local_port
private

Lets the user choose the local tcp port to listen on.

◆ server_port_open

MHAParser::int_mon_t io_asterisk_parser_t::server_port_open
private

Indicates wether the TCP server socket is currently open.

◆ connected

MHAParser::int_mon_t io_asterisk_parser_t::connected
private

Indicator if there currently is a sound data connection over TCP.

◆ peer_address

MHAParser::string_mon_t io_asterisk_parser_t::peer_address
private

Display the ip address of the currently connected sound data client.

◆ peer_port

MHAParser::int_mon_t io_asterisk_parser_t::peer_port
private

Display the tcp port used by the current sound data client.

◆ debug_filename

MHAParser::string_t io_asterisk_parser_t::debug_filename
private

filename to write debugging info to (if non-empty)

◆ debug_file

FILE* io_asterisk_parser_t::debug_file
private

file handle to write debugging info to


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