blob: c968b1e43dcfb6c09dced48f455679a80b8527ed [file] [log] [blame]
Darin Petkov33af05c2012-02-28 10:10:30 +01001// Copyright (c) 2012 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#ifndef SHILL_VPN_PROVIDER_
6#define SHILL_VPN_PROVIDER_
7
Paul Stewartca6abd42012-03-01 15:45:29 -08008#include <string>
9#include <vector>
10
Darin Petkov33af05c2012-02-28 10:10:30 +010011#include <base/basictypes.h>
Paul Stewartca6abd42012-03-01 15:45:29 -080012#include <gtest/gtest_prod.h> // for FRIEND_TEST
Darin Petkov33af05c2012-02-28 10:10:30 +010013
14#include "shill/refptr_types.h"
15
16namespace shill {
17
18class ControlInterface;
19class Error;
20class EventDispatcher;
21class KeyValueStore;
22class Manager;
23class Metrics;
24
25class VPNProvider {
26 public:
27 VPNProvider(ControlInterface *control_interface,
28 EventDispatcher *dispatcher,
29 Metrics *metrics,
30 Manager *manager);
31 ~VPNProvider();
32
33 void Start();
34 void Stop();
35
36 VPNServiceRefPtr GetService(const KeyValueStore &args, Error *error);
37
Paul Stewartca6abd42012-03-01 15:45:29 -080038 // Offers an unclaimed interface to VPN services. Returns true if this
39 // device has been accepted by a service.
40 bool OnDeviceInfoAvailable(const std::string &link_name, int interface_index);
41
Paul Stewart65512e12012-03-26 18:01:08 -070042 // Clean up a VPN services that has been unloaded and will be deregistered.
43 // This removes the VPN provider's reference to this service in its
44 // services_ vector.
45 void RemoveService(VPNServiceRefPtr service);
46
Darin Petkov33af05c2012-02-28 10:10:30 +010047 private:
Paul Stewartca6abd42012-03-01 15:45:29 -080048 FRIEND_TEST(VPNProviderTest, OnDeviceInfoAvailable);
Paul Stewart65512e12012-03-26 18:01:08 -070049 FRIEND_TEST(VPNProviderTest, RemoveService);
Paul Stewartca6abd42012-03-01 15:45:29 -080050
Darin Petkov33af05c2012-02-28 10:10:30 +010051 ControlInterface *control_interface_;
52 EventDispatcher *dispatcher_;
53 Metrics *metrics_;
54 Manager *manager_;
Paul Stewartca6abd42012-03-01 15:45:29 -080055 std::vector<VPNServiceRefPtr> services_;
Darin Petkov33af05c2012-02-28 10:10:30 +010056
57 DISALLOW_COPY_AND_ASSIGN(VPNProvider);
58};
59
60} // namespace shill
61
62#endif // SHILL_VPN_PROVIDER_