blob: 5d23b299e513b787d9325560eb9bd841de3293d7 [file] [log] [blame]
Vishwanatha Subbannaf00182e2017-10-16 19:08:59 +05301#pragma once
2
Manojkiran Edaa879baa2020-06-13 14:39:08 +05303#include <filesystem>
Vishwanatha Subbannaf00182e2017-10-16 19:08:59 +05304
5namespace phosphor
6{
7namespace network
8{
9namespace dns
10{
11namespace updater
12{
13
Manojkiran Edaa879baa2020-06-13 14:39:08 +053014namespace fs = std::filesystem;
Vishwanatha Subbannaf00182e2017-10-16 19:08:59 +053015
16constexpr 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 */
Gunnar Mills57d9c502018-09-14 14:42:34 -050023void updateDNSEntries(const fs::path& inFile, const fs::path& outFile);
Vishwanatha Subbannaf00182e2017-10-16 19:08:59 +053024
25/** @brief User callback handler invoked by inotify watcher
26 *
27 * Needed to enable production and test code so that the right
28 * callback functions could be implemented
29 *
30 * @param[in] inFile - File having DNS entries supplied by DHCP
31 */
32inline void processDNSEntries(const fs::path& inFile)
33{
Vishwanatha Subbanna18891c62017-10-17 15:22:46 +053034 return updateDNSEntries(inFile, RESOLV_CONF);
Vishwanatha Subbannaf00182e2017-10-16 19:08:59 +053035}
36
Gunnar Mills57d9c502018-09-14 14:42:34 -050037} // namespace updater
38} // namespace dns
Vishwanatha Subbannaf00182e2017-10-16 19:08:59 +053039} // namespace network
40} // namespace phosphor