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 #include <grpc/grpc.h> 16 #include <grpc/grpc_security.h> 17 #include <grpc/support/port_platform.h> 18 19 #include "src/core/lib/security/authorization/authorization_policy_provider.h" 20 #include "src/core/util/ref_counted_ptr.h" 21 #include "src/core/util/useful.h" 22 23 namespace { 24 ProviderArgCopy(void * p)25void* ProviderArgCopy(void* p) { 26 grpc_authorization_policy_provider* provider = 27 static_cast<grpc_authorization_policy_provider*>(p); 28 provider->Ref().release(); 29 return provider; 30 } 31 ProviderArgDestroy(void * p)32void ProviderArgDestroy(void* p) { 33 grpc_authorization_policy_provider* provider = 34 static_cast<grpc_authorization_policy_provider*>(p); 35 provider->Unref(); 36 } 37 ProviderArgCmp(void * p,void * q)38int ProviderArgCmp(void* p, void* q) { return grpc_core::QsortCompare(p, q); } 39 40 } // namespace 41 42 // Wrapper API declared in grpc.h 43 grpc_authorization_policy_provider_arg_vtable()44const grpc_arg_pointer_vtable* grpc_authorization_policy_provider_arg_vtable() { 45 static const grpc_arg_pointer_vtable vtable = { 46 ProviderArgCopy, ProviderArgDestroy, ProviderArgCmp}; 47 return &vtable; 48 } 49