blob: d0c8e44182ac96fcb54c3d23edc8b6462fb1a433 [file] [log] [blame]
Paul Stewart75897df2011-04-27 09:05:53 -07001// Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include <stdio.h>
6#include <glib.h>
7
8#include <algorithm>
9#include <string>
10#include <vector>
11
Chris Masoneee929b72011-05-10 10:02:18 -070012#include <base/logging.h>
13
Paul Stewart75897df2011-04-27 09:05:53 -070014#include "shill/shill_daemon.h"
15#include "shill/control_interface.h"
16#include "shill/dbus_control.h"
17
18using std::max;
19using std::min;
20using std::string;
21using std::vector;
22
23namespace shill {
24
25static const char kTaggedFilePath[] = "/var/lib/shill";
26
27// Daemon: Main for connection manager. Starts main process and holds event
28// loop.
29
30Daemon::Daemon(Config *config, ControlInterface *control)
31 : config_(config),
32 control_(control),
33 manager_(control_, &dispatcher_) { }
34Daemon::~Daemon() {}
35
Paul Stewart0af98bf2011-05-10 17:38:08 -070036void Daemon::Start() {
37 manager_.Start();
38}
Paul Stewart75897df2011-04-27 09:05:53 -070039
40void Daemon::Run() {
Paul Stewart0af98bf2011-05-10 17:38:08 -070041 Start();
Chris Masoneee929b72011-05-10 10:02:18 -070042 LOG(INFO) << "Running main loop.";
Chris Masonec5b392e2011-05-14 16:31:01 -070043 dispatcher_.DispatchForever();
Paul Stewart75897df2011-04-27 09:05:53 -070044}
45
46
47} // namespace shill