[sdk][setup] Add FIDL for registering setup APIs

This FIDL API allows components to host their own setup APIs, and
optionally receive data through callbacks from their clients.

Bug: 44130
Test: CQ
Change-Id: Ifcabb033034eecc04ff319d7a34bfc7d0074175e
diff --git a/sdk/fidl/fuchsia.castsetup/BUILD.gn b/sdk/fidl/fuchsia.castsetup/BUILD.gn
index 992cdf6..74da82c 100644
--- a/sdk/fidl/fuchsia.castsetup/BUILD.gn
+++ b/sdk/fidl/fuchsia.castsetup/BUILD.gn
@@ -7,5 +7,8 @@
 fidl("fuchsia.castsetup") {
   sdk_category = "partner"
 
-  sources = [ "cast_setup.fidl" ]
+  sources = [
+    "cast_setup.fidl",
+    "server.fidl",
+  ]
 }
diff --git a/sdk/fidl/fuchsia.castsetup/fuchsia.castsetup.api b/sdk/fidl/fuchsia.castsetup/fuchsia.castsetup.api
index fe0d275..36b4dbc 100644
--- a/sdk/fidl/fuchsia.castsetup/fuchsia.castsetup.api
+++ b/sdk/fidl/fuchsia.castsetup/fuchsia.castsetup.api
@@ -1,3 +1,4 @@
 {
-  "fidl/fuchsia.castsetup/cast_setup.fidl": "64a277e79668500a71d1072be4eb8d4a"
+  "fidl/fuchsia.castsetup/cast_setup.fidl": "64a277e79668500a71d1072be4eb8d4a",
+  "fidl/fuchsia.castsetup/server.fidl": "2cf0fdbb3e18c5828ff5fd2da768757c"
 }
\ No newline at end of file
diff --git a/sdk/fidl/fuchsia.castsetup/server.fidl b/sdk/fidl/fuchsia.castsetup/server.fidl
new file mode 100644
index 0000000..cb6c9e45a
--- /dev/null
+++ b/sdk/fidl/fuchsia.castsetup/server.fidl
@@ -0,0 +1,46 @@
+// Copyright 2020 The Fuchsia Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+/// For internal Google use only.
+/// This API is not to be used within the Fuchsia tree.
+library fuchsia.castsetup;
+
+/// Specifies the required security for a client of the API.
+enum SecurityState : uint32 {
+    SECURITY_STATE_NONE = 0;
+    SECURITY_STATE_ENCRYPTED = 1;
+    SECURITY_STATE_TRUSTED = 2;
+};
+
+/// Registered API that handles an incoming request.
+protocol ApiRequestHandler {
+    /// Called to handle a request to this setup API. The request |data| is JSON.
+    /// The response |data| must be JSON.
+    HandleRequest(string:MAX? data) -> (uint32 response_code, string:MAX? data);
+};
+
+/// API operation mode to specify during registration.
+enum ApiMode : uint32 {
+    ACCEPTS_NO_DATA = 1;
+    ACCEPTS_DATA = 2;
+};
+
+/// Registry that hosts APIs on behalf of clients.
+[Discoverable]
+protocol ApiRegistry {
+    /// Registers an API that may accept incoming data.
+    ///
+    /// |path| identifies how to access the API. If multiple registrations occur with
+    /// the same path, then the last registration is bound, and the rest are unbound.
+    ///
+    /// |accepts_data| indicates whether this API should allow callers to provide
+    /// data in the form of a JSON string.
+    ///
+    /// |security_state| indicates what level of security the caller must
+    /// adhere to.
+    RegisterApi(string:1024 path,
+                ApiMode api_mode,
+                SecurityState security_state,
+                ApiRequestHandler api_handler);
+};