mock_authorization_endpoint.h
Go to the documentation of this file.
1 // Copyright 2021 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 
15 #ifndef GRPC_TEST_CORE_UTIL_MOCK_AUTHORIZATION_ENDPOINT_H
16 #define GRPC_TEST_CORE_UTIL_MOCK_AUTHORIZATION_ENDPOINT_H
17 
19 
21 
22 namespace grpc_core {
23 
25  public:
27  absl::string_view peer_uri)
28  : local_address_(local_uri), peer_address_(peer_uri) {
29  static constexpr grpc_endpoint_vtable vtable = {
30  nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
31  nullptr, GetPeer, GetLocalAddress, nullptr, nullptr};
33  }
34 
37  reinterpret_cast<MockAuthorizationEndpoint*>(ep);
38  return m->peer_address_;
39  }
40 
43  reinterpret_cast<MockAuthorizationEndpoint*>(ep);
44  return m->local_address_;
45  }
46 
47  void SetPeer(absl::string_view peer_address) {
48  peer_address_ = std::string(peer_address);
49  }
50 
51  void SetLocalAddress(absl::string_view local_address) {
52  local_address_ = std::string(local_address);
53  }
54 
55  private:
58 };
59 
60 } // namespace grpc_core
61 
62 #endif // GRPC_TEST_CORE_UTIL_MOCK_AUTHORIZATION_ENDPOINT_H
grpc_core::MockAuthorizationEndpoint::local_address_
std::string local_address_
Definition: mock_authorization_endpoint.h:56
grpc_endpoint_vtable
Definition: endpoint.h:39
grpc_core
Definition: call_metric_recorder.h:31
absl::string_view
Definition: abseil-cpp/absl/strings/string_view.h:167
grpc_endpoint::vtable
const grpc_endpoint_vtable * vtable
Definition: endpoint.h:106
testing::internal::string
::std::string string
Definition: bloaty/third_party/protobuf/third_party/googletest/googletest/include/gtest/internal/gtest-port.h:881
grpc_core::MockAuthorizationEndpoint
Definition: mock_authorization_endpoint.h:24
grpc_core::MockAuthorizationEndpoint::GetPeer
static absl::string_view GetPeer(grpc_endpoint *ep)
Definition: mock_authorization_endpoint.h:35
grpc_core::MockAuthorizationEndpoint::SetLocalAddress
void SetLocalAddress(absl::string_view local_address)
Definition: mock_authorization_endpoint.h:51
endpoint.h
grpc_core::MockAuthorizationEndpoint::peer_address_
std::string peer_address_
Definition: mock_authorization_endpoint.h:57
regress.m
m
Definition: regress/regress.py:25
grpc_core::MockAuthorizationEndpoint::MockAuthorizationEndpoint
MockAuthorizationEndpoint(absl::string_view local_uri, absl::string_view peer_uri)
Definition: mock_authorization_endpoint.h:26
grpc_endpoint
Definition: endpoint.h:105
grpc_core::MockAuthorizationEndpoint::GetLocalAddress
static absl::string_view GetLocalAddress(grpc_endpoint *ep)
Definition: mock_authorization_endpoint.h:41
grpc_core::MockAuthorizationEndpoint::SetPeer
void SetPeer(absl::string_view peer_address)
Definition: mock_authorization_endpoint.h:47
port_platform.h


grpc
Author(s):
autogenerated on Thu Mar 13 2025 03:00:40