diff --git a/.clang-format b/.clang-format
new file mode 100644
index 0000000..ea71ad6
--- /dev/null
+++ b/.clang-format
@@ -0,0 +1,99 @@
+---
+Language:        Cpp
+# BasedOnStyle:  LLVM
+AccessModifierOffset: -2
+AlignAfterOpenBracket: Align
+AlignConsecutiveAssignments: false
+AlignConsecutiveDeclarations: false
+AlignEscapedNewlinesLeft: false
+AlignOperands:   true
+AlignTrailingComments: true
+AllowAllParametersOfDeclarationOnNextLine: true
+AllowShortBlocksOnASingleLine: false
+AllowShortCaseLabelsOnASingleLine: false
+AllowShortFunctionsOnASingleLine: None
+AllowShortIfStatementsOnASingleLine: false
+AllowShortLoopsOnASingleLine: false
+AlwaysBreakAfterDefinitionReturnType: None
+AlwaysBreakAfterReturnType: None
+AlwaysBreakBeforeMultilineStrings: false
+AlwaysBreakTemplateDeclarations: true
+BinPackArguments: true
+BinPackParameters: true
+BraceWrapping:
+  AfterClass:      true
+  AfterControlStatement: true
+  AfterEnum:       true
+  AfterFunction:   true
+  AfterNamespace:  true
+  AfterObjCDeclaration: true
+  AfterStruct:     true
+  AfterUnion:      true
+  BeforeCatch:     true
+  BeforeElse:      true
+  IndentBraces:    false
+BreakBeforeBinaryOperators: None
+BreakBeforeBraces: Custom
+BreakBeforeTernaryOperators: true
+BreakConstructorInitializers: AfterColon
+ColumnLimit:     80
+CommentPragmas:  '^ IWYU pragma:'
+ConstructorInitializerAllOnOneLineOrOnePerLine: false
+ConstructorInitializerIndentWidth: 4
+ContinuationIndentWidth: 4
+Cpp11BracedListStyle: true
+DerivePointerAlignment: false
+PointerAlignment: Left
+DisableFormat:   false
+ExperimentalAutoDetectBinPacking: false
+FixNamespaceComments: true
+ForEachMacros:   [ foreach, Q_FOREACH, BOOST_FOREACH ]
+IncludeBlocks: Regroup
+IncludeCategories:
+  - Regex:           '^[<"](gtest|gmock)'
+    Priority:        5
+  - Regex:           '^"config.h"'
+    Priority:        -1
+  - Regex:           '^".*\.hpp"'
+    Priority:        1
+  - Regex:           '^<.*\.h>'
+    Priority:        2
+  - Regex:           '^<.*'
+    Priority:        3
+  - Regex:           '.*'
+    Priority:        4
+IndentCaseLabels: true
+IndentWidth:     4
+IndentWrappedFunctionNames: true
+KeepEmptyLinesAtTheStartOfBlocks: true
+MacroBlockBegin: ''
+MacroBlockEnd:   ''
+MaxEmptyLinesToKeep: 1
+NamespaceIndentation: None
+ObjCBlockIndentWidth: 2
+ObjCSpaceAfterProperty: false
+ObjCSpaceBeforeProtocolList: true
+PenaltyBreakBeforeFirstCallParameter: 19
+PenaltyBreakComment: 300
+PenaltyBreakFirstLessLess: 120
+PenaltyBreakString: 1000
+PenaltyExcessCharacter: 1000000
+PenaltyReturnTypeOnItsOwnLine: 60
+ReflowComments:  true
+SortIncludes:    true
+SortUsingDeclarations: true
+SpaceAfterCStyleCast: false
+SpaceBeforeAssignmentOperators: true
+SpaceBeforeParens: ControlStatements
+SpaceInEmptyParentheses: false
+SpacesBeforeTrailingComments: 1
+SpacesInAngles:  false
+SpacesInContainerLiterals: true
+SpacesInCStyleCastParentheses: false
+SpacesInParentheses: false
+SpacesInSquareBrackets: false
+Standard:        Cpp11
+TabWidth:        4
+UseTab:          Never
+...
+
diff --git a/endian.hpp b/endian.hpp
index 284fd03..5597a0b 100644
--- a/endian.hpp
+++ b/endian.hpp
@@ -14,7 +14,8 @@
     static T from_network(T) = delete;
 };
 
-template<> struct convert<uint16_t>
+template <>
+struct convert<uint16_t>
 {
     static uint16_t to_network(uint16_t i)
     {
@@ -26,7 +27,8 @@
     };
 };
 
-template<> struct convert<uint32_t>
+template <>
+struct convert<uint32_t>
 {
     static uint32_t to_network(uint32_t i)
     {
@@ -37,13 +39,15 @@
         return be32toh(i);
     };
 };
-}
-template<typename T> T to_network(T i)
+} // namespace details
+template <typename T>
+T to_network(T i)
 {
     return details::convert<T>::to_network(i);
 }
-template<typename T> T from_network(T i)
+template <typename T>
+T from_network(T i)
 {
     return details::convert<T>::from_network(i);
 }
-}
+} // namespace endian
diff --git a/main.cpp b/main.cpp
index c580adc..6a5aaac 100644
--- a/main.cpp
+++ b/main.cpp
@@ -1,11 +1,10 @@
-#include <algorithm>
-#include <iomanip>
-
 #include "slp.hpp"
 #include "slp_meta.hpp"
 #include "slp_server.hpp"
 #include "sock_channel.hpp"
 
+#include <algorithm>
+#include <iomanip>
 
 /* Call Back for the sd event loop */
 static int requestHandler(sd_event_source* es, int fd, uint32_t revents,
@@ -30,25 +29,25 @@
     {
         case slp::VERSION_2:
         {
-            //Parse the buffer and construct the req object
+            // Parse the buffer and construct the req object
             std::tie(rc, req) = slp::parser::parseBuffer(recvBuff);
             if (!rc)
             {
-                //Passing the req object to handler to serve it
+                // Passing the req object to handler to serve it
                 std::tie(rc, resp) = slp::handler::processRequest(req);
             }
             break;
         }
         default:
-            std::cout << "SLP Unsupported Request Version="
-                      << (int)recvBuff[0] <<"\n";
+            std::cout << "SLP Unsupported Request Version=" << (int)recvBuff[0]
+                      << "\n";
 
             rc = static_cast<uint8_t>(slp::Error::VER_NOT_SUPPORTED);
             break;
     }
 
-    //if there was error during Parsing of request
-    //or processing of request then handle the error.
+    // if there was error during Parsing of request
+    // or processing of request then handle the error.
     if (rc)
     {
         resp = slp::handler::processError(req, rc);
@@ -58,7 +57,6 @@
     return slp::SUCCESS;
 }
 
-
 int main(int argc, char* argv[])
 {
     slp::udp::Server svr(slp::PORT, requestHandler);
diff --git a/slp.hpp b/slp.hpp
index fa8aad6..3e6d968 100644
--- a/slp.hpp
+++ b/slp.hpp
@@ -1,5 +1,7 @@
 #pragma once
 
+#include "slp_service_info.hpp"
+
 #include <stdio.h>
 
 #include <array>
@@ -11,14 +13,12 @@
 #include <tuple>
 #include <vector>
 
-#include "slp_service_info.hpp"
-
 namespace slp
 {
 
 using buffer = std::vector<uint8_t>;
 
-template<typename T>
+template <typename T>
 using deleted_unique_ptr = std::unique_ptr<T, std::function<void(T*)>>;
 
 namespace request
@@ -49,7 +49,7 @@
     std::string predicate;
     std::string spistr;
 };
-}//namespace request
+} // namespace request
 
 /*
  * @enum FunctionType
@@ -58,13 +58,13 @@
  */
 enum class FunctionType : uint8_t
 {
-    SRVRQST     = 0x01,
-    SRVRPLY     = 0x02,
-    ATTRRQST    = 0x06,
-    ATTRRPLY    = 0x07,
+    SRVRQST = 0x01,
+    SRVRPLY = 0x02,
+    ATTRRQST = 0x06,
+    ATTRRPLY = 0x07,
     SRVTYPERQST = 0x09,
     SRVTYPERPLY = 0x0A,
-    SAADV       = 0x0B,
+    SAADV = 0x0B,
 };
 
 /*
@@ -75,18 +75,18 @@
 enum class Error : uint8_t
 {
     LANGUAGE_NOT_SUPPORTED = 0x01,
-    PARSE_ERROR            = 0x02,
-    INVALID_REGISTRATION   = 0x03,
-    SCOPE_NOT_SUPPORTED    = 0x04,
+    PARSE_ERROR = 0x02,
+    INVALID_REGISTRATION = 0x03,
+    SCOPE_NOT_SUPPORTED = 0x04,
     AUTHENTICATION_UNKNOWN = 0x05,
-    AUTHENTICATION_ABSENT  = 0x06,
-    AUTHENTICATION_FAILED  = 0x07,
-    VER_NOT_SUPPORTED      = 0x09,
-    INTERNAL_ERROR         = 0x0A,
-    DA_BUSY_NOW            = 0x0B,
-    OPTION_NOT_UNDERSTOOD  = 0x0C,
-    INVALID_UPDATE         = 0x0D,
-    MSG_NOT_SUPPORTED      = 0x0E,
+    AUTHENTICATION_ABSENT = 0x06,
+    AUTHENTICATION_FAILED = 0x07,
+    VER_NOT_SUPPORTED = 0x09,
+    INTERNAL_ERROR = 0x0A,
+    DA_BUSY_NOW = 0x0B,
+    OPTION_NOT_UNDERSTOOD = 0x0C,
+    INVALID_UPDATE = 0x0D,
+    MSG_NOT_SUPPORTED = 0x0E,
 };
 
 /*
@@ -104,7 +104,6 @@
     uint16_t xid = 0;
     uint16_t langtagLen = 0;
     std::string langtag;
-
 };
 
 /*
@@ -119,7 +118,6 @@
     request::Service srvrqst;
 };
 
-
 /*
  * @struct Message
  *
@@ -131,7 +129,6 @@
     Payload body;
 };
 
-
 namespace parser
 {
 
@@ -174,20 +171,19 @@
 int parseSrvTypeRqst(const buffer& buf, Message& req);
 
 /** Parse a service request.
-  *
-  * @param[in] buffer - The buffer from which data should be parsed.
-  *
-  * @return Zero on success,and fills the body object inside message.
-  *         non-zero on failure and empty msg object.
-  *
-  * @internal
-  */
+ *
+ * @param[in] buffer - The buffer from which data should be parsed.
+ *
+ * @return Zero on success,and fills the body object inside message.
+ *         non-zero on failure and empty msg object.
+ *
+ * @internal
+ */
 
 int parseSrvRqst(const buffer& buf, Message& req);
 
-}//namespace internal
-}//namespce parser
-
+} // namespace internal
+} // namespace parser
 
 namespace handler
 {
@@ -212,8 +208,7 @@
  * @return the vector populated with the error data
  */
 
-buffer processError(const Message& req,
-                    const uint8_t err);
+buffer processError(const Message& req, const uint8_t err);
 namespace internal
 {
 
@@ -231,7 +226,6 @@
 
 std::tuple<int, buffer> processSrvRequest(const Message& msg);
 
-
 /** Handle the  SrvTypeRequest message.
  *
  * @param[in] msg - The message to process
@@ -277,7 +271,6 @@
  */
 buffer prepareHeader(const Message& req);
 
-
-}//namespace internal
-}//namespce handler
-}//namespce slp
+} // namespace internal
+} // namespace handler
+} // namespace slp
diff --git a/slp_message_handler.cpp b/slp_message_handler.cpp
index 5125b29..a9b6ff0 100644
--- a/slp_message_handler.cpp
+++ b/slp_message_handler.cpp
@@ -1,4 +1,8 @@
+#include "config.h"
+
+#include "endian.hpp"
 #include "slp.hpp"
+#include "slp_meta.hpp"
 
 #include <arpa/inet.h>
 #include <dirent.h>
@@ -8,10 +12,6 @@
 
 #include <algorithm>
 
-#include "config.h"
-#include "endian.hpp"
-#include "slp_meta.hpp"
-
 namespace slp
 {
 namespace handler
@@ -22,52 +22,46 @@
 
 buffer prepareHeader(const Message& req)
 {
-    uint8_t length =  slp::header::MIN_LEN +   /* 14 bytes for header     */
-                      req.header.langtag.length() + /* Actual length of lang tag */
-                      slp::response::SIZE_ERROR; /*  2 bytes for error code */
+    uint8_t length =
+        slp::header::MIN_LEN +        /* 14 bytes for header     */
+        req.header.langtag.length() + /* Actual length of lang tag */
+        slp::response::SIZE_ERROR;    /*  2 bytes for error code */
 
     buffer buff(length, 0);
 
     buff[slp::header::OFFSET_VERSION] = req.header.version;
 
-    //will increment the function id from 1 as reply
+    // will increment the function id from 1 as reply
     buff[slp::header::OFFSET_FUNCTION] = req.header.functionID + 1;
 
     std::copy_n(&length, slp::header::SIZE_LENGTH,
-                buff.data() +
-                slp::header::OFFSET_LENGTH);
+                buff.data() + slp::header::OFFSET_LENGTH);
 
     auto flags = endian::to_network(req.header.flags);
 
     std::copy_n((uint8_t*)&flags, slp::header::SIZE_FLAGS,
-                buff.data() +
-                slp::header::OFFSET_FLAGS);
+                buff.data() + slp::header::OFFSET_FLAGS);
 
     std::copy_n(req.header.extOffset.data(), slp::header::SIZE_EXT,
-                buff.data() +
-                slp::header::OFFSET_EXT);
+                buff.data() + slp::header::OFFSET_EXT);
 
     auto xid = endian::to_network(req.header.xid);
 
     std::copy_n((uint8_t*)&xid, slp::header::SIZE_XID,
-                buff.data() +
-                slp::header::OFFSET_XID);
+                buff.data() + slp::header::OFFSET_XID);
 
     uint16_t langtagLen = req.header.langtag.length();
     langtagLen = endian::to_network(langtagLen);
     std::copy_n((uint8_t*)&langtagLen, slp::header::SIZE_LANG,
-                buff.data() +
-                slp::header::OFFSET_LANG_LEN);
+                buff.data() + slp::header::OFFSET_LANG_LEN);
 
-    std::copy_n((uint8_t*)req.header.langtag.c_str(), req.header.langtag.length(),
-                buff.data() +
-                slp::header::OFFSET_LANG);
+    std::copy_n((uint8_t*)req.header.langtag.c_str(),
+                req.header.langtag.length(),
+                buff.data() + slp::header::OFFSET_LANG);
     return buff;
-
 }
 
-std::tuple<int, buffer> processSrvTypeRequest(
-    const Message& req)
+std::tuple<int, buffer> processSrvTypeRequest(const Message& req)
 {
 
     /*
@@ -84,7 +78,7 @@
 
     buffer buff;
 
-    //read the slp service info from conf and create the service type string
+    // read the slp service info from conf and create the service type string
     slp::handler::internal::ServiceList svcList =
         slp::handler::internal::readSLPServiceInfo();
     if (svcList.size() <= 0)
@@ -97,19 +91,18 @@
     std::string service;
     bool firstIteration = true;
     for_each(svcList.cbegin(), svcList.cend(),
-             [&service, &firstIteration](const auto& svc)
-    {
-        if (firstIteration == true)
-        {
-            service = svc.first;
-            firstIteration = false;
-        }
-        else
-        {
-            service += ",";
-            service += svc.first;
-        }
-    });
+             [&service, &firstIteration](const auto& svc) {
+                 if (firstIteration == true)
+                 {
+                     service = svc.first;
+                     firstIteration = false;
+                 }
+                 else
+                 {
+                     service += ",";
+                     service += svc.first;
+                 }
+             });
 
     buff = prepareHeader(req);
 
@@ -118,17 +111,15 @@
 
     std::cout << "service=" << service.c_str() << "\n";
 
-    uint8_t length =  buff.size() +   /* 14 bytes header + length of langtag */
-                      slp::response::SIZE_ERROR +    /* 2 byte err code */
-                      slp::response::SIZE_SERVICE +  /* 2 byte srvtype len */
-                      service.length();
-
+    uint8_t length = buff.size() + /* 14 bytes header + length of langtag */
+                     slp::response::SIZE_ERROR +   /* 2 byte err code */
+                     slp::response::SIZE_SERVICE + /* 2 byte srvtype len */
+                     service.length();
 
     buff.resize(length);
 
     std::copy_n(&length, slp::header::SIZE_LENGTH,
-                buff.data() +
-                slp::header::OFFSET_LENGTH);
+                buff.data() + slp::header::OFFSET_LENGTH);
 
     /* error code is already set to 0 moving to service type len */
 
@@ -136,19 +127,16 @@
     serviceTypeLen = endian::to_network(serviceTypeLen);
 
     std::copy_n((uint8_t*)&serviceTypeLen, slp::response::SIZE_SERVICE,
-                buff.data() +
-                slp::response::OFFSET_SERVICE_LEN);
+                buff.data() + slp::response::OFFSET_SERVICE_LEN);
 
     /* service type data */
     std::copy_n((uint8_t*)service.c_str(), service.length(),
-                (buff.data() +
-                 slp::response::OFFSET_SERVICE));
+                (buff.data() + slp::response::OFFSET_SERVICE));
 
     return std::make_tuple(slp::SUCCESS, buff);
 }
 
-std::tuple<int, buffer> processSrvRequest(
-    const Message& req)
+std::tuple<int, buffer> processSrvRequest(const Message& req)
 {
 
     /*
@@ -176,7 +164,7 @@
     */
 
     buffer buff;
-    //Get all the services which are registered
+    // Get all the services which are registered
     slp::handler::internal::ServiceList svcList =
         slp::handler::internal::readSLPServiceInfo();
     if (svcList.size() <= 0)
@@ -186,7 +174,7 @@
         return std::make_tuple((int)slp::Error::INTERNAL_ERROR, buff);
     }
 
-    //return error if serice type doesn't match
+    // return error if serice type doesn't match
     auto& svcName = req.body.srvrqst.srvType;
     auto svcIt = svcList.find(svcName);
     if (svcIt == svcList.end())
@@ -195,7 +183,7 @@
         std::cerr << "SLP unable to find the service=" << svcName << "\n";
         return std::make_tuple((int)slp::Error::INTERNAL_ERROR, buff);
     }
-    //Get all the interface address
+    // Get all the interface address
     auto ifaddrList = slp::handler::internal::getIntfAddrs();
     if (ifaddrList.size() <= 0)
     {
@@ -205,34 +193,30 @@
     }
 
     buff = prepareHeader(req);
-    //Calculate the length and resize the buffer
-    uint8_t length =  buff.size() + /* 14 bytes header + length of langtag */
-                      slp::response::SIZE_ERROR +    /* 2 bytes error code */
-                      slp::response::SIZE_URL_COUNT; /* 2 bytes srvtype len */
+    // Calculate the length and resize the buffer
+    uint8_t length = buff.size() + /* 14 bytes header + length of langtag */
+                     slp::response::SIZE_ERROR +    /* 2 bytes error code */
+                     slp::response::SIZE_URL_COUNT; /* 2 bytes srvtype len */
 
     buff.resize(length);
 
-    //Populate the url count
+    // Populate the url count
     uint16_t urlCount = ifaddrList.size();
     urlCount = endian::to_network(urlCount);
 
     std::copy_n((uint8_t*)&urlCount, slp::response::SIZE_URL_COUNT,
-                buff.data() +
-                slp::response::OFFSET_URL_ENTRY);
+                buff.data() + slp::response::OFFSET_URL_ENTRY);
 
-    //Find the service
+    // Find the service
     const slp::ConfigData& svc = svcIt->second;
-    //Populate the URL Entries
+    // Populate the URL Entries
     auto pos = slp::response::OFFSET_URL_ENTRY + slp::response::SIZE_URL_COUNT;
     for (const auto& addr : ifaddrList)
     {
-        std::string url = svc.name + ':' + svc.type +
-                          "//" + addr + ',' + svc.port;
+        std::string url =
+            svc.name + ':' + svc.type + "//" + addr + ',' + svc.port;
 
-
-        buff.resize(buff.size() +
-                    slp::response::SIZE_URL_ENTRY +
-                    url.length());
+        buff.resize(buff.size() + slp::response::SIZE_URL_ENTRY + url.length());
 
         uint8_t reserved = 0;
         uint16_t auth = 0;
@@ -244,7 +228,6 @@
 
         pos += slp::response::SIZE_RESERVED;
 
-
         std::copy_n((uint8_t*)&lifetime, slp::response::SIZE_LIFETIME,
                     buff.data() + pos);
 
@@ -255,8 +238,7 @@
                     buff.data() + pos);
         pos += slp::response::SIZE_URLLENGTH;
 
-        std::copy_n((uint8_t*)url.c_str(), url.length(),
-                    buff.data() + pos);
+        std::copy_n((uint8_t*)url.c_str(), url.length(), buff.data() + pos);
         pos += url.length();
 
         std::copy_n((uint8_t*)&auth, slp::response::SIZE_AUTH,
@@ -265,8 +247,7 @@
     }
     uint8_t packetLength = buff.size();
     std::copy_n((uint8_t*)&packetLength, slp::header::SIZE_VERSION,
-                buff.data() +
-                slp::header::OFFSET_LENGTH);
+                buff.data() + slp::header::OFFSET_LENGTH);
 
     return std::make_tuple((int)slp::SUCCESS, buff);
 }
@@ -282,10 +263,8 @@
         return addrList;
     }
 
-    slp::deleted_unique_ptr<ifaddrs> ifaddrPtr(ifaddr, [](ifaddrs * addr)
-    {
-        freeifaddrs(addr);
-    });
+    slp::deleted_unique_ptr<ifaddrs> ifaddrPtr(
+        ifaddr, [](ifaddrs* addr) { freeifaddrs(addr); });
 
     ifaddr = nullptr;
 
@@ -307,11 +286,10 @@
                 continue;
             }
 
-            char tmp[INET_ADDRSTRLEN] = { 0 };
+            char tmp[INET_ADDRSTRLEN] = {0};
 
             inet_ntop(AF_INET,
-                      &(((struct sockaddr_in*)(ifa->ifa_addr))->sin_addr),
-                      tmp,
+                      &(((struct sockaddr_in*)(ifa->ifa_addr))->sin_addr), tmp,
                       sizeof(tmp));
             addrList.emplace_back(tmp);
         }
@@ -320,7 +298,7 @@
     return addrList;
 }
 
-slp::handler::internal::ServiceList  readSLPServiceInfo()
+slp::handler::internal::ServiceList readSLPServiceInfo()
 {
     using namespace std::string_literals;
     slp::handler::internal::ServiceList svcLst;
@@ -332,8 +310,7 @@
     // Service File format would be "ServiceName serviceType Port"
     DIR* dir = opendir(SERVICE_DIR);
     // wrap the pointer into smart pointer.
-    slp::deleted_unique_ptr<DIR> dirPtr(dir, [](DIR * dir)
-    {
+    slp::deleted_unique_ptr<DIR> dirPtr(dir, [](DIR* dir) {
         if (!dir)
         {
             closedir(dir);
@@ -345,7 +322,7 @@
     {
         while ((dent = readdir(dirPtr.get())) != NULL)
         {
-            if (dent->d_type == DT_REG) //regular file
+            if (dent->d_type == DT_REG) // regular file
             {
                 auto absFileName = std::string(SERVICE_DIR) + dent->d_name;
                 std::ifstream readFile(absFileName);
@@ -354,24 +331,22 @@
                 svcLst.emplace(service.name, service);
             }
         }
-
     }
     return svcLst;
 }
-}//namespace internal
+} // namespace internal
 
-std::tuple<int, buffer> processRequest(
-    const Message& msg)
+std::tuple<int, buffer> processRequest(const Message& msg)
 {
     int rc = slp::SUCCESS;
     buffer resp(0);
-    std::cout << "SLP Processing Request="
-              << msg.header.functionID <<"\n";
+    std::cout << "SLP Processing Request=" << msg.header.functionID << "\n";
 
     switch (msg.header.functionID)
     {
         case (uint8_t)slp::FunctionType::SRVTYPERQST:
-            std::tie(rc, resp) = slp::handler::internal::processSrvTypeRequest(msg);
+            std::tie(rc, resp) =
+                slp::handler::internal::processSrvTypeRequest(msg);
             break;
         case (uint8_t)slp::FunctionType::SRVRQST:
             std::tie(rc, resp) = slp::handler::internal::processSrvRequest(msg);
@@ -382,17 +357,14 @@
     return std::make_tuple(rc, resp);
 }
 
-buffer processError(const Message& req,
-                    uint8_t err)
+buffer processError(const Message& req, uint8_t err)
 {
     buffer buff;
     buff = slp::handler::internal::prepareHeader(req);
 
     std::copy_n(&err, slp::response::SIZE_ERROR,
-                buff.data() +
-                slp::response::OFFSET_ERROR);
+                buff.data() + slp::response::OFFSET_ERROR);
     return buff;
-
 }
-}//namespace handler
-}//namespace slp
+} // namespace handler
+} // namespace slp
diff --git a/slp_meta.hpp b/slp_meta.hpp
index 0cebfdf..956f18d 100644
--- a/slp_meta.hpp
+++ b/slp_meta.hpp
@@ -35,7 +35,7 @@
 constexpr size_t OFFSET_LANG = 14;
 
 constexpr size_t MIN_LEN = 14;
-}//namespace header
+} // namespace header
 
 /** @brief Defines the constants for slp response.
  *  Size and the offsets.
@@ -58,7 +58,7 @@
 constexpr size_t OFFSET_SERVICE = 20;
 constexpr size_t OFFSET_URL_ENTRY = 18;
 
-}//namespace response
+} // namespace response
 
 /** @brief Defines the constants for slp request.
  *  Size and the offsets.
@@ -80,5 +80,5 @@
 constexpr size_t OFFSET_PR = 18;
 constexpr size_t OFFSET_SERVICE = 20;
 
-}//namespace request
-}//namespace slp
+} // namespace request
+} // namespace slp
diff --git a/slp_parser.cpp b/slp_parser.cpp
index 28726b0..9b4119b 100644
--- a/slp_parser.cpp
+++ b/slp_parser.cpp
@@ -1,12 +1,11 @@
+#include "endian.hpp"
 #include "slp.hpp"
+#include "slp_meta.hpp"
 
 #include <string.h>
 
-#include <string>
 #include <algorithm>
-
-#include "endian.hpp"
-#include "slp_meta.hpp"
+#include <string>
 
 namespace slp
 {
@@ -31,32 +30,25 @@
        |      Language Tag Length      |         Language Tag          \
        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */
 
-    Message req {0};
+    Message req{0};
     int rc = slp::SUCCESS;
 
-    std::copy_n(buff.data(),
-                slp::header::SIZE_VERSION,
-                &req.header.version);
+    std::copy_n(buff.data(), slp::header::SIZE_VERSION, &req.header.version);
 
     std::copy_n(buff.data() + slp::header::OFFSET_FUNCTION,
-                slp::header::SIZE_VERSION,
-                &req.header.functionID);
+                slp::header::SIZE_VERSION, &req.header.functionID);
 
     std::copy_n(buff.data() + slp::header::OFFSET_LENGTH,
-                slp::header::SIZE_LENGTH,
-                req.header.length.data());
+                slp::header::SIZE_LENGTH, req.header.length.data());
 
     std::copy_n(buff.data() + slp::header::OFFSET_FLAGS,
-                slp::header::SIZE_FLAGS,
-                (uint8_t*)&req.header.flags);
+                slp::header::SIZE_FLAGS, (uint8_t*)&req.header.flags);
 
     req.header.flags = endian::from_network(req.header.flags);
-    std::copy_n(buff.data() + slp::header::OFFSET_EXT,
-                slp::header::SIZE_EXT,
+    std::copy_n(buff.data() + slp::header::OFFSET_EXT, slp::header::SIZE_EXT,
                 req.header.extOffset.data());
 
-    std::copy_n(buff.data() + slp::header::OFFSET_XID,
-                slp::header::SIZE_XID,
+    std::copy_n(buff.data() + slp::header::OFFSET_XID, slp::header::SIZE_XID,
                 (uint8_t*)&req.header.xid);
 
     req.header.xid = endian::from_network(req.header.xid);
@@ -64,21 +56,17 @@
     uint16_t langtagLen;
 
     std::copy_n(buff.data() + slp::header::OFFSET_LANG_LEN,
-                slp::header::SIZE_LANG,
-                (uint8_t*)&langtagLen);
-
+                slp::header::SIZE_LANG, (uint8_t*)&langtagLen);
 
     langtagLen = endian::from_network(langtagLen);
 
-
-    req.header.langtag.insert(0, (const char*)buff.data() +
-                              slp::header::OFFSET_LANG,
-                              langtagLen);
+    req.header.langtag.insert(
+        0, (const char*)buff.data() + slp::header::OFFSET_LANG, langtagLen);
 
     /* check for the validity of the function */
-    if (req.header.functionID < static_cast<uint8_t>
-        (slp::FunctionType::SRVRQST)
-        || req.header.functionID > static_cast<uint8_t>(slp::FunctionType::SAADV))
+    if (req.header.functionID <
+            static_cast<uint8_t>(slp::FunctionType::SRVRQST) ||
+        req.header.functionID > static_cast<uint8_t>(slp::FunctionType::SAADV))
     {
         rc = static_cast<int>(slp::Error::PARSE_ERROR);
     }
@@ -86,11 +74,9 @@
     return std::make_tuple(rc, std::move(req));
 }
 
-
 int parseSrvTypeRqst(const buffer& buff, Message& req)
 {
 
-
     /*  0                   1                   2                   3
         0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
@@ -110,21 +96,18 @@
     /* Parse the PRList. */
     uint16_t prListLen;
     std::copy_n(buff.data() + slp::request::OFFSET_PR_LEN,
-                slp::request::SIZE_PRLIST,
-                (uint8_t*)&prListLen);
+                slp::request::SIZE_PRLIST, (uint8_t*)&prListLen);
 
     prListLen = endian::from_network(prListLen);
 
-    req.body.srvtyperqst.prList.insert(0, (const char*)buff.data() +
-                                       slp::request::OFFSET_PR,
-                                       prListLen);
+    req.body.srvtyperqst.prList.insert(
+        0, (const char*)buff.data() + slp::request::OFFSET_PR, prListLen);
 
     uint8_t pos = slp::request::OFFSET_PR + prListLen;
 
     /* Parse the Naming Authority. */
     uint16_t namingAuthLen;
-    std::copy_n(buff.data() + pos,
-                slp::request::SIZE_NAMING,
+    std::copy_n(buff.data() + pos, slp::request::SIZE_NAMING,
                 (uint8_t*)&namingAuthLen);
 
     pos += slp::request::SIZE_NAMING;
@@ -137,17 +120,15 @@
     }
     else
     {
-        req.body.srvtyperqst.namingAuth.insert(0, (const char*)buff.data() +
-                                               pos,
-                                               namingAuthLen);
+        req.body.srvtyperqst.namingAuth.insert(
+            0, (const char*)buff.data() + pos, namingAuthLen);
     }
 
     pos += namingAuthLen;
 
     /* Parse the <scope-list>. */
     uint16_t scopeListLen;
-    std::copy_n(buff.data() + pos,
-                slp::request::SIZE_SCOPE,
+    std::copy_n(buff.data() + pos, slp::request::SIZE_SCOPE,
                 (uint8_t*)&scopeListLen);
 
     pos += slp::request::SIZE_SCOPE;
@@ -185,8 +166,7 @@
     /* 1) Parse the PRList. */
     uint16_t prListLen;
     std::copy_n(buff.data() + slp::request::OFFSET_PR_LEN,
-                slp::request::SIZE_PRLIST,
-                (uint8_t*)&prListLen);
+                slp::request::SIZE_PRLIST, (uint8_t*)&prListLen);
 
     auto pos = slp::request::OFFSET_PR_LEN + slp::request::SIZE_PRLIST;
 
@@ -197,11 +177,9 @@
 
     pos += prListLen;
 
-
     /* 2) Parse the <service-type> string. */
     uint16_t srvTypeLen;
-    std::copy_n(buff.data() + pos,
-                slp::request::SIZE_SERVICE_TYPE,
+    std::copy_n(buff.data() + pos, slp::request::SIZE_SERVICE_TYPE,
                 (uint8_t*)&srvTypeLen);
 
     srvTypeLen = endian::from_network(srvTypeLen);
@@ -215,8 +193,7 @@
 
     /* 3) Parse the <scope-list> string. */
     uint16_t scopeListLen;
-    std::copy_n(buff.data() + pos,
-                slp::request::SIZE_SCOPE,
+    std::copy_n(buff.data() + pos, slp::request::SIZE_SCOPE,
                 (uint8_t*)&scopeListLen);
 
     scopeListLen = endian::from_network(scopeListLen);
@@ -230,8 +207,7 @@
 
     /* 4) Parse the <predicate> string. */
     uint16_t predicateLen;
-    std::copy_n(buff.data() + pos,
-                slp::request::SIZE_PREDICATE,
+    std::copy_n(buff.data() + pos, slp::request::SIZE_PREDICATE,
                 (uint8_t*)&predicateLen);
 
     predicateLen = endian::from_network(predicateLen);
@@ -244,8 +220,7 @@
 
     /* 5) Parse the <SLP SPI> string. */
     uint16_t spistrLen;
-    std::copy_n(buff.data() + pos,
-                slp::request::SIZE_SLPI,
+    std::copy_n(buff.data() + pos, slp::request::SIZE_SLPI,
                 (uint8_t*)&spistrLen);
 
     spistrLen = endian::from_network(spistrLen);
@@ -256,7 +231,7 @@
 
     return slp::SUCCESS;
 }
-}//namespace internal
+} // namespace internal
 
 std::tuple<int, Message> parseBuffer(const buffer& buff)
 {
@@ -281,5 +256,5 @@
     }
     return std::make_tuple(rc, std::move(req));
 }
-}//namespace parser
-}//namespace slp
+} // namespace parser
+} // namespace slp
diff --git a/slp_server.cpp b/slp_server.cpp
index 29c3a2f..89d751b 100644
--- a/slp_server.cpp
+++ b/slp_server.cpp
@@ -1,13 +1,13 @@
 #include "slp_server.hpp"
 
-#include <memory>
+#include "sock_channel.hpp"
 
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
 
-#include "sock_channel.hpp"
+#include <memory>
 
 /** General udp server which waits for the POLLIN event
     on the port and calls the call back once it gets the event.
@@ -16,12 +16,13 @@
  */
 int slp::udp::Server::run()
 {
-    struct sockaddr_in6 serverAddr {};
+    struct sockaddr_in6 serverAddr
+    {
+    };
 
     sd_event* event = nullptr;
 
-    slp::deleted_unique_ptr<sd_event> eventPtr(event, [](sd_event * event)
-    {
+    slp::deleted_unique_ptr<sd_event> eventPtr(event, [](sd_event* event) {
         if (!event)
         {
             event = sd_event_unref(event);
@@ -97,7 +98,7 @@
 
     if (fd >= 0)
     {
-        (void) close(fd);
+        (void)close(fd);
     }
 
     if (r < 0)
diff --git a/slp_server.hpp b/slp_server.hpp
index 0ab12c9..c890ced 100644
--- a/slp_server.hpp
+++ b/slp_server.hpp
@@ -1,14 +1,15 @@
 #pragma once
 
-#include <iostream>
-#include <string>
+#include "slp.hpp"
+#include "slp_meta.hpp"
+
 #include <sys/types.h>
 #include <systemd/sd-bus.h>
 #include <systemd/sd-daemon.h>
 #include <systemd/sd-event.h>
 
-#include "slp_meta.hpp"
-#include "slp.hpp"
+#include <iostream>
+#include <string>
 
 namespace slp
 {
@@ -23,24 +24,20 @@
 class Server
 {
 
-    public:
+  public:
+    Server() : Server(slp::PORT, nullptr){};
 
-        Server(): Server(slp::PORT, nullptr) {};
+    Server(uint16_t port, sd_event_io_handler_t cb) : port(port), callme(cb){};
 
-        Server(uint16_t port, sd_event_io_handler_t cb):
-            port(port),
-            callme(cb) {};
+    Server(const Server&) = delete;
+    Server& operator=(const Server&) = delete;
+    Server(Server&&) = default;
+    Server& operator=(Server&&) = default;
 
-        Server(const Server&) = delete;
-        Server& operator=(const Server&) = delete;
-        Server(Server&&) = default;
-        Server& operator=(Server &&) = default;
+    uint16_t port;
+    sd_event_io_handler_t callme;
 
-        uint16_t port;
-        sd_event_io_handler_t callme;
-
-        int run();
-
+    int run();
 };
-}//namespce udp
-}//namespace slp
+} // namespace udp
+} // namespace slp
diff --git a/slp_service_info.hpp b/slp_service_info.hpp
index 29fe1c4..de7ec45 100644
--- a/slp_service_info.hpp
+++ b/slp_service_info.hpp
@@ -1,7 +1,11 @@
 #pragma once
-#include <iostream>
+
+#include <array>
 #include <fstream>
+#include <iostream>
 #include <sstream>
+#include <string>
+
 namespace slp
 {
 struct ConfigData
@@ -14,20 +18,22 @@
     {
         std::string line;
         constexpr auto DELIMITER = " ";
-        size_t  delimtrPos = 0;
-        size_t  delimtrPrevPos = 0;
-        std::array<std::string, 3>tokens;
+        size_t delimtrPos = 0;
+        size_t delimtrPrevPos = 0;
+        std::array<std::string, 3> tokens;
         std::getline(str, line);
         size_t count = 0;
 
         delimtrPos = line.find(DELIMITER, delimtrPrevPos);
         while (delimtrPos != std::string::npos)
         {
-            tokens[count] = line.substr(delimtrPrevPos, (delimtrPos - delimtrPrevPos));
+            tokens[count] =
+                line.substr(delimtrPrevPos, (delimtrPos - delimtrPrevPos));
             delimtrPrevPos = delimtrPos + 1;
 
             delimtrPos = line.find(DELIMITER, delimtrPrevPos);
-            if (delimtrPos == std::string::npos && delimtrPrevPos < line.length())
+            if (delimtrPos == std::string::npos &&
+                delimtrPrevPos < line.length())
             {
                 delimtrPos = line.length();
             }
@@ -47,6 +53,5 @@
         }
         return str;
     }
-
 };
-}
+} // namespace slp
diff --git a/sock_channel.cpp b/sock_channel.cpp
index fe492db..b6332cf 100644
--- a/sock_channel.cpp
+++ b/sock_channel.cpp
@@ -14,7 +14,7 @@
 
 std::string Channel::getRemoteAddress() const
 {
-    char tmp[INET_ADDRSTRLEN] = { 0 };
+    char tmp[INET_ADDRSTRLEN] = {0};
     inet_ntop(AF_INET6, &address.inAddr.sin6_addr, tmp, sizeof(tmp));
     return std::string(tmp);
 }
@@ -41,12 +41,12 @@
 
     do
     {
-        readDataLen = recvfrom(sockfd,               // File Descriptor
-                               outputPtr ,           // Buffer
-                               bufferSize,           // Bytes requested
-                               0,                    // Flags
-                               &address.sockAddr,    // Address
-                               &address.addrSize);   // Address Length
+        readDataLen = recvfrom(sockfd,             // File Descriptor
+                               outputPtr,          // Buffer
+                               bufferSize,         // Bytes requested
+                               0,                  // Flags
+                               &address.sockAddr,  // Address
+                               &address.addrSize); // Address Length
 
         if (readDataLen == 0) // Peer has performed an orderly shutdown
         {
@@ -60,8 +60,7 @@
                       << "errno = " << rc << "\n";
             outBuffer.resize(0);
         }
-    }
-    while ((readDataLen < 0) && (-(rc) == EINTR));
+    } while ((readDataLen < 0) && (-(rc) == EINTR));
 
     // Resize the vector to the actual data read from the socket
     outBuffer.resize(readDataLen);
@@ -91,30 +90,32 @@
         {
             if (FD_ISSET(sockfd, &writeSet))
             {
-                address.addrSize = static_cast<socklen_t>(sizeof(address.inAddr));
+                address.addrSize =
+                    static_cast<socklen_t>(sizeof(address.inAddr));
                 do
                 {
-                    writeDataLen = sendto(sockfd,           // File Descriptor
-                                          outputPtr,        // Message
-                                          bufferSize,       // Length
-                                          MSG_NOSIGNAL,     // Flags
-                                          &address.sockAddr,// Destination Address
-                                          address.addrSize);// Address Length
+                    writeDataLen =
+                        sendto(sockfd,            // File Descriptor
+                               outputPtr,         // Message
+                               bufferSize,        // Length
+                               MSG_NOSIGNAL,      // Flags
+                               &address.sockAddr, // Destination Address
+                               address.addrSize); // Address Length
 
                     if (writeDataLen < 0)
                     {
                         rc = -errno;
-                        std::cerr << "Channel::Write: Write failed with errno:"
-                                  << rc << "\n";
+                        std::cerr
+                            << "Channel::Write: Write failed with errno:" << rc
+                            << "\n";
                     }
                     else if (static_cast<size_t>(writeDataLen) < bufferSize)
                     {
                         rc = -1;
                         std::cerr << "Channel::Write: Complete data not written"
-                                  " to the socket\n";
+                                     " to the socket\n";
                     }
-                }
-                while ((writeDataLen < 0) && (-(rc) == EINTR));
+                } while ((writeDataLen < 0) && (-(rc) == EINTR));
             }
             else
             {
@@ -134,17 +135,14 @@
             else
             {
                 // Error
-                rc  = -errno;
-                std::cerr << "select call (writeset) had an error : "
-                          << rc << "\n";
+                rc = -errno;
+                std::cerr << "select call (writeset) had an error : " << rc
+                          << "\n";
             }
-
         }
-    }
-    while (spuriousWakeup);
+    } while (spuriousWakeup);
 
     return rc;
 }
 
 } // namespace udpsocket
-
diff --git a/sock_channel.hpp b/sock_channel.hpp
index 0ba0df1..e759626 100644
--- a/sock_channel.hpp
+++ b/sock_channel.hpp
@@ -18,99 +18,99 @@
  */
 class Channel
 {
-    public:
-        struct SockAddr_t
+  public:
+    struct SockAddr_t
+    {
+        union
         {
-            union
-            {
-                sockaddr sockAddr;
-                sockaddr_in6 inAddr;
-            };
-            socklen_t addrSize;
+            sockaddr sockAddr;
+            sockaddr_in6 inAddr;
         };
+        socklen_t addrSize;
+    };
 
-        /**
-         * @brief Constructor
-         *
-         * Initialize the IPMI socket object with the socket descriptor
-         *
-         * @param [in] File Descriptor for the socket
-         * @param [in] Timeout parameter for the select call
-         *
-         * @return None
-         */
-        Channel(int insockfd, timeval& inTimeout)
-        {
-            sockfd = insockfd;
-            timeout = inTimeout;
-        }
+    /**
+     * @brief Constructor
+     *
+     * Initialize the IPMI socket object with the socket descriptor
+     *
+     * @param [in] File Descriptor for the socket
+     * @param [in] Timeout parameter for the select call
+     *
+     * @return None
+     */
+    Channel(int insockfd, timeval& inTimeout)
+    {
+        sockfd = insockfd;
+        timeout = inTimeout;
+    }
 
-        /**
-         * @brief Fetch the IP address of the remote peer
-         *
-         * Returns the IP address of the remote peer which is connected to this
-         * socket
-         *
-         * @return IP address of the remote peer
-         */
-        std::string getRemoteAddress() const;
+    /**
+     * @brief Fetch the IP address of the remote peer
+     *
+     * Returns the IP address of the remote peer which is connected to this
+     * socket
+     *
+     * @return IP address of the remote peer
+     */
+    std::string getRemoteAddress() const;
 
-        /**
-         * @brief Fetch the port number of the remote peer
-         *
-         * Returns the port number of the remote peer
-         *
-         * @return Port number
-         *
-         */
-        auto getPort() const
-        {
-            return address.inAddr.sin6_port;
-        }
+    /**
+     * @brief Fetch the port number of the remote peer
+     *
+     * Returns the port number of the remote peer
+     *
+     * @return Port number
+     *
+     */
+    auto getPort() const
+    {
+        return address.inAddr.sin6_port;
+    }
 
-        /**
-         * @brief Read the incoming packet
-         *
-         * Reads the data available on the socket
-         *
-         * @return A tuple with return code and vector with the buffer
-         *         In case of success, the vector is populated with the data
-         *         available on the socket and return code is 0.
-         *         In case of error, the return code is < 0 and vector is set
-         *         to size 0.
-         */
-        std::tuple<int, buffer> read();
+    /**
+     * @brief Read the incoming packet
+     *
+     * Reads the data available on the socket
+     *
+     * @return A tuple with return code and vector with the buffer
+     *         In case of success, the vector is populated with the data
+     *         available on the socket and return code is 0.
+     *         In case of error, the return code is < 0 and vector is set
+     *         to size 0.
+     */
+    std::tuple<int, buffer> read();
 
-        /**
-         *  @brief Write the outgoing packet
-         *
-         *  Writes the data in the vector to the socket
-         *
-         *  @param [in] inBuffer
-         *      The vector would be the buffer of data to write to the socket.
-         *
-         *  @return In case of success the return code is 0 and return code is
-         *          < 0 in case of failure.
-         */
-        int write(buffer& inBuffer);
+    /**
+     *  @brief Write the outgoing packet
+     *
+     *  Writes the data in the vector to the socket
+     *
+     *  @param [in] inBuffer
+     *      The vector would be the buffer of data to write to the socket.
+     *
+     *  @return In case of success the return code is 0 and return code is
+     *          < 0 in case of failure.
+     */
+    int write(buffer& inBuffer);
 
-        ~Channel() = default;
-        Channel(const Channel& right) = delete;
-        Channel& operator=(const Channel& right) = delete;
-        Channel(Channel&&) = default;
-        Channel& operator=(Channel&&) = default;
+    ~Channel() = default;
+    Channel(const Channel& right) = delete;
+    Channel& operator=(const Channel& right) = delete;
+    Channel(Channel&&) = default;
+    Channel& operator=(Channel&&) = default;
 
-    private:
-        /*
-         * The socket descriptor is the UDP server socket for the IPMI port.
-         * The same socket descriptor is used for multiple ipmi clients and the
-         * life of the descriptor is lifetime of the net-ipmid server. So we
-         * do not need to close the socket descriptor in the cleanup of the
-         * udpsocket class.
-         */
-        int sockfd;
-        SockAddr_t address;
-        timeval timeout;
+  private:
+    /*
+     * The socket descriptor is the UDP server socket for the IPMI port.
+     * The same socket descriptor is used for multiple ipmi clients and the
+     * life of the descriptor is lifetime of the net-ipmid server. So we
+     * do not need to close the socket descriptor in the cleanup of the
+     * udpsocket class.
+     */
+    int sockfd;
+    SockAddr_t address;
+    timeval timeout;
 };
 
 } // namespace udpsocket
