Vishwanatha Subbanna | f00182e | 2017-10-16 19:08:59 +0530 | [diff] [blame^] | 1 | #pragma once |
| 2 | |
| 3 | #include <experimental/filesystem> |
| 4 | |
| 5 | namespace phosphor |
| 6 | { |
| 7 | namespace network |
| 8 | { |
| 9 | namespace dns |
| 10 | { |
| 11 | namespace updater |
| 12 | { |
| 13 | |
| 14 | namespace fs = std::experimental::filesystem; |
| 15 | |
| 16 | constexpr auto RESOLV_CONF = "/etc/resolv.conf"; |
| 17 | |
| 18 | /** @brief Reads DNS entries supplied by DHCP and updates specified file |
| 19 | * |
| 20 | * @param[in] inFile - File having DNS entries supplied by DHCP |
| 21 | * @param[in] outFile - File to write the nameserver entries to |
| 22 | */ |
| 23 | void processDNSEntries(const fs::path& inFile, |
| 24 | const fs::path& outFile); |
| 25 | |
| 26 | /** @brief User callback handler invoked by inotify watcher |
| 27 | * |
| 28 | * Needed to enable production and test code so that the right |
| 29 | * callback functions could be implemented |
| 30 | * |
| 31 | * @param[in] inFile - File having DNS entries supplied by DHCP |
| 32 | */ |
| 33 | inline void processDNSEntries(const fs::path& inFile) |
| 34 | { |
| 35 | return processDNSEntries(inFile, RESOLV_CONF); |
| 36 | } |
| 37 | |
| 38 | } // namepsace updater |
| 39 | } // namepsace dns |
| 40 | } // namespace network |
| 41 | } // namespace phosphor |