1
#include "source/server/proto_descriptors.h"
2

            
3
#include "source/common/common/assert.h"
4
#include "source/common/common/fmt.h"
5
#include "source/common/config/protobuf_link_hacks.h"
6
#include "source/common/protobuf/protobuf.h"
7

            
8
#include "absl/strings/str_cat.h"
9

            
10
namespace Envoy {
11
namespace Server {
12

            
13
11509
void validateProtoDescriptors() {
14
11509
  const auto methods = {
15
11509
      "envoy.service.cluster.v3.ClusterDiscoveryService.FetchClusters",
16
11509
      "envoy.service.cluster.v3.ClusterDiscoveryService.StreamClusters",
17
11509
      "envoy.service.cluster.v3.ClusterDiscoveryService.DeltaClusters",
18
11509
      "envoy.service.discovery.v3.AggregatedDiscoveryService.StreamAggregatedResources",
19
11509
      "envoy.service.discovery.v3.AggregatedDiscoveryService.DeltaAggregatedResources",
20
11509
      "envoy.service.endpoint.v3.EndpointDiscoveryService.FetchEndpoints",
21
11509
      "envoy.service.endpoint.v3.EndpointDiscoveryService.StreamEndpoints",
22
11509
      "envoy.service.endpoint.v3.EndpointDiscoveryService.DeltaEndpoints",
23
11509
      "envoy.service.endpoint.v3.LocalityEndpointDiscoveryService.DeltaLocalityEndpoints",
24
11509
      "envoy.service.health.v3.HealthDiscoveryService.FetchHealthCheck",
25
11509
      "envoy.service.health.v3.HealthDiscoveryService.StreamHealthCheck",
26
11509
      "envoy.service.listener.v3.ListenerDiscoveryService.FetchListeners",
27
11509
      "envoy.service.listener.v3.ListenerDiscoveryService.StreamListeners",
28
11509
      "envoy.service.listener.v3.ListenerDiscoveryService.DeltaListeners",
29
11509
      "envoy.service.ratelimit.v3.RateLimitService.ShouldRateLimit",
30
11509
      "envoy.service.route.v3.RouteDiscoveryService.FetchRoutes",
31
11509
      "envoy.service.route.v3.RouteDiscoveryService.StreamRoutes",
32
11509
      "envoy.service.route.v3.RouteDiscoveryService.DeltaRoutes",
33
11509
      "envoy.service.runtime.v3.RuntimeDiscoveryService.StreamRuntime",
34
11509
      "envoy.service.runtime.v3.RuntimeDiscoveryService.FetchRuntime",
35
11509
  };
36

            
37
230180
  for (const auto& method : methods) {
38
230180
    RELEASE_ASSERT(Protobuf::DescriptorPool::generated_pool()->FindMethodByName(method) != nullptr,
39
230180
                   absl::StrCat("Unable to find method descriptor for ", method));
40
230180
  }
41

            
42
11509
  const auto types = {
43
11509
      "envoy.config.cluster.v3.Cluster",     "envoy.config.endpoint.v3.ClusterLoadAssignment",
44
11509
      "envoy.config.listener.v3.Listener",   "envoy.config.route.v3.RouteConfiguration",
45
11509
      "envoy.config.route.v3.VirtualHost",   "envoy.extensions.transport_sockets.tls.v3.Secret",
46
11509
      "envoy.config.endpoint.v3.LbEndpoint",
47
11509
  };
48

            
49
80563
  for (const auto& type : types) {
50
80563
    RELEASE_ASSERT(Protobuf::DescriptorPool::generated_pool()->FindMessageTypeByName(type) !=
51
80563
                       nullptr,
52
80563
                   absl::StrCat("Unable to find message type for ", type));
53
80563
  }
54
11509
}
55

            
56
} // namespace Server
57
} // namespace Envoy