• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright 2018 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_CLUSTER_PARSER_H
18 #define GRPC_SRC_CORE_XDS_GRPC_XDS_CLUSTER_PARSER_H
19 
20 #include "absl/strings/string_view.h"
21 #include "envoy/config/cluster/v3/cluster.upbdefs.h"
22 #include "envoy/extensions/clusters/aggregate/v3/cluster.upbdefs.h"
23 #include "envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.upbdefs.h"
24 #include "envoy/extensions/transport_sockets/tls/v3/tls.upbdefs.h"
25 #include "envoy/extensions/upstreams/http/v3/http_protocol_options.upbdefs.h"
26 #include "src/core/xds/grpc/xds_cluster.h"
27 #include "src/core/xds/xds_client/xds_client.h"
28 #include "src/core/xds/xds_client/xds_resource_type.h"
29 #include "src/core/xds/xds_client/xds_resource_type_impl.h"
30 #include "upb/reflection/def.h"
31 
32 namespace grpc_core {
33 
34 bool XdsHttpConnectEnabled();
35 
36 class XdsClusterResourceType
37     : public XdsResourceTypeImpl<XdsClusterResourceType, XdsClusterResource> {
38  public:
type_url()39   absl::string_view type_url() const override {
40     return "envoy.config.cluster.v3.Cluster";
41   }
42 
43   DecodeResult Decode(const XdsResourceType::DecodeContext& context,
44                       absl::string_view serialized_resource) const override;
45 
AllResourcesRequiredInSotW()46   bool AllResourcesRequiredInSotW() const override { return true; }
47 
InitUpbSymtab(XdsClient *,upb_DefPool * symtab)48   void InitUpbSymtab(XdsClient*, upb_DefPool* symtab) const override {
49     envoy_config_cluster_v3_Cluster_getmsgdef(symtab);
50     envoy_extensions_clusters_aggregate_v3_ClusterConfig_getmsgdef(symtab);
51     envoy_extensions_transport_sockets_http_11_proxy_v3_Http11ProxyUpstreamTransport_getmsgdef(
52         symtab);
53     envoy_extensions_transport_sockets_tls_v3_UpstreamTlsContext_getmsgdef(
54         symtab);
55     envoy_extensions_upstreams_http_v3_HttpProtocolOptions_getmsgdef(symtab);
56   }
57 };
58 
59 }  // namespace grpc_core
60 
61 #endif  // GRPC_SRC_CORE_XDS_GRPC_XDS_CLUSTER_PARSER_H
62