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_ENDPOINT_PARSER_H 18 #define GRPC_SRC_CORE_XDS_GRPC_XDS_ENDPOINT_PARSER_H 19 20 #include "absl/strings/string_view.h" 21 #include "envoy/config/endpoint/v3/endpoint.upbdefs.h" 22 #include "src/core/xds/grpc/xds_endpoint.h" 23 #include "src/core/xds/xds_client/xds_client.h" 24 #include "src/core/xds/xds_client/xds_resource_type.h" 25 #include "src/core/xds/xds_client/xds_resource_type_impl.h" 26 #include "upb/reflection/def.h" 27 28 namespace grpc_core { 29 30 class XdsEndpointResourceType final 31 : public XdsResourceTypeImpl<XdsEndpointResourceType, XdsEndpointResource> { 32 public: type_url()33 absl::string_view type_url() const override { 34 return "envoy.config.endpoint.v3.ClusterLoadAssignment"; 35 } 36 37 DecodeResult Decode(const XdsResourceType::DecodeContext& context, 38 absl::string_view serialized_resource) const override; 39 InitUpbSymtab(XdsClient *,upb_DefPool * symtab)40 void InitUpbSymtab(XdsClient*, upb_DefPool* symtab) const override { 41 envoy_config_endpoint_v3_ClusterLoadAssignment_getmsgdef(symtab); 42 } 43 }; 44 45 } // namespace grpc_core 46 47 #endif // GRPC_SRC_CORE_XDS_GRPC_XDS_ENDPOINT_PARSER_H 48