blob: 70098fe34bb8debb7a055870ee8001dd974a1aed [file] [log] [blame]
Chris Masoned7732e42011-05-20 11:08:56 -07001// Copyright (c) 2011 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_ADAPTOR_INTERFACES_
6#define SHILL_ADAPTOR_INTERFACES_
7
8#include <string>
mukesh agrawal32399322011-09-01 10:53:43 -07009#include <vector>
Chris Masoned7732e42011-05-20 11:08:56 -070010
Chris Masoned0ceb8c2011-06-02 10:05:39 -070011#include <base/basictypes.h>
12
Darin Petkov3cfbf212011-11-21 16:02:09 +010013#include "shill/accessor_interface.h"
14
Chris Masoned7732e42011-05-20 11:08:56 -070015namespace shill {
16
Darin Petkove5bc2cb2011-12-07 14:47:32 +010017class Error;
18
Chris Masone4e851612011-07-01 10:46:53 -070019// These are the functions that a Device adaptor must support
20class DeviceAdaptorInterface {
21 public:
22 virtual ~DeviceAdaptorInterface() {}
23
24 // Getter for the opaque identifier that represents this object on the
25 // RPC interface to which the implementation is adapting.
26 virtual const std::string &GetRpcIdentifier() = 0;
27
28 // Getter for the opaque identifier that represents this object's
29 // connection to the RPC interface to which the implementation is adapting.
30 virtual const std::string &GetRpcConnectionIdentifier() = 0;
31
32 virtual void UpdateEnabled() = 0;
33
Darin Petkov3cfbf212011-11-21 16:02:09 +010034 virtual void EmitBoolChanged(const std::string &name, bool value) = 0;
35 virtual void EmitUintChanged(const std::string &name, uint32 value) = 0;
36 virtual void EmitIntChanged(const std::string &name, int value) = 0;
37 virtual void EmitStringChanged(const std::string &name,
38 const std::string &value) = 0;
39 virtual void EmitStringmapsChanged(const std::string &name,
40 const Stringmaps &value) = 0;
Chris Masone4e851612011-07-01 10:46:53 -070041};
42
43// These are the functions that an IPConfig adaptor must support
44class IPConfigAdaptorInterface {
45 public:
46 virtual ~IPConfigAdaptorInterface() {}
47
48 // Getter for the opaque identifier that represents this object on the
49 // RPC interface to which the implementation is adapting.
50 virtual const std::string &GetRpcIdentifier() = 0;
51
Gaurav Shah435de2c2011-11-17 19:01:07 -080052 virtual void EmitBoolChanged(const std::string &name, bool value) = 0;
53 virtual void EmitUintChanged(const std::string &name, uint32 value) = 0;
54 virtual void EmitIntChanged(const std::string &name, int value) = 0;
55 virtual void EmitStringChanged(const std::string &name,
56 const std::string &value) = 0;
Chris Masone4e851612011-07-01 10:46:53 -070057};
58
Chris Masoned7732e42011-05-20 11:08:56 -070059// These are the functions that a Manager adaptor must support
60class ManagerAdaptorInterface {
61 public:
Chris Masoned7732e42011-05-20 11:08:56 -070062 virtual ~ManagerAdaptorInterface() {}
Chris Masone95207da2011-06-29 16:50:49 -070063
64 // Getter for the opaque identifier that represents this object on the
65 // RPC interface to which the implementation is adapting.
66 virtual const std::string &GetRpcIdentifier() = 0;
67
Chris Masoned0ceb8c2011-06-02 10:05:39 -070068 virtual void UpdateRunning() = 0;
69
Gaurav Shah435de2c2011-11-17 19:01:07 -080070 virtual void EmitBoolChanged(const std::string &name, bool value) = 0;
71 virtual void EmitUintChanged(const std::string &name, uint32 value) = 0;
72 virtual void EmitIntChanged(const std::string &name, int value) = 0;
73 virtual void EmitStringChanged(const std::string &name,
74 const std::string &value) = 0;
75 virtual void EmitStringsChanged(const std::string &name,
76 const std::vector<std::string> &value) = 0;
mukesh agrawal32399322011-09-01 10:53:43 -070077 virtual void EmitRpcIdentifierArrayChanged(
78 const std::string &name,
79 const std::vector<std::string> &value) = 0;
Chris Masoned0ceb8c2011-06-02 10:05:39 -070080
Gaurav Shah435de2c2011-11-17 19:01:07 -080081 virtual void EmitStateChanged(const std::string &new_state) = 0;
Chris Masoned7732e42011-05-20 11:08:56 -070082};
83
Chris Masone52cd19b2011-06-29 17:23:04 -070084// These are the functions that a Profile adaptor must support
85class ProfileAdaptorInterface {
86 public:
87 virtual ~ProfileAdaptorInterface() {}
88
Chris Masonec6c6c132011-06-30 11:29:52 -070089 // Getter for the opaque identifier that represents this object on the
90 // RPC interface to which the implementation is adapting.
91 virtual const std::string &GetRpcIdentifier() = 0;
92
Gaurav Shah435de2c2011-11-17 19:01:07 -080093 virtual void EmitBoolChanged(const std::string &name, bool value) = 0;
94 virtual void EmitUintChanged(const std::string &name, uint32 value) = 0;
95 virtual void EmitIntChanged(const std::string &name, int value) = 0;
96 virtual void EmitStringChanged(const std::string &name,
97 const std::string &value) = 0;
Chris Masonec6c6c132011-06-30 11:29:52 -070098};
99
Chris Masone4e851612011-07-01 10:46:53 -0700100// These are the functions that a Service adaptor must support
101class ServiceAdaptorInterface {
Chris Masonec6c6c132011-06-30 11:29:52 -0700102 public:
Chris Masone4e851612011-07-01 10:46:53 -0700103 virtual ~ServiceAdaptorInterface() {}
Chris Masonec6c6c132011-06-30 11:29:52 -0700104
105 // Getter for the opaque identifier that represents this object on the
106 // RPC interface to which the implementation is adapting.
107 virtual const std::string &GetRpcIdentifier() = 0;
108
Chris Masone4e851612011-07-01 10:46:53 -0700109 virtual void UpdateConnected() = 0;
110
Gaurav Shah435de2c2011-11-17 19:01:07 -0800111 virtual void EmitBoolChanged(const std::string &name, bool value) = 0;
112 virtual void EmitUintChanged(const std::string &name, uint32 value) = 0;
113 virtual void EmitIntChanged(const std::string &name, int value) = 0;
114 virtual void EmitStringChanged(const std::string &name,
115 const std::string &value) = 0;
Chris Masone52cd19b2011-06-29 17:23:04 -0700116};
117
Darin Petkove5bc2cb2011-12-07 14:47:32 +0100118// A ReturnerInterface instance (along with its ownership) is passed by the
119// adaptor to the method handler. The handler releases ownership and initiates
120// an RPC return by calling one of the Return* methods.
121class ReturnerInterface {
122 public:
123 virtual void Return() = 0;
124 virtual void ReturnError(const Error &error) = 0;
125
126 protected:
127 // Destruction happens through the Return* methods.
128 virtual ~ReturnerInterface() {}
129};
130
Chris Masoned7732e42011-05-20 11:08:56 -0700131} // namespace shill
132#endif // SHILL_ADAPTOR_INTERFACES_