Line data Source code
1 : #pragma once 2 : 3 : #include "envoy/http/codec.h" 4 : 5 : namespace Envoy { 6 : namespace Http { 7 : 8 : class RequestDecoderHandle { 9 : public: 10 0 : virtual ~RequestDecoderHandle() = default; 11 : 12 : /** 13 : * @return a reference to the underlying decoder if it is still valid. 14 : */ 15 : virtual OptRef<RequestDecoder> get() PURE; 16 : }; 17 : using RequestDecoderHandlePtr = std::unique_ptr<RequestDecoderHandle>; 18 : 19 : /** 20 : * ApiListener that allows consumers to interact with HTTP streams via API calls. 21 : */ 22 : // TODO(junr03): this is a replica of the functions in ServerConnectionCallbacks. It would be nice 23 : // to not duplicate this interface layout. 24 : class ApiListener { 25 : public: 26 922 : virtual ~ApiListener() = default; 27 : 28 : /** 29 : * Invoked when a new request stream is initiated by the remote. 30 : * @param response_encoder supplies the encoder to use for creating the response. The request and 31 : * response are backed by the same Stream object. 32 : * @param is_internally_created indicates if this stream was originated by a 33 : * client, or was created by Envoy, by example as part of an internal redirect. 34 : * @return RequestDecoderHandle supplies the decoder callbacks to fire into for stream 35 : * decoding events. 36 : */ 37 : virtual RequestDecoderHandlePtr newStreamHandle(ResponseEncoder& response_encoder, 38 : bool is_internally_created = false) PURE; 39 : }; 40 : 41 : using ApiListenerPtr = std::unique_ptr<ApiListener>; 42 : using ApiListenerOptRef = absl::optional<std::reference_wrapper<ApiListener>>; 43 : 44 : } // namespace Http 45 : } // namespace Envoy