1 // Copyright 2021 The gRPC Authors 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 #ifndef GRPC_EVENT_ENGINE_ENDPOINT_CONFIG_H 15 #define GRPC_EVENT_ENGINE_ENDPOINT_CONFIG_H 16 17 #include <string> 18 19 #include "absl/strings/string_view.h" 20 #include "absl/types/optional.h" 21 22 #include <grpc/support/port_platform.h> 23 24 namespace grpc_event_engine { 25 namespace experimental { 26 27 /// Collection of parameters used to configure client and server endpoints. The 28 /// \a EndpointConfig maps string-valued keys to values of type int, 29 /// string_view, or void pointer. Each EventEngine implementation should 30 /// document its set of supported configuration options. 31 class EndpointConfig { 32 public: 33 virtual ~EndpointConfig() = default; 34 // If the key points to an integer config, an integer value gets returned. 35 // Otherwise it returns an absl::nullopt_t 36 virtual absl::optional<int> GetInt(absl::string_view key) const = 0; 37 // If the key points to an string config, an string value gets returned. 38 // Otherwise it returns an absl::nullopt_t 39 virtual absl::optional<absl::string_view> GetString( 40 absl::string_view key) const = 0; 41 // If the key points to an void* config, a void* pointer value gets returned. 42 // Otherwise it returns nullptr 43 virtual void* GetVoidPointer(absl::string_view key) const = 0; 44 }; 45 46 } // namespace experimental 47 } // namespace grpc_event_engine 48 49 #endif // GRPC_EVENT_ENGINE_ENDPOINT_CONFIG_H 50