phosphor-logging: add rsyslog configuration for TCP, UDP
Add possibility to set TCP or UDP as transport protocol for rsyslog
configuration.
Depends on change of dbus interfaces in:
https://gerrit.openbmc.org/c/openbmc/phosphor-dbus-interfaces/+/64224
Tested: "@" set for UDP and "@@" for TCP in configuration file.
Change-Id: Ie849fb64b5e6cc8d87d7a984cd4d326e39aeb4ea
Signed-off-by: Ivan Mikhaylov <fr0st61te@gmail.com>
diff --git a/phosphor-rsyslog-config/server-conf.hpp b/phosphor-rsyslog-config/server-conf.hpp
index 57c292c..33e92aa 100644
--- a/phosphor-rsyslog-config/server-conf.hpp
+++ b/phosphor-rsyslog-config/server-conf.hpp
@@ -64,6 +64,7 @@
using NetworkClient::address;
using NetworkClient::port;
+ using NetworkClient::transportProtocol;
/** @brief Override that updates rsyslog config file as well
* @param[in] value - remote server address
@@ -81,15 +82,23 @@
*/
virtual void restart();
+ /** @brief Set protocol for rsyslog TCP or UDP.
+ * @param[in] value - UDP/TCP.
+ * @returns protocol value
+ */
+ virtual TransportProtocol
+ transportProtocol(TransportProtocol protocol) override;
+
private:
/** @brief Update remote server address and port in
* rsyslog config file.
* @param[in] serverAddress - remote server address
* @param[in] serverPort - remote server port
+ * @param[in] serverTransportProtocol - remote server protocol TCP/UDP
* @param[in] filePath - rsyslog config file path
*/
void writeConfig(const std::string& serverAddress, uint16_t serverPort,
- const char* filePath);
+ TransportProtocol protocol, const char* filePath);
/** @brief Checks if input IP address is valid (uses getaddrinfo)
* @param[in] address - server address