• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright 2019 gRPC authors.
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //     http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #ifndef GRPC_SRC_CORE_XDS_GRPC_XDS_SERVER_GRPC_H
18 #define GRPC_SRC_CORE_XDS_GRPC_XDS_SERVER_GRPC_H
19 
20 #include <set>
21 #include <string>
22 
23 #include "src/core/lib/security/credentials/channel_creds_registry.h"
24 #include "src/core/util/json/json.h"
25 #include "src/core/util/json/json_args.h"
26 #include "src/core/util/json/json_object_loader.h"
27 #include "src/core/util/ref_counted_ptr.h"
28 #include "src/core/util/validation_errors.h"
29 #include "src/core/xds/xds_client/xds_bootstrap.h"
30 
31 namespace grpc_core {
32 
33 class GrpcXdsServer final : public XdsBootstrap::XdsServer {
34  public:
server_uri()35   const std::string& server_uri() const override { return server_uri_; }
36 
37   bool IgnoreResourceDeletion() const override;
38 
39   bool TrustedXdsServer() const;
40 
41   bool Equals(const XdsServer& other) const override;
42 
43   std::string Key() const override;
44 
channel_creds_config()45   RefCountedPtr<ChannelCredsConfig> channel_creds_config() const {
46     return channel_creds_config_;
47   }
48 
49   static const JsonLoaderInterface* JsonLoader(const JsonArgs&);
50   void JsonPostLoad(const Json& json, const JsonArgs& args,
51                     ValidationErrors* errors);
52 
53   Json ToJson() const;
54 
55  private:
56   std::string server_uri_;
57   RefCountedPtr<ChannelCredsConfig> channel_creds_config_;
58   std::set<std::string> server_features_;
59 };
60 
61 }  // namespace grpc_core
62 
63 #endif  // GRPC_SRC_CORE_XDS_GRPC_XDS_SERVER_GRPC_H
64