1 // 2 // 3 // Copyright 2016 gRPC authors. 4 // 5 // Licensed under the Apache License, Version 2.0 (the "License"); 6 // you may not use this file except in compliance with the License. 7 // You may obtain a copy of the License at 8 // 9 // http://www.apache.org/licenses/LICENSE-2.0 10 // 11 // Unless required by applicable law or agreed to in writing, software 12 // distributed under the License is distributed on an "AS IS" BASIS, 13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 // See the License for the specific language governing permissions and 15 // limitations under the License. 16 // 17 // 18 19 #ifndef GRPC_SRC_CORE_LIB_TRANSPORT_HANDSHAKER_FACTORY_H 20 #define GRPC_SRC_CORE_LIB_TRANSPORT_HANDSHAKER_FACTORY_H 21 22 #include <grpc/support/port_platform.h> 23 24 #include "src/core/lib/channel/channel_args.h" 25 #include "src/core/lib/iomgr/iomgr_fwd.h" 26 27 // A handshaker factory is used to create handshakers. 28 29 // TODO(ctiller): HandshakeManager is forward declared in this file. When 30 // EventEngine lands IO support we ought to be able to include 31 // handshake_manager.h here and eliminate the HandshakeManager dependency - we 32 // cannot right now because HandshakeManager names too many iomgr types. 33 34 namespace grpc_core { 35 36 class HandshakeManager; 37 38 class HandshakerFactory { 39 public: 40 // Enum representing the priority of the handshakers. 41 // The order of the handshakers is decided by the priority. 42 // For example kPreTCPConnect handshakers are called before kTCPConnect and so 43 // on. 44 enum class HandshakerPriority : int { 45 // Handshakers that should be called before a TCP connect. Applicable mainly 46 // for Client handshakers. 47 kPreTCPConnectHandshakers, 48 // Handshakers responsible for the actual TCP connect establishment. 49 // Applicable mainly for Client handshakers. 50 kTCPConnectHandshakers, 51 // Handshakers responsible for the actual HTTP connect established. 52 // Applicable 53 // mainly for Client handshakers. 54 kHTTPConnectHandshakers, 55 // Handshakers that should be called before security handshakes but after 56 // connect establishment. Applicable mainly for Server handshakers 57 // currently. 58 kReadAheadSecurityHandshakers, 59 // Handshakers that are responsible for post connect security handshakes. 60 // Applicable for both Client and Server handshakers. 61 kSecurityHandshakers, 62 }; 63 64 virtual void AddHandshakers(const ChannelArgs& args, 65 grpc_pollset_set* interested_parties, 66 HandshakeManager* handshake_mgr) = 0; 67 // Return the priority associated with the handshaker. 68 virtual HandshakerPriority Priority() = 0; 69 virtual ~HandshakerFactory() = default; 70 }; 71 72 } // namespace grpc_core 73 74 #endif // GRPC_SRC_CORE_LIB_TRANSPORT_HANDSHAKER_FACTORY_H 75