AWS SDK for C++  1.8.78
AWS SDK for C++
Public Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
Aws::Utils::Event::EventStreamDecoder Class Reference

#include <EventStreamDecoder.h>

Public Member Functions

 EventStreamDecoder (EventStreamHandler *handler)
 
 ~EventStreamDecoder ()
 
 operator bool () const
 
void Pump (const ByteBuffer &data)
 
void Pump (const ByteBuffer &data, size_t length)
 
void Reset ()
 
void ResetEventStreamHandler (EventStreamHandler *handler)
 

Static Protected Member Functions

static void onPayloadSegment (aws_event_stream_streaming_decoder *decoder, aws_byte_buf *payload, int8_t isFinalSegment, void *context)
 
static void onPreludeReceived (aws_event_stream_streaming_decoder *decoder, aws_event_stream_message_prelude *prelude, void *context)
 
static void onHeaderReceived (aws_event_stream_streaming_decoder *decoder, aws_event_stream_message_prelude *prelude, aws_event_stream_header_value_pair *header, void *context)
 
static void onError (aws_event_stream_streaming_decoder *decoder, aws_event_stream_message_prelude *prelude, int errorCode, const char *message, void *context)
 

Protected Attributes

aws_event_stream_streaming_decoder m_decoder
 
EventStreamHandlerm_eventStreamHandler
 

Detailed Description

Definition at line 19 of file EventStreamDecoder.h.

Constructor & Destructor Documentation

◆ EventStreamDecoder()

Aws::Utils::Event::EventStreamDecoder::EventStreamDecoder ( EventStreamHandler handler)

◆ ~EventStreamDecoder()

Aws::Utils::Event::EventStreamDecoder::~EventStreamDecoder ( )

Member Function Documentation

◆ onError()

static void Aws::Utils::Event::EventStreamDecoder::onError ( aws_event_stream_streaming_decoder *  decoder,
aws_event_stream_message_prelude *  prelude,
int  errorCode,
const char *  message,
void *  context 
)
staticprotected

Callback function invoked when an error is encountered.

Parameters
decoderThe underlying decoder defined in aws-c-event-stream.
preludeThe metadata of the message, including total message length and header length.
errorCodeError code indicates the type of the error encountered.
messageError message indicates the details of the error encountered.
contextA context pointer, will cast it to a pointer of flow handler.

◆ onHeaderReceived()

static void Aws::Utils::Event::EventStreamDecoder::onHeaderReceived ( aws_event_stream_streaming_decoder *  decoder,
aws_event_stream_message_prelude *  prelude,
aws_event_stream_header_value_pair *  header,
void *  context 
)
staticprotected

Callback function invoked when a header is encountered.

Parameters
decoderThe underlying decoder defined in the aws-c-event-stream.
preludeThe metadata of the message, including total message length and header length.
headerA header of the message.
contextA context pointer, will cast it to a pointer of flow handler.

◆ onPayloadSegment()

static void Aws::Utils::Event::EventStreamDecoder::onPayloadSegment ( aws_event_stream_streaming_decoder *  decoder,
aws_byte_buf *  payload,
int8_t  isFinalSegment,
void *  context 
)
staticprotected

Callback function invoked when payload data has been received.

Parameters
decoderThe underlying decoder defined in the aws-c-event-stream.
payloadThe payload data received, it doesn't belong to you, make a copy if necessary.
isFinalSegmentA flag indicates the current data is the last payload buffer for that message if it equals to 1.
contextA context pointer, will cast it to a pointer of flow handler.

◆ onPreludeReceived()

static void Aws::Utils::Event::EventStreamDecoder::onPreludeReceived ( aws_event_stream_streaming_decoder *  decoder,
aws_event_stream_message_prelude *  prelude,
void *  context 
)
staticprotected

Callback function invoked when a new message has arrived.

Parameters
decoderThe underlying decoder defined in the aws-c-event-stream.
preludeThe metadata of the message, including total message length and header length.
contextA context pointer, will cast it to a pointer of flow handler.

◆ operator bool()

Aws::Utils::Event::EventStreamDecoder::operator bool ( ) const
inlineexplicit

Whether or not the decoder is in good state. Return false if the decoder encounters errors.

Definition at line 28 of file EventStreamDecoder.h.

◆ Pump() [1/2]

void Aws::Utils::Event::EventStreamDecoder::Pump ( const ByteBuffer data)

A wrapper of aws_event_stream_streaming_decoder_pump in aws-c-event-stream. Pass data to the underlying decoder.

◆ Pump() [2/2]

void Aws::Utils::Event::EventStreamDecoder::Pump ( const ByteBuffer data,
size_t  length 
)

◆ Reset()

void Aws::Utils::Event::EventStreamDecoder::Reset ( )

Reset decoder and it's handler.

◆ ResetEventStreamHandler()

void Aws::Utils::Event::EventStreamDecoder::ResetEventStreamHandler ( EventStreamHandler handler)

Reset event stream handler of the decoder

Member Data Documentation

◆ m_decoder

aws_event_stream_streaming_decoder Aws::Utils::Event::EventStreamDecoder::m_decoder
protected

The underlying decoder defined in aws-c-event-stream. The decoder will invoke callback functions when the streaming messages received.

Definition at line 104 of file EventStreamDecoder.h.

◆ m_eventStreamHandler

EventStreamHandler* Aws::Utils::Event::EventStreamDecoder::m_eventStreamHandler
protected

Definition at line 105 of file EventStreamDecoder.h.


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