chromium/third_party/grpc/src/src/core/lib/security/security_connector/security_connector.h

//
//
// Copyright 2015 gRPC authors.
//
// 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.
//
//

#ifndef GRPC_SRC_CORE_LIB_SECURITY_SECURITY_CONNECTOR_SECURITY_CONNECTOR_H
#define GRPC_SRC_CORE_LIB_SECURITY_SECURITY_CONNECTOR_SECURITY_CONNECTOR_H

#include <grpc/support/port_platform.h>

#include <memory>

#include "absl/status/status.h"
#include "absl/strings/string_view.h"

#include <grpc/grpc.h>
#include <grpc/grpc_security.h>

#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/debug/trace.h"
#include "src/core/lib/gprpp/ref_counted.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/gprpp/unique_type_name.h"
#include "src/core/lib/iomgr/closure.h"
#include "src/core/lib/iomgr/endpoint.h"
#include "src/core/lib/iomgr/error.h"
#include "src/core/lib/iomgr/iomgr_fwd.h"
#include "src/core/lib/promise/arena_promise.h"
#include "src/core/lib/transport/handshaker.h"
#include "src/core/tsi/transport_security_interface.h"

extern grpc_core::DebugOnlyTraceFlag grpc_trace_security_connector_refcount;

// --- URL schemes. ---

#define GRPC_SSL_URL_SCHEME
#define GRPC_FAKE_SECURITY_URL_SCHEME

grpc_security_status;

// --- security_connector object. ---

//  A security connector object represents away to configure the underlying
//  transport security mechanism and check the resulting trusted peer.

#define GRPC_ARG_SECURITY_CONNECTOR

class grpc_security_connector
    : public grpc_core::RefCounted<grpc_security_connector> {};

// Util to encapsulate the connector in a channel arg.
grpc_arg grpc_security_connector_to_arg(grpc_security_connector* sc);

// Util to get the connector from a channel arg.
grpc_security_connector* grpc_security_connector_from_arg(const grpc_arg* arg);

// Util to find the connector from channel args.
grpc_security_connector* grpc_security_connector_find_in_args(
    const grpc_channel_args* args);

// --- channel_security_connector object. ---

//  A channel security connector object represents a way to configure the
//  underlying transport security mechanism on the client side.

class grpc_channel_security_connector : public grpc_security_connector {};

// --- server_security_connector object. ---

//  A server security connector object represents a way to configure the
//  underlying transport security mechanism on the server side.

class grpc_server_security_connector : public grpc_security_connector {};

#endif  // GRPC_SRC_CORE_LIB_SECURITY_SECURITY_CONNECTOR_SECURITY_CONNECTOR_H