|
mavtables
0.2.1
MAVLink router and firewall.
|
#include <ConfigParser.hpp>

Public Member Functions | |
| ConfigParser (std::string filename) | |
| ConfigParser (const ConfigParser &other)=delete | |
| ConfigParser (ConfigParser &&other)=delete | |
| std::unique_ptr< App > | make_app () |
| ConfigParser & | operator= (const ConfigParser &other)=delete |
| ConfigParser & | operator= (ConfigParser &&other)=delete |
Protected Attributes | |
| tao::pegtl::read_input | in_ |
| std::unique_ptr< config::parse_tree::node > | root_ |
Friends | |
| std::ostream & | operator<< (std::ostream &os, const ConfigParser &config_parser) |
Related Functions | |
(Note that these are not member functions.) | |
| std::map< std::string, std::shared_ptr< Chain > > | init_chains (const config::parse_tree::node &root) |
| std::unique_ptr< Rule > | parse_action (const config::parse_tree::node &root, std::optional< int > priority, std::optional< If > condition, const std::map< std::string, std::shared_ptr< Chain >> &chains) |
| void | parse_chain (Chain &chain, const config::parse_tree::node &root, const std::map< std::string, std::shared_ptr< Chain >> &chains) |
| If | parse_condition (const config::parse_tree::node &root) |
| std::unique_ptr< Filter > | parse_filter (const config::parse_tree::node &root) |
| std::vector< std::unique_ptr< Interface > > | parse_interfaces (const config::parse_tree::node &root, std::unique_ptr< Filter > filter) |
| std::unique_ptr< SerialInterface > | parse_serial (const config::parse_tree::node &root, std::shared_ptr< Filter > filter, std::shared_ptr< ConnectionPool > pool) |
| std::unique_ptr< UDPInterface > | parse_udp (const config::parse_tree::node &root, std::shared_ptr< Filter > filter, std::shared_ptr< ConnectionPool > pool) |
Configuration file parser.
Used to parse a configuration file and create an instance of the mavtables application.
Definition at line 74 of file ConfigParser.hpp.
| ConfigParser::ConfigParser | ( | std::string | filename | ) |
Construct a configuration parser from a file.
| filename | The path of the configuration file to parse. |
| std::runtime_error | if the configuration file cannot be parsed. |
Definition at line 443 of file ConfigParser.cpp.
References in_, config::parse(), and root_.

|
delete |
|
delete |
| std::unique_ptr< App > ConfigParser::make_app | ( | ) |
Build a mavtables application from the AST contained by the parser.
Definition at line 464 of file ConfigParser.cpp.
References parse_filter(), parse_interfaces(), and root_.

|
delete |
|
delete |
|
related |
Construct a map of non default chains.
| root | Root of configuration AST. |
Definition at line 54 of file ConfigParser.cpp.

|
friend |
Print the configuration settings to the given output stream.
An example (that of test/mavtables.conf) is:
| os | The output stream to print to. |
| config_parser | The configuration parser to print. |
Definition at line 512 of file ConfigParser.cpp.
|
related |
Construct a Rule with action from AST, priority, and condition.
| root | AST action node. |
| priority | The priority to use when constructing the action. No priority if {}. If the AST node is a reject action the priority will be ignored. |
| condition | The condition to use when constructing the action. |
| chains | Map of chain names to chains for call and goto actions. |
| std::invalid_argument | if the action attempts to call or goto the default chain. |
| std::runtime_error | if the action is not one of accept, reject, call, or goto. |
Definition at line 92 of file ConfigParser.cpp.

|
related |
Add Rule's from AST to a Chain.
| chain | Chain to add rules to. |
| root | AST chain node containing rules. |
| chains | Map of chain names to chains for call and goto actions. |
Definition at line 176 of file ConfigParser.cpp.
References Chain::append(), parse_action(), and parse_condition().


|
related |
Construct conditional (If) from AST.
| root | AST conditional node. |
Definition at line 216 of file ConfigParser.cpp.
References If::from(), If::to(), and If::type().


|
related |
Parse Filter from AST.
| root | Root of configuration AST. |
Definition at line 250 of file ConfigParser.cpp.
References init_chains(), and parse_chain().


|
related |
Parse UDP and serial port interfaces from AST root.
| root | The root of the AST to create Interface's from. |
| filter | The packet Filter to use for the interfaces. |
Definition at line 292 of file ConfigParser.cpp.
References parse_serial(), and parse_udp().


|
related |
Parse a serial port interface from an AST.
| root | The serial port node to parse. |
| filter | The Filter to use for the SerialInterface. |
| pool | The connection pool to add the interface's connection to. |
| std::invalid_argument | if the device string is missing. |
Definition at line 330 of file ConfigParser.cpp.
References SerialPort::DEFAULT, SerialPort::FLOW_CONTROL, and to_lower().


|
related |
Parse a UPD interface from an AST.
| root | The UDP node to parse. |
| filter | The Filter to use for the UDPInterface. |
| pool | The connection pool to add the interface's connections to. |
Definition at line 400 of file ConfigParser.cpp.

|
protected |
Definition at line 88 of file ConfigParser.hpp.
|
protected |
Definition at line 89 of file ConfigParser.hpp.
1.8.14