summaryrefslogtreecommitdiff
path: root/resolver.h
diff options
context:
space:
mode:
authorPaul Stewart <pstew@chromium.org>2011-08-05 10:17:29 -0700
committerPaul Stewart <pstew@chromium.org>2011-08-08 07:31:36 -0700
commitb6063942a712bc2825e78dc026a24a5d7b6131fc (patch)
tree11f4037d5dafc6c4eec6ec73b1d19c14c75cdc3d /resolver.h
parent75e89d2d5ecb3c42a869f485d4483fd2176381c0 (diff)
downloadshill-b6063942a712bc2825e78dc026a24a5d7b6131fc.tar.gz
shill: Add singleton to output resolver files
Output a file that can be linked to "resolv.conf" from the contents of an ipconfig file. BUG=chromium-os:17278 TEST=New unittest Change-Id: Ic537dda6f1cb337d631bc75a3aaa835312ce8c01 Reviewed-on: http://gerrit.chromium.org/gerrit/5399 Reviewed-by: Paul Stewart <pstew@chromium.org> Tested-by: Paul Stewart <pstew@chromium.org>
Diffstat (limited to 'resolver.h')
-rw-r--r--resolver.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/resolver.h b/resolver.h
new file mode 100644
index 00000000..bbf188fe
--- /dev/null
+++ b/resolver.h
@@ -0,0 +1,46 @@
+// Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SHILL_RESOLVER_
+#define SHILL_RESOLVER_
+
+#include <base/file_path.h>
+#include <base/memory/ref_counted.h>
+#include <base/memory/singleton.h>
+
+#include "shill/refptr_types.h"
+
+namespace shill {
+
+// This provides a static function for dumping the DNS information out
+// of an ipconfig into a "resolv.conf" formatted file.
+class Resolver {
+ public:
+ // Since this is a singleton, use Resolver::GetInstance()->Foo()
+ static Resolver *GetInstance();
+
+ void set_path(const FilePath &path) { path_ = path; }
+
+ // Set the default domain name mservice parameters, given an ipconfig entry
+ bool SetDNS(const IPConfigRefPtr &ipconfig);
+
+ // Remove any created domain name service file
+ bool ClearDNS();
+
+ private:
+ friend struct DefaultSingletonTraits<Resolver>;
+ friend class ResolverTest;
+
+ // Don't allow this object to be created
+ Resolver();
+ ~Resolver();
+
+ FilePath path_;
+
+ DISALLOW_COPY_AND_ASSIGN(Resolver);
+};
+
+} // namespace shill
+
+#endif // SHILL_RESOLVER_