proxygen
proxygen::HTTPCodec::Callback Class Referenceabstract

#include <HTTPCodec.h>

Inheritance diagram for proxygen::HTTPCodec::Callback:
HTTP1xCodecCallback proxygen::FakeHTTPCodecCallback proxygen::HTTPSession proxygen::MockHTTPCodecCallback proxygen::RFC1867Codec proxygen::HTTPDownstreamSession proxygen::HTTPUpstreamSession

Public Member Functions

virtual void onMessageBegin (StreamID stream, HTTPMessage *msg)=0
 
virtual void onPushMessageBegin (StreamID, StreamID, HTTPMessage *)
 
virtual void onExMessageBegin (StreamID, StreamID, bool, HTTPMessage *)
 
virtual void onHeadersComplete (StreamID stream, std::unique_ptr< HTTPMessage > msg)=0
 
virtual void onBody (StreamID stream, std::unique_ptr< folly::IOBuf > chain, uint16_t padding)=0
 
virtual void onChunkHeader (StreamID, size_t)
 
virtual void onChunkComplete (StreamID)
 
virtual void onTrailersComplete (StreamID stream, std::unique_ptr< HTTPHeaders > trailers)=0
 
virtual void onMessageComplete (StreamID stream, bool upgrade)=0
 
virtual void onError (StreamID stream, const HTTPException &error, bool newTxn=false)=0
 
virtual void onAbort (StreamID, ErrorCode)
 
virtual void onFrameHeader (StreamID, uint8_t, uint64_t, uint8_t, uint16_t=0)
 
virtual void onGoaway (uint64_t, ErrorCode, std::unique_ptr< folly::IOBuf >=nullptr)
 
virtual void onPingRequest (uint64_t)
 
virtual void onPingReply (uint64_t)
 
virtual void onWindowUpdate (StreamID, uint32_t)
 
virtual void onSettings (const SettingsList &)
 
virtual void onSettingsAck ()
 
virtual void onPriority (StreamID, const HTTPMessage::HTTPPriority &)
 
virtual bool onNativeProtocolUpgrade (StreamID, CodecProtocol, const std::string &, HTTPMessage &)
 
virtual void onGenerateFrameHeader (StreamID, uint8_t, uint64_t, uint16_t=0)
 
virtual void onCertificateRequest (uint16_t, std::unique_ptr< folly::IOBuf >)
 
virtual void onCertificate (uint16_t, std::unique_ptr< folly::IOBuf >)
 
virtual uint32_t numOutgoingStreams () const
 
virtual uint32_t numIncomingStreams () const
 
virtual ~Callback ()
 

Detailed Description

Callback interface that users of HTTPCodec must implement

Definition at line 78 of file HTTPCodec.h.

Constructor & Destructor Documentation

virtual proxygen::HTTPCodec::Callback::~Callback ( )
inlinevirtual

Definition at line 329 of file HTTPCodec.h.

329 {}

Member Function Documentation

virtual uint32_t proxygen::HTTPCodec::Callback::numIncomingStreams ( ) const
inlinevirtual

Return the number of open streams started by the remote side. Parallel codecs with a maximum number of streams will invoke this to determine if a new stream exceeds the limit.

Reimplemented in proxygen::HTTPSession, and proxygen::FakeHTTPCodecCallback.

Definition at line 327 of file HTTPCodec.h.

Referenced by proxygen::SPDYCodec::onSynStream(), and proxygen::HTTP2Codec::parseHeadersCheckConcurrentStreams().

327 { return 0; }
virtual uint32_t proxygen::HTTPCodec::Callback::numOutgoingStreams ( ) const
inlinevirtual

Return the number of open streams started by this codec callback. Parallel codecs with a maximum number of streams will invoke this to determine if a new stream exceeds the limit.

Reimplemented in proxygen::HTTPSession, and proxygen::FakeHTTPCodecCallback.

Definition at line 320 of file HTTPCodec.h.

320 { return 0; }
virtual void proxygen::HTTPCodec::Callback::onAbort ( StreamID  ,
ErrorCode   
)
inlinevirtual

Called when the peer has asked to shut down a stream immediately.

Parameters
streamThe stream ID
codeThe code the stream was aborted with
Note
Not applicable to all protocols.

Reimplemented in proxygen::HTTPSession, and proxygen::FakeHTTPCodecCallback.

Definition at line 192 of file HTTPCodec.h.

Referenced by proxygen::SPDYCodec::onRstStream(), and proxygen::HTTP2Codec::parseRstStream().

194  {}
virtual void proxygen::HTTPCodec::Callback::onBody ( StreamID  stream,
std::unique_ptr< folly::IOBuf chain,
uint16_t  padding 
)
pure virtual

Called for each block of message body data

Parameters
streamThe stream ID
chainOne or more buffers of body data. The codec will remove any protocol framing, such as HTTP/1.1 chunk headers, from the buffers before calling this function.
paddingNumber of pad bytes that came with the data segment

Implemented in proxygen::HTTPSession, proxygen::MockHTTPCodecCallback, proxygen::FakeHTTPCodecCallback, proxygen::RFC1867Codec, and HTTP1xCodecCallback.

Referenced by proxygen::HTTP1xCodec::onBody(), proxygen::HTTP1xCodec::onIngress(), proxygen::HTTP2Codec::parseAllData(), proxygen::HTTP2Codec::parseDataFrameData(), and proxygen::SPDYCodec::parseIngress().

virtual void proxygen::HTTPCodec::Callback::onCertificate ( uint16_t  ,
std::unique_ptr< folly::IOBuf  
)
inlinevirtual

Called upon receipt of an authenticator, for protocols that support secondary certificate authentication.

Parameters
certIdThe Cert-ID identifying this authenticator
authenticatorThe authenticator request
Note
Not all protocols support secondary certificate authentication. HTTP/2 does, but HTTP/1.1 doesn't.

Reimplemented in proxygen::HTTPSession, proxygen::FakeHTTPCodecCallback, and proxygen::MockHTTPCodecCallback.

Definition at line 310 of file HTTPCodec.h.

Referenced by proxygen::HTTP2Codec::parseCertificate().

312  {
313  }
virtual void proxygen::HTTPCodec::Callback::onCertificateRequest ( uint16_t  ,
std::unique_ptr< folly::IOBuf  
)
inlinevirtual

Called upon receipt of a certificate request frame, for protocols that support secondary certificate authentication.

Parameters
requestIdThe Request-ID identifying the certificate request
authRequestThe authenticator request
Note
Not all protocols support secondary certificate authentication. HTTP/2 does, but HTTP/1.1 doesn't.

Reimplemented in proxygen::HTTPSession, proxygen::FakeHTTPCodecCallback, and proxygen::MockHTTPCodecCallback.

Definition at line 297 of file HTTPCodec.h.

Referenced by proxygen::HTTP2Codec::parseCertificateRequest().

299  {
300  }
virtual void proxygen::HTTPCodec::Callback::onChunkComplete ( StreamID  )
inlinevirtual

Called when the terminating CRLF is received to end a chunk of HTTP body data.

Parameters
streamThe stream ID

Reimplemented in proxygen::HTTPSession, proxygen::FakeHTTPCodecCallback, and HTTP1xCodecCallback.

Definition at line 156 of file HTTPCodec.h.

References folly::pushmi::operators::error().

Referenced by proxygen::HTTP1xCodec::onChunkComplete().

156 {}
virtual void proxygen::HTTPCodec::Callback::onChunkHeader ( StreamID  ,
size_t   
)
inlinevirtual

Called for each HTTP chunk header.

onChunkHeader() will be called when the chunk header is received. As the chunk data arrives, it will be passed to the callback normally with onBody() calls. Note that the chunk data may arrive in multiple onBody() calls: it is not guaranteed to arrive in a single onBody() call.

After the chunk data has been received and the terminating CRLF has been received, onChunkComplete() will be called.

Parameters
streamThe stream ID
lengthThe chunk length.

Reimplemented in proxygen::HTTPSession, proxygen::FakeHTTPCodecCallback, and HTTP1xCodecCallback.

Definition at line 148 of file HTTPCodec.h.

Referenced by proxygen::HTTP1xCodec::onChunkHeader().

148 {}
virtual void proxygen::HTTPCodec::Callback::onError ( StreamID  stream,
const HTTPException error,
bool  newTxn = false 
)
pure virtual
virtual void proxygen::HTTPCodec::Callback::onExMessageBegin ( StreamID  ,
StreamID  ,
bool  ,
HTTPMessage  
)
inlinevirtual

Called when a new extended message is seen while parsing the ingress.

Parameters
streamThe stream ID
controlStreamThe stream ID of the associated stream, which can never be 0
msgA newly allocated HTTPMessage

Reimplemented in proxygen::HTTPSession, and proxygen::FakeHTTPCodecCallback.

Definition at line 107 of file HTTPCodec.h.

References uint16_t.

Referenced by proxygen::HTTP2Codec::parseHeadersImpl().

110  {}
virtual void proxygen::HTTPCodec::Callback::onFrameHeader ( StreamID  ,
uint8_t  ,
uint64_t  ,
uint8_t  ,
uint16_t  = 0 
)
inlinevirtual

Called upon receipt of a frame header.

Parameters
stream_idThe stream ID
flagsThe flags field of frame header
lengthThe length field of frame header
typeThe type field of frame header
versionThe version of frame (SPDY only)
Note
Not all protocols have frames. SPDY and HTTP/2 do, but HTTP/1.1 doesn't.

Reimplemented in proxygen::FakeHTTPCodecCallback.

Definition at line 206 of file HTTPCodec.h.

Referenced by proxygen::HTTP2Codec::onIngress(), and proxygen::SPDYCodec::parseIngress().

211  {}
virtual void proxygen::HTTPCodec::Callback::onGenerateFrameHeader ( StreamID  ,
uint8_t  ,
uint64_t  ,
uint16_t  = 0 
)
inlinevirtual

Called after a header frame is generated. This only applies to framed codecs.

Definition at line 283 of file HTTPCodec.h.

Referenced by proxygen::HTTP2Codec::generateHeaderCallbackWrapper().

287  {}
virtual void proxygen::HTTPCodec::Callback::onGoaway ( uint64_t  ,
ErrorCode  ,
std::unique_ptr< folly::IOBuf = nullptr 
)
inlinevirtual

Called upon receipt of a goaway.

Parameters
lastGoodStreamIDLast successful stream created by the receiver
codeThe code the connection was aborted with
debugDataThe additional debug data for diagnostic purpose
Note
Not all protocols have goaways. SPDY does, but HTTP/1.1 doesn't.

Reimplemented in proxygen::HTTPSession, proxygen::FakeHTTPCodecCallback, and proxygen::MockHTTPCodecCallback.

Definition at line 220 of file HTTPCodec.h.

Referenced by proxygen::SPDYCodec::onGoaway(), and proxygen::HTTP2Codec::parseGoaway().

223  {}
virtual void proxygen::HTTPCodec::Callback::onHeadersComplete ( StreamID  stream,
std::unique_ptr< HTTPMessage msg 
)
pure virtual

Called when all the headers of an ingress message have been parsed

Parameters
streamThe stream ID
msgThe message
sizeSize of the ingress header

Implemented in proxygen::HTTPSession, proxygen::MockHTTPCodecCallback, proxygen::FakeHTTPCodecCallback, proxygen::RFC1867Codec, and HTTP1xCodecCallback.

Referenced by proxygen::HTTP1xCodec::onHeadersComplete(), proxygen::SPDYCodec::onSynCommon(), and proxygen::HTTP2Codec::parseHeadersImpl().

virtual void proxygen::HTTPCodec::Callback::onMessageBegin ( StreamID  stream,
HTTPMessage msg 
)
pure virtual

Called when a new message is seen while parsing the ingress

Parameters
streamThe stream ID
msgA newly allocated HTTPMessage

Implemented in proxygen::HTTPSession, proxygen::FakeHTTPCodecCallback, proxygen::RFC1867Codec, and HTTP1xCodecCallback.

Referenced by proxygen::SPDYCodec::deliverOnMessageBegin(), proxygen::HTTP1xCodec::onMessageBegin(), and proxygen::HTTP2Codec::parseHeadersImpl().

virtual void proxygen::HTTPCodec::Callback::onMessageComplete ( StreamID  stream,
bool  upgrade 
)
pure virtual

Called at end of a message (including body and trailers, if applicable)

Parameters
streamThe stream ID
upgradeWhether the connection has been upgraded to another protocol.

Implemented in proxygen::HTTPSession, proxygen::FakeHTTPCodecCallback, proxygen::RFC1867Codec, and HTTP1xCodecCallback.

Referenced by proxygen::HTTP2Codec::handleEndStream(), proxygen::HTTP1xCodec::onIngressEOF(), proxygen::HTTP1xCodec::onMessageComplete(), and proxygen::SPDYCodec::parseIngress().

virtual bool proxygen::HTTPCodec::Callback::onNativeProtocolUpgrade ( StreamID  ,
CodecProtocol  ,
const std::string ,
HTTPMessage  
)
inlinevirtual

Called upon receipt of a valid protocol switch. Return false if protocol switch could not be completed.

Reimplemented in proxygen::FakeHTTPCodecCallback, proxygen::HTTPUpstreamSession, and proxygen::HTTPDownstreamSession.

Definition at line 271 of file HTTPCodec.h.

Referenced by proxygen::HTTP1xCodec::onHeadersComplete(), and proxygen::HTTP1xCodec::onMessageComplete().

275  {
276  return false;
277  }
virtual void proxygen::HTTPCodec::Callback::onPingReply ( uint64_t  )
inlinevirtual

Called upon receipt of a ping reply

Parameters
uniqueIDUnique identifier for the ping
Note
Not all protocols have pings. SPDY does, but HTTP/1.1 doesn't.

Reimplemented in proxygen::HTTPSession, and proxygen::FakeHTTPCodecCallback.

Definition at line 237 of file HTTPCodec.h.

Referenced by proxygen::SPDYCodec::onPing(), and proxygen::HTTP2Codec::parsePing().

237 {}
virtual void proxygen::HTTPCodec::Callback::onPingRequest ( uint64_t  )
inlinevirtual

Called upon receipt of a ping request

Parameters
uniqueIDUnique identifier for the ping
Note
Not all protocols have pings. SPDY does, but HTTP/1.1 doesn't.

Reimplemented in proxygen::HTTPSession, and proxygen::FakeHTTPCodecCallback.

Definition at line 230 of file HTTPCodec.h.

Referenced by proxygen::SPDYCodec::onPing(), and proxygen::HTTP2Codec::parsePing().

230 {}
virtual void proxygen::HTTPCodec::Callback::onPriority ( StreamID  ,
const HTTPMessage::HTTPPriority  
)
inlinevirtual

Called upon receipt of a priority frame, for protocols that support dynamic priority

Reimplemented in proxygen::HTTPSession, and proxygen::FakeHTTPCodecCallback.

Definition at line 263 of file HTTPCodec.h.

Referenced by proxygen::HTTP2Codec::parsePriority().

265  {}
virtual void proxygen::HTTPCodec::Callback::onPushMessageBegin ( StreamID  ,
StreamID  ,
HTTPMessage  
)
inlinevirtual

Called when a new push message is seen while parsing the ingress.

Parameters
streamThe stream ID
assocStreamThe stream ID of the associated stream, which can never be 0
msgA newly allocated HTTPMessage

Reimplemented in proxygen::HTTPSession, proxygen::FakeHTTPCodecCallback, and HTTP1xCodecCallback.

Definition at line 95 of file HTTPCodec.h.

Referenced by proxygen::SPDYCodec::deliverOnMessageBegin(), and proxygen::HTTP2Codec::parseHeadersImpl().

97  {}
virtual void proxygen::HTTPCodec::Callback::onSettings ( const SettingsList )
inlinevirtual

Called upon receipt of a settings frame, for protocols that support settings.

Parameters
settingsa list of settings that were sent in the settings frame

Reimplemented in proxygen::HTTPSession, and proxygen::FakeHTTPCodecCallback.

Definition at line 251 of file HTTPCodec.h.

Referenced by proxygen::HTTP2Codec::handleSettings(), and proxygen::SPDYCodec::onSettings().

251 {}
virtual void proxygen::HTTPCodec::Callback::onSettingsAck ( )
inlinevirtual

Called upon receipt of a settings frame with ACK set, for protocols that support settings ack.

Reimplemented in proxygen::HTTPSession, and proxygen::FakeHTTPCodecCallback.

Definition at line 257 of file HTTPCodec.h.

Referenced by proxygen::HTTP2Codec::parseSettings().

257 {}
virtual void proxygen::HTTPCodec::Callback::onTrailersComplete ( StreamID  stream,
std::unique_ptr< HTTPHeaders trailers 
)
pure virtual

Called when all the trailers of an ingress message have been parsed, but only if the number of trailers is nonzero.

Parameters
streamThe stream ID
trailersThe message trailers

Implemented in proxygen::HTTPSession, proxygen::MockHTTPCodecCallback, proxygen::FakeHTTPCodecCallback, proxygen::RFC1867Codec, and HTTP1xCodecCallback.

Referenced by proxygen::HTTP1xCodec::onMessageComplete(), and proxygen::HTTP2Codec::parseHeadersImpl().

virtual void proxygen::HTTPCodec::Callback::onWindowUpdate ( StreamID  ,
uint32_t   
)
inlinevirtual

Called upon receipt of a window update, for protocols that support flow control. For instance spdy/3 and higher.

Reimplemented in proxygen::HTTPSession, and proxygen::FakeHTTPCodecCallback.

Definition at line 243 of file HTTPCodec.h.

Referenced by proxygen::SPDYCodec::onWindowUpdate(), and proxygen::HTTP2Codec::parseWindowUpdate().

243 {}

The documentation for this class was generated from the following file: