Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 1 | // 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 agrawal | 3239932 | 2011-09-01 10:53:43 -0700 | [diff] [blame] | 9 | #include <vector> |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 10 | |
Chris Masone | d0ceb8c | 2011-06-02 10:05:39 -0700 | [diff] [blame] | 11 | #include <base/basictypes.h> |
| 12 | |
Darin Petkov | 3cfbf21 | 2011-11-21 16:02:09 +0100 | [diff] [blame] | 13 | #include "shill/accessor_interface.h" |
| 14 | |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 15 | namespace shill { |
| 16 | |
Darin Petkov | e5bc2cb | 2011-12-07 14:47:32 +0100 | [diff] [blame^] | 17 | class Error; |
| 18 | |
Chris Masone | 4e85161 | 2011-07-01 10:46:53 -0700 | [diff] [blame] | 19 | // These are the functions that a Device adaptor must support |
| 20 | class 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 Petkov | 3cfbf21 | 2011-11-21 16:02:09 +0100 | [diff] [blame] | 34 | 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 Masone | 4e85161 | 2011-07-01 10:46:53 -0700 | [diff] [blame] | 41 | }; |
| 42 | |
| 43 | // These are the functions that an IPConfig adaptor must support |
| 44 | class 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 Shah | 435de2c | 2011-11-17 19:01:07 -0800 | [diff] [blame] | 52 | 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 Masone | 4e85161 | 2011-07-01 10:46:53 -0700 | [diff] [blame] | 57 | }; |
| 58 | |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 59 | // These are the functions that a Manager adaptor must support |
| 60 | class ManagerAdaptorInterface { |
| 61 | public: |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 62 | virtual ~ManagerAdaptorInterface() {} |
Chris Masone | 95207da | 2011-06-29 16:50:49 -0700 | [diff] [blame] | 63 | |
| 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 Masone | d0ceb8c | 2011-06-02 10:05:39 -0700 | [diff] [blame] | 68 | virtual void UpdateRunning() = 0; |
| 69 | |
Gaurav Shah | 435de2c | 2011-11-17 19:01:07 -0800 | [diff] [blame] | 70 | 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 agrawal | 3239932 | 2011-09-01 10:53:43 -0700 | [diff] [blame] | 77 | virtual void EmitRpcIdentifierArrayChanged( |
| 78 | const std::string &name, |
| 79 | const std::vector<std::string> &value) = 0; |
Chris Masone | d0ceb8c | 2011-06-02 10:05:39 -0700 | [diff] [blame] | 80 | |
Gaurav Shah | 435de2c | 2011-11-17 19:01:07 -0800 | [diff] [blame] | 81 | virtual void EmitStateChanged(const std::string &new_state) = 0; |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 82 | }; |
| 83 | |
Chris Masone | 52cd19b | 2011-06-29 17:23:04 -0700 | [diff] [blame] | 84 | // These are the functions that a Profile adaptor must support |
| 85 | class ProfileAdaptorInterface { |
| 86 | public: |
| 87 | virtual ~ProfileAdaptorInterface() {} |
| 88 | |
Chris Masone | c6c6c13 | 2011-06-30 11:29:52 -0700 | [diff] [blame] | 89 | // 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 Shah | 435de2c | 2011-11-17 19:01:07 -0800 | [diff] [blame] | 93 | 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 Masone | c6c6c13 | 2011-06-30 11:29:52 -0700 | [diff] [blame] | 98 | }; |
| 99 | |
Chris Masone | 4e85161 | 2011-07-01 10:46:53 -0700 | [diff] [blame] | 100 | // These are the functions that a Service adaptor must support |
| 101 | class ServiceAdaptorInterface { |
Chris Masone | c6c6c13 | 2011-06-30 11:29:52 -0700 | [diff] [blame] | 102 | public: |
Chris Masone | 4e85161 | 2011-07-01 10:46:53 -0700 | [diff] [blame] | 103 | virtual ~ServiceAdaptorInterface() {} |
Chris Masone | c6c6c13 | 2011-06-30 11:29:52 -0700 | [diff] [blame] | 104 | |
| 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 Masone | 4e85161 | 2011-07-01 10:46:53 -0700 | [diff] [blame] | 109 | virtual void UpdateConnected() = 0; |
| 110 | |
Gaurav Shah | 435de2c | 2011-11-17 19:01:07 -0800 | [diff] [blame] | 111 | 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 Masone | 52cd19b | 2011-06-29 17:23:04 -0700 | [diff] [blame] | 116 | }; |
| 117 | |
Darin Petkov | e5bc2cb | 2011-12-07 14:47:32 +0100 | [diff] [blame^] | 118 | // 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. |
| 121 | class 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 Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 131 | } // namespace shill |
| 132 | #endif // SHILL_ADAPTOR_INTERFACES_ |