// Copyright (C) 2022 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";

option java_multiple_files = true;
option java_package = "com.android.emulation.remote";

package android.emulation.remote;

// A set of gRPC credentials that can be used to configure a secure TLS channel.
message Credentials {
    // The PEM encoding of the server root certificates, or none if the default
    // roots should be used.
    string pem_root_certs = 1;

    // The PEM encoding of the client's private key, or none if the client does
    // not have a private key.
    string pem_private_key = 2;

    // The PEM encoding of the client's certificate chain. This parameter can be
    // empty if the client does not have a certificate chain.
    string pem_cert_chain = 3;
}

// A set of headers that should be set on requests that are being made
// to the given endpoint.
message Header {
    // The header key, for example: 'authorization'
    string key = 1;

    // The header value, for example: 'Bearer token'
    string value = 2;
}

message Endpoint {
    // The URI of the endpoint to connect to. This can be either a valid
    // NameResolver-compliant URI, or an authority string. For example:
    // - "localhost"
    // - "localhost:8080"
    // - "[2001:db8:85a3:8d3:1319:8a2e:370:7348]:443"
    // - "dns://8.8.8.8/foo.googleapis.com:8080"
    string target = 1;

    // Tls credentials to use, if any to establish a connection to the given
    // endpoint. The emulated bluetooth device will use these credentials
    // to establish a connection and read/write/subscribe to the data
    // of interest.
    Credentials tls_credentials = 2;

    // Set of required headers that should be set in order to establish
    // a connection.
    //
    // These headers are usually used to set access tokens etc.
    repeated Header required_headers = 3;
}
