add .clang-format

Change-Id: I2c36b7886a25d0b235693b0776019d29608e1d52
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/phosphor-rsyslog-config/main.cpp b/phosphor-rsyslog-config/main.cpp
index 3e4d928..ea0ca03 100644
--- a/phosphor-rsyslog-config/main.cpp
+++ b/phosphor-rsyslog-config/main.cpp
@@ -1,19 +1,19 @@
 #include "config.h"
+
 #include "server-conf.hpp"
+
 #include <sdbusplus/bus.hpp>
 
-int main(int argc, char *argv[])
+int main(int argc, char* argv[])
 {
     auto bus = sdbusplus::bus::new_default();
 
-    phosphor::rsyslog_config::Server
-        serverConf(bus,
-                   BUSPATH_REMOTE_LOGGING_CONFIG,
-                   RSYSLOG_SERVER_CONFIG_FILE);
+    phosphor::rsyslog_config::Server serverConf(
+        bus, BUSPATH_REMOTE_LOGGING_CONFIG, RSYSLOG_SERVER_CONFIG_FILE);
 
     bus.request_name(BUSNAME_SYSLOG_CONFIG);
 
-    while(true)
+    while (true)
     {
         bus.process_discard();
         bus.wait();
diff --git a/phosphor-rsyslog-config/server-conf.cpp b/phosphor-rsyslog-config/server-conf.cpp
index 4bf8c79..4bf167c 100644
--- a/phosphor-rsyslog-config/server-conf.cpp
+++ b/phosphor-rsyslog-config/server-conf.cpp
@@ -1,6 +1,8 @@
 #include "server-conf.hpp"
+
 #include "utils.hpp"
 #include "xyz/openbmc_project/Common/error.hpp"
+
 #include <fstream>
 #include <phosphor-logging/elog.hpp>
 #if __has_include("../../usr/include/phosphor-logging/elog-errors.hpp")
@@ -8,8 +10,8 @@
 #else
 #include <phosphor-logging/elog-errors.hpp>
 #endif
-#include <netdb.h>
 #include <arpa/inet.h>
+#include <netdb.h>
 
 namespace phosphor
 {
@@ -23,7 +25,7 @@
 std::string Server::address(std::string value)
 {
     using Argument = xyz::openbmc_project::Common::InvalidArgument;
-    std::string result {};
+    std::string result{};
 
     try
     {
@@ -61,7 +63,7 @@
 
 uint16_t Server::port(uint16_t value)
 {
-    uint16_t result {};
+    uint16_t result{};
 
     try
     {
@@ -87,10 +89,8 @@
     return result;
 }
 
-void Server::writeConfig(
-                 const std::string& serverAddress,
-                 uint16_t serverPort,
-                 const char* filePath)
+void Server::writeConfig(const std::string& serverAddress, uint16_t serverPort,
+                         const char* filePath)
 {
     std::fstream stream(filePath, std::fstream::out);
 
@@ -119,8 +119,7 @@
     auto result = getaddrinfo(address.c_str(), nullptr, &hints, &res);
     if (result)
     {
-        log<level::ERR>("bad address",
-                        entry("ADDRESS=%s", address.c_str()),
+        log<level::ERR>("bad address", entry("ADDRESS=%s", address.c_str()),
                         entry("ERRNO=%d", result));
         return false;
     }
diff --git a/phosphor-rsyslog-config/server-conf.hpp b/phosphor-rsyslog-config/server-conf.hpp
index 8660416..8e1b2cb 100644
--- a/phosphor-rsyslog-config/server-conf.hpp
+++ b/phosphor-rsyslog-config/server-conf.hpp
@@ -1,10 +1,11 @@
 #pragma once
 
+#include "xyz/openbmc_project/Network/Client/server.hpp"
+
+#include <phosphor-logging/log.hpp>
 #include <sdbusplus/bus.hpp>
 #include <sdbusplus/server/object.hpp>
 #include <string>
-#include <phosphor-logging/log.hpp>
-#include "xyz/openbmc_project/Network/Client/server.hpp"
 
 namespace phosphor
 {
@@ -24,96 +25,93 @@
  */
 class Server : public Iface
 {
-    public:
-        Server() = delete;
-        Server(const Server&) = delete;
-        Server& operator=(const Server&) = delete;
-        Server(Server&&) = delete;
-        Server& operator=(Server&&) = delete;
-        virtual ~Server() = default;
+  public:
+    Server() = delete;
+    Server(const Server&) = delete;
+    Server& operator=(const Server&) = delete;
+    Server(Server&&) = delete;
+    Server& operator=(Server&&) = delete;
+    virtual ~Server() = default;
 
-        /** @brief Constructor to put object onto bus at a dbus path.
-         *  @param[in] bus - Bus to attach to.
-         *  @param[in] path - Path to attach at.
-         *  @param[in] filePath - rsyslog remote logging config file
-         */
-        Server(sdbusplus::bus::bus& bus,
-               const std::string& path,
-               const char* filePath) :
-            Iface(bus, path.c_str(), true),
-            configFilePath(filePath),
-            hostnameChange(
-                bus,
-                sdbusRule::propertiesChanged(
-                    "/org/freedesktop/hostname1", "org.freedesktop.hostname1"),
-                std::bind(std::mem_fn(&Server::hostnameChanged),
-                    this, std::placeholders::_1))
+    /** @brief Constructor to put object onto bus at a dbus path.
+     *  @param[in] bus - Bus to attach to.
+     *  @param[in] path - Path to attach at.
+     *  @param[in] filePath - rsyslog remote logging config file
+     */
+    Server(sdbusplus::bus::bus& bus, const std::string& path,
+           const char* filePath) :
+        Iface(bus, path.c_str(), true),
+        configFilePath(filePath),
+        hostnameChange(
+            bus,
+            sdbusRule::propertiesChanged("/org/freedesktop/hostname1",
+                                         "org.freedesktop.hostname1"),
+            std::bind(std::mem_fn(&Server::hostnameChanged), this,
+                      std::placeholders::_1))
+    {
+        try
         {
-            try
-            {
-                restore(configFilePath.c_str());
-            }
-            catch(const std::exception& e)
-            {
-                log<level::ERR>(e.what());
-            }
-
-            emit_object_added();
+            restore(configFilePath.c_str());
+        }
+        catch (const std::exception& e)
+        {
+            log<level::ERR>(e.what());
         }
 
-        using NetworkClient::address;
-        using NetworkClient::port;
+        emit_object_added();
+    }
 
-        /** @brief Override that updates rsyslog config file as well
-         *  @param[in] value - remote server address
-         *  @returns value of changed address
-         */
-        virtual std::string address(std::string value) override;
+    using NetworkClient::address;
+    using NetworkClient::port;
 
-        /** @brief Override that updates rsyslog config file as well
-         *  @param[in] value - remote server port
-         *  @returns value of changed port
-         */
-        virtual uint16_t port(uint16_t value) override;
+    /** @brief Override that updates rsyslog config file as well
+     *  @param[in] value - remote server address
+     *  @returns value of changed address
+     */
+    virtual std::string address(std::string value) override;
 
-        /** @brief Restart rsyslog's systemd unit
-         */
-        virtual void restart();
+    /** @brief Override that updates rsyslog config file as well
+     *  @param[in] value - remote server port
+     *  @returns value of changed port
+     */
+    virtual uint16_t port(uint16_t value) 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] filePath - rsyslog config file path
-         */
-        void writeConfig(
-                 const std::string& serverAddress,
-                 uint16_t serverPort,
-                 const char* filePath);
+    /** @brief Restart rsyslog's systemd unit
+     */
+    virtual void restart();
 
-        /** @brief Checks if input IP address is valid (uses getaddrinfo)
-         *  @param[in] address - server address
-         *  @returns true if valid, false otherwise
-         */
-        bool addressValid(const std::string& address);
+  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] filePath - rsyslog config file path
+     */
+    void writeConfig(const std::string& serverAddress, uint16_t serverPort,
+                     const char* filePath);
 
-        /** @brief Populate existing config into D-Bus properties
-         *  @param[in] filePath - rsyslog config file path
-         */
-        void restore(const char* filePath);
+    /** @brief Checks if input IP address is valid (uses getaddrinfo)
+     *  @param[in] address - server address
+     *  @returns true if valid, false otherwise
+     */
+    bool addressValid(const std::string& address);
 
-        std::string configFilePath{};
+    /** @brief Populate existing config into D-Bus properties
+     *  @param[in] filePath - rsyslog config file path
+     */
+    void restore(const char* filePath);
 
-        /** @brief React to hostname change
-         *  @param[in] msg - sdbusplus message
-         */
-        void hostnameChanged(sdbusplus::message::message& msg)
-        {
-            restart();
-        }
+    std::string configFilePath{};
 
-        sdbusplus::bus::match_t hostnameChange;
+    /** @brief React to hostname change
+     *  @param[in] msg - sdbusplus message
+     */
+    void hostnameChanged(sdbusplus::message::message& msg)
+    {
+        restart();
+    }
+
+    sdbusplus::bus::match_t hostnameChange;
 };
 
 } // namespace rsyslog_config
diff --git a/phosphor-rsyslog-config/utils.hpp b/phosphor-rsyslog-config/utils.hpp
index ea7984d..017a439 100644
--- a/phosphor-rsyslog-config/utils.hpp
+++ b/phosphor-rsyslog-config/utils.hpp
@@ -1,6 +1,7 @@
 #pragma once
 
 #include "config.h"
+
 #include <sdbusplus/bus.hpp>
 
 namespace phosphor
@@ -13,11 +14,8 @@
 void restart()
 {
     auto bus = sdbusplus::bus::new_default();
-    auto method = bus.new_method_call(
-                      SYSTEMD_BUSNAME,
-                      SYSTEMD_PATH,
-                      SYSTEMD_INTERFACE,
-                      "RestartUnit");
+    auto method = bus.new_method_call(SYSTEMD_BUSNAME, SYSTEMD_PATH,
+                                      SYSTEMD_INTERFACE, "RestartUnit");
     method.append("rsyslog.service", "replace");
     bus.call_noreply(method);
 }