networking_private.mojom 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. // Copyright 2022 The Chromium 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. module crosapi.mojom;
  5. import "mojo/public/mojom/base/values.mojom";
  6. [Stable]
  7. union StringSuccessOrErrorReturn {
  8. // If provided, an error has occurred.
  9. string error;
  10. // If provided, the call was a success and the result is this string.
  11. string success_result;
  12. };
  13. [Stable]
  14. union DictionarySuccessOrErrorReturn {
  15. // If provided, an error has occurred.
  16. string error;
  17. // If provided, the call was a success and the result is this string.
  18. mojo_base.mojom.DeprecatedDictionaryValue success_result;
  19. };
  20. [Stable]
  21. union ListValueSuccessOrErrorReturn {
  22. // If provided, an error has occurred.
  23. string error;
  24. // If provided, the call was a success and the result is this string.
  25. mojo_base.mojom.ListValue success_result;
  26. };
  27. [Stable]
  28. union PropertiesSuccessOrErrorReturn {
  29. // If provided, an error has occurred.
  30. string error;
  31. // If provided, the call was a success and the result is this string.
  32. mojo_base.mojom.Value success_result;
  33. };
  34. [Stable, Extensible]
  35. enum CaptivePortalStatus {
  36. // The netwok state is unknown.
  37. [Default] kUnknown = 0,
  38. // The network is not connected.
  39. kOffline,
  40. // The network is connected and no portal is detected.
  41. kOnline,
  42. // The network is in one of the following states:
  43. // - Connected but no internet is available and no proxy was detected.
  44. // - A portal is suspected but no redirect was provided.
  45. // - A portal state with a redirect URL.
  46. kPortal,
  47. // A proxy requiring authentication is detected.
  48. kProxyAuthRequired,
  49. };
  50. // This interface mirrors NetworkingPrivateDelegateObserver. It allows Ash
  51. // to notify lacros of such events. Lacros, on its turn, will then forward
  52. // those notifications to its local observers.
  53. [Stable, Uuid="67b08eef-7f47-43cd-8bf6-ad64f05af13c"]
  54. interface NetworkingPrivateDelegateObserver {
  55. // Notifies observers when properties may have changed for the networks listed
  56. // in |network_guids|.
  57. OnNetworksChangedEvent@0(array<string> network_guids);
  58. // Notifies observers that the list of networks changed. |network_guids|
  59. // contains the complete list of network guids.
  60. OnNetworkListChangedEvent@1(array<string> network_guids);
  61. // Fired when the list of devices has changed or any device state properties
  62. // have changed.
  63. [MinVersion=1]
  64. OnDeviceStateListChanged@2();
  65. // Fired when a portal detection for a network completes. Sends the guid of
  66. // the network and the corresponding captive portal status.
  67. [MinVersion=2]
  68. OnPortalDetectionCompleted@3(string networkGuid,
  69. CaptivePortalStatus status);
  70. // Fired when any certificate list has changed.
  71. [MinVersion=3]
  72. OnCertificateListsChanged@4();
  73. };
  74. // This interface mirrors the NetworkingPrivateDelegate from Lacros to Ash to
  75. // allow the networking.private / networking.onc extensions to be used. Note
  76. // that this API is stable since years and will rather be deprecated than
  77. // changed. As such the API does reflect the state as is.
  78. // Furthermore this API will only be called for the primary profile user.
  79. [Stable, Uuid="30ea6c34-8a25-4fd5-86d5-887e166d2b01"]
  80. interface NetworkingPrivate {
  81. // Called to retrieve a list of properties for the network identified by
  82. // |guid| whereas |guid| gets returned by GetNetworks or CreateNetwork.
  83. GetProperties@0(string guid) => (PropertiesSuccessOrErrorReturn result);
  84. // Called to retrieve a list of managed properties for the network identified
  85. // by |guid| whereas |guid| gets returned by GetNetworks or CreateNetwork.
  86. GetManagedProperties@1(string guid)
  87. => (PropertiesSuccessOrErrorReturn result);
  88. // Called to retrieve the current state for the network identified by |guid|.
  89. GetState@2(string guid) => (DictionarySuccessOrErrorReturn result);
  90. // Called to set the |properties| for the network identified by |guid|
  91. // accordingly. Whereas |guid| gets returned by GetNetworks or CreateNetwork.
  92. SetProperties@3(string guid,
  93. mojo_base.mojom.DeprecatedDictionaryValue properties,
  94. bool allow_set_shared_config)
  95. => (string error_or_empty);
  96. // Called to create a network with the given |properties|. If |shared| is
  97. // true, it can be shared with all other users.
  98. CreateNetwork@4(bool shared,
  99. mojo_base.mojom.Value properties)
  100. => (StringSuccessOrErrorReturn result);
  101. // Called to forget the given network identified by |guid|
  102. // whereas |guid| gets returned by GetNetworks or CreateNetwork.
  103. ForgetNetwork@5(string guid,
  104. bool allow_forget_shared_config)
  105. => (string error_or_empty);
  106. // Call to get an enumeration of all the networks.
  107. GetNetworks@6(string network_type,
  108. bool configured_only,
  109. bool visible_only,
  110. int32 limit)
  111. => (ListValueSuccessOrErrorReturn result);
  112. // Start a network connection for the network identified by |guid|
  113. // whereas |guid| gets returned by GetNetworks or CreateNetwork.
  114. StartConnect@7(string guid) => (string error_or_empty);
  115. // Start to disconnect a network connection identified by |guid|
  116. // whereas |guid| gets returned by GetNetworks or CreateNetwork.
  117. StartDisconnect@8(string guid) => (string error_or_empty);
  118. // Start the activation process for the network identified by |guid| whereas
  119. // |guid| gets returned by GetNetworks or CreateNetwork.
  120. StartActivate@9(string guid,
  121. string carrier)
  122. => (string error_or_empty);
  123. // Get the status of a captive portal for a network identified by |guid|
  124. // whereas |guid| gets returned by GetNetworks or CreateNetwork.
  125. GetCaptivePortalStatus@10(string guid) => (StringSuccessOrErrorReturn result);
  126. // Unlocks a cellular sim card. |Guid| is the cellular network to unlock. If
  127. // null is passed, the default cellular device will be used.
  128. // |pin| is the current SIM PIN, or the new PIN if |puk| is provided.
  129. // |puk| is provided by the operator for unblocking a blocked SIM.
  130. UnlockCellularSim@11(string guid,
  131. string pin,
  132. string puk)
  133. => (string error_or_empty);
  134. // Sets the state of the cellular SIM card. |Guid| is the cellular network to
  135. // to set the SIM state of. If empty, the default cellular device will be
  136. // used.
  137. SetCellularSimState@12(string guid,
  138. bool require_pin,
  139. string current_pin,
  140. string new_pin)
  141. => (string error_or_empty);
  142. // Selects the cellular network. |Guid| is the cellular network to select
  143. // whereas |guid| gets returned by GetNetworks or CreateNetwork.
  144. SelectCellularMobileNetwork@13(string guid,
  145. string network_id)
  146. => (string error_or_empty);
  147. // Returns a list of ONC type strings.
  148. GetEnabledNetworkTypes@14()
  149. => (mojo_base.mojom.ListValue? network_types);
  150. // Returns a list of DeviceStateProperties.
  151. GetDeviceStateList@15()
  152. => (array<mojo_base.mojom.DeprecatedDictionaryValue?>? device_list);
  153. // Returns a dictionary of global policy values (may be empty). Note: the
  154. // dictionary is expected to be a superset of the networkingPrivate
  155. // GlobalPolicy dictionary. Any properties not in GlobalPolicy will be
  156. // ignored.
  157. GetGlobalPolicy@16() => (mojo_base.mojom.DeprecatedDictionaryValue? policies);
  158. // Returns a dictionary of certificate lists.
  159. GetCertificateLists@17()
  160. => (mojo_base.mojom.DeprecatedDictionaryValue? certificates);
  161. // Returns true if the ONC network type |type| is enabled.
  162. EnableNetworkType@18(string type) => (bool enabled);
  163. // Returns true if the ONC network type |type| is disabled.
  164. DisableNetworkType@19(string type) => (bool disabled);
  165. // Returns true if a scan was requested. It may take many seconds for a scan
  166. // to complete. The scan may or may not trigger API events when complete.
  167. // |type| is the type of network to request a scan for; if empty, scans for
  168. // all supported network types except Cellular, which must be requested
  169. // explicitly.
  170. RequestScan@20(string type) => (bool scan_requested);
  171. // Adds a new observer that will be notified by Ash when relevant events
  172. // take place.
  173. [MinVersion=1]
  174. AddObserver@21(pending_remote<NetworkingPrivateDelegateObserver> observer);
  175. };