blob: e108ca540c90207c314fbdfe58cc79ed9c69f048 [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() {
41 GMainLoop* loop = g_main_loop_new(NULL, false);
Chris Masoneee929b72011-05-10 10:02:18 -070042 // TODO(cmasone): change this to VLOG(1) once we have it.
Paul Stewart0af98bf2011-05-10 17:38:08 -070043 Start();
Chris Masoneee929b72011-05-10 10:02:18 -070044 LOG(INFO) << "Running main loop.";
Paul Stewart75897df2011-04-27 09:05:53 -070045 g_main_loop_run(loop);
46}
47
48
49} // namespace shill