blob: 8f2df30f57d5d1425e8108fb8df18484ac63ea55 [file] [log] [blame]
Thieu Le3426c8f2012-01-11 17:35:11 -08001// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
Paul Stewart75897df2011-04-27 09:05:53 -07002// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
Darin Petkov633ac6f2011-07-08 13:56:13 -07005#ifndef SHILL_DAEMON_H_
6#define SHILL_DAEMON_H_
Paul Stewart75897df2011-04-27 09:05:53 -07007
mukesh agrawal8f317b62011-07-15 11:53:23 -07008#include <string>
9
Thieu Lefb46caf2012-03-08 11:57:15 -080010#include <base/memory/scoped_ptr.h>
11
Paul Stewart26b327e2011-10-19 11:38:09 -070012#include "shill/event_dispatcher.h"
Darin Petkova7b89492011-07-27 12:48:17 -070013#include "shill/glib.h"
Paul Stewart75897df2011-04-27 09:05:53 -070014#include "shill/manager.h"
Thieu Le3426c8f2012-01-11 17:35:11 -080015#include "shill/metrics.h"
Darin Petkov633ac6f2011-07-08 13:56:13 -070016#include "shill/sockets.h"
Wade Guthrieb1ec8602012-10-18 17:26:14 -070017#include "shill/callback80211_object.h"
Wade Guthrie5020b572012-10-12 15:51:14 -070018#include "shill/callback80211_metrics.h"
Paul Stewart75897df2011-04-27 09:05:53 -070019
20namespace shill {
21
Darin Petkov633ac6f2011-07-08 13:56:13 -070022class Config;
Wade Guthrie64b4c142012-08-20 15:21:01 -070023class Config80211;
Darin Petkov633ac6f2011-07-08 13:56:13 -070024class ControlInterface;
Thieu Lefb46caf2012-03-08 11:57:15 -080025class DHCPProvider;
Gary Moraina9fb3252012-05-31 12:05:31 -070026class Error;
Darin Petkov887f2982011-07-14 16:10:17 -070027class GLib;
Darin Petkov3c5e4dc2012-04-02 14:44:27 +020028class NSS;
Thieu Lefb46caf2012-03-08 11:57:15 -080029class ProxyFactory;
30class RoutingTable;
31class RTNLHandler;
Darin Petkov633ac6f2011-07-08 13:56:13 -070032
Paul Stewart75897df2011-04-27 09:05:53 -070033class Daemon {
34 public:
Darin Petkova7b89492011-07-27 12:48:17 -070035 Daemon(Config *config, ControlInterface *control);
Paul Stewart75897df2011-04-27 09:05:53 -070036 ~Daemon();
Darin Petkov633ac6f2011-07-08 13:56:13 -070037
mukesh agrawal8f317b62011-07-15 11:53:23 -070038 void AddDeviceToBlackList(const std::string &device_name);
Gaurav Shah71354762011-11-28 19:22:49 -080039 void SetStartupProfiles(const std::vector<std::string> &profile_path);
Paul Stewart10e9e4e2012-04-26 19:46:28 -070040 void SetStartupPortalList(const std::string &portal_list);
Darin Petkov3c5e4dc2012-04-02 14:44:27 +020041 // Main for connection manager. Starts main process and holds event loop.
Paul Stewart75897df2011-04-27 09:05:53 -070042 void Run();
Gary Moraina9fb3252012-05-31 12:05:31 -070043
44 // Starts the termination actions in the manager.
Thieu Le1271d682011-11-02 22:48:19 +000045 void Quit();
Paul Stewart75897df2011-04-27 09:05:53 -070046
47 private:
Darin Petkov633ac6f2011-07-08 13:56:13 -070048 friend class ShillDaemonTest;
49
Gary Moraina9fb3252012-05-31 12:05:31 -070050 // Causes the dispatcher message loop to terminate, calls Stop(), and returns
51 // to the main function which started the daemon. Called when the termination
52 // actions are completed.
53 void TerminationActionsCompleted(const Error &error);
Darin Petkova7b89492011-07-27 12:48:17 -070054 void Start();
Thieu Le1271d682011-11-02 22:48:19 +000055 void Stop();
Darin Petkov633ac6f2011-07-08 13:56:13 -070056
Paul Stewart75897df2011-04-27 09:05:53 -070057 Config *config_;
58 ControlInterface *control_;
Thieu Le3426c8f2012-01-11 17:35:11 -080059 Metrics metrics_;
Darin Petkov3c5e4dc2012-04-02 14:44:27 +020060 NSS *nss_;
Thieu Lefb46caf2012-03-08 11:57:15 -080061 ProxyFactory *proxy_factory_;
62 RTNLHandler *rtnl_handler_;
63 RoutingTable *routing_table_;
64 DHCPProvider *dhcp_provider_;
Wade Guthrie0d438532012-05-18 14:18:50 -070065 Config80211 *config80211_;
Thieu Lefb46caf2012-03-08 11:57:15 -080066 scoped_ptr<Manager> manager_;
Wade Guthrieb1ec8602012-10-18 17:26:14 -070067 Callback80211Object callback80211_output_;
Wade Guthrie5020b572012-10-12 15:51:14 -070068 Callback80211Metrics callback80211_metrics_;
Paul Stewart75897df2011-04-27 09:05:53 -070069 EventDispatcher dispatcher_;
Darin Petkov633ac6f2011-07-08 13:56:13 -070070 Sockets sockets_;
Darin Petkova7b89492011-07-27 12:48:17 -070071 GLib glib_;
Paul Stewart75897df2011-04-27 09:05:53 -070072};
73
74} // namespace shill
75
Darin Petkov633ac6f2011-07-08 13:56:13 -070076#endif // SHILL_DAEMON_H_