Преглед на файлове

extend the configuration

Sven Czarnian преди 3 години
родител
ревизия
87ba0be57d
променени са 2 файла, в които са добавени 15 реда и са изтрити 10 реда
  1. 8 6
      include/aman/types/Communication.h
  2. 7 4
      src/config/CommunicationFileFormat.cpp

+ 8 - 6
include/aman/types/Communication.h

@@ -16,18 +16,20 @@ namespace aman {
      * @ingroup types
      */
     struct Communication {
-        bool          valid;      /**< Marks if the configuration is valid */
-        std::string   url;        /**< The URL of the backend */
-        std::uint16_t port;       /**< The port of the backend */
-        std::string   identifier; /**< The user's identifier for the connection */
+        bool          valid;            /**< Marks if the configuration is valid */
+        std::string   address;          /**< The address of the backend */
+        std::uint16_t portReporter;     /**< The reported port of the backend */
+        std::uint16_t portNotification; /**< The notification port of the backend */
+        std::string   identifier;       /**< The user's identifier for the connection */
 
         /**
          * @brief Initializes an invalid configuration
          */
         Communication() :
                 valid(false),
-                url(),
-                port(0),
+                address(),
+                portReporter(0),
+                portNotification(0),
                 identifier() { }
     };
 }

+ 7 - 4
src/config/CommunicationFileFormat.cpp

@@ -72,11 +72,14 @@ bool CommunicationFileFormat::parse(const std::string& filename, Communication&
             return false;
         }
 
-        if ("URL" == gsl::at(entry, 0)) {
-            config.url = gsl::at(entry, 1);
+        if ("Address" == gsl::at(entry, 0)) {
+            config.address = gsl::at(entry, 1);
         }
-        else if ("Port" == gsl::at(entry, 0)) {
-            config.port = static_cast<std::uint16_t>(std::atoi(gsl::at(entry, 1).c_str()));
+        else if ("PortReporter" == gsl::at(entry, 0)) {
+            config.portReporter = static_cast<std::uint16_t>(std::atoi(gsl::at(entry, 1).c_str()));
+        }
+        else if ("PortNotification" == gsl::at(entry, 0)) {
+            config.portNotification = static_cast<std::uint16_t>(std::atoi(gsl::at(entry, 1).c_str()));
         }
         else if ("UID" == gsl::at(entry, 0)) {
             config.identifier = gsl::at(entry, 1);