LibAwsEventStream

Documentation for LibAwsEventStream.

LibAwsEventStream.aws_event_stream_process_on_payload_segment_fnType

Called by aws_aws_event_stream_streaming_decoder when payload data has been received. 'data' doesn't belong to you, so copy the data if it is needed beyond the scope of your callback. final_segment == 1 indicates the current data is the last payload buffer for that message.

source
LibAwsEventStream.aws_event_stream_rpc_client_on_connection_setup_fnType

Invoked when a connection attempt completes.

If the attempt was unsuccessful, the error_code will be non-zero and the connection pointer will be NULL, and aws_event_stream_rpc_client_on_connection_shutdown_fn will not be invoked.

If the attempt was successful, error_code will be 0 and the connection pointer will be valid. You must call aws_event_stream_rpc_client_connection_acquire() to prevent the pointer's memory from being destroyed before you are ready. When you are completely done with the connection pointer you must call aws_event_stream_rpc_client_connection_release() or its memory will leak. aws_event_stream_rpc_client_on_connection_shutdown_fn will be invoked when the network connection has closed. If you are done with the connection, but it is still open, you must call aws_aws_event_stream_rpc_client_close() or network connection will remain open, even if you call release().

source
LibAwsEventStream.aws_event_stream_rpc_server_on_incoming_stream_fnType

Invoked when a new stream has been received on the connection. If you return AWS_OP_SUCCESS (0), You must fill in the fields for continuation options or the program will assert and exit.

A failure path MUST leave the ref count of the continuation alone.

A success path should probably take a ref which will leave the continuation (assuming no other interference) at two AFTER creation is complete: 1 for the connection's continuation table, and one for the callback recipient which is presumably tracking it as well.

source
LibAwsEventStream.aws_event_stream_rpc_server_on_new_connection_fnType

Invoked when a new connection is received on a server listener. If you return AWS_OP_SUCCESS, You must fill in the fields for connection_options or the program will assert and exit.

If error_code is non-zero, an error occurred upon setting up the channel and connection will be NULL. Otherwise, connection is non-null. If you intend to seat a pointer to connection, you MUST call aws_event_stream_rpc_server_connection_acquire() and when you're finished with the connection you MUST call aws_event_stream_server_connection_release().

source
LibAwsEventStream.aws_event_stream_add_bool_headerMethod
aws_event_stream_add_bool_header(headers, name, name_len, value)

Adds a bool header to the list of headers.

Prototype

int aws_event_stream_add_bool_header( struct aws_array_list *headers, const char *name, uint8_t name_len, int8_t value);
source
LibAwsEventStream.aws_event_stream_add_bool_header_by_cursorMethod
aws_event_stream_add_bool_header_by_cursor(headers, name, value)

Adds a boolean-valued header to a header list

Arguments

  • headers: header list to add to
  • name: name of the header to add
  • value: value of the header to add

Returns

AWS_OP_SUCCESS on success, AWS_OP_ERR on failure

Prototype

int aws_event_stream_add_bool_header_by_cursor( struct aws_array_list *headers, struct aws_byte_cursor name, bool value);
source
LibAwsEventStream.aws_event_stream_add_byte_buf_header_by_cursorMethod
aws_event_stream_add_byte_buf_header_by_cursor(headers, name, value)

Adds a byte_buf-valued header to a header list

Arguments

  • headers: header list to add to
  • name: name of the header to add
  • value: value of the header to add

Returns

AWS_OP_SUCCESS on success, AWS_OP_ERR on failure

Prototype

int aws_event_stream_add_byte_buf_header_by_cursor( struct aws_array_list *headers, struct aws_byte_cursor name, struct aws_byte_cursor value);
source
LibAwsEventStream.aws_event_stream_add_byte_headerMethod
aws_event_stream_add_byte_header(headers, name, name_len, value)

Adds a byte header to the list of headers.

Prototype

int aws_event_stream_add_byte_header( struct aws_array_list *headers, const char *name, uint8_t name_len, int8_t value);
source
LibAwsEventStream.aws_event_stream_add_byte_header_by_cursorMethod
aws_event_stream_add_byte_header_by_cursor(headers, name, value)

Adds a byte-valued header to a header list

Arguments

  • headers: header list to add to
  • name: name of the header to add
  • value: value of the header to add

Returns

AWS_OP_SUCCESS on success, AWS_OP_ERR on failure

Prototype

int aws_event_stream_add_byte_header_by_cursor( struct aws_array_list *headers, struct aws_byte_cursor name, int8_t value);
source
LibAwsEventStream.aws_event_stream_add_bytebuf_headerMethod
aws_event_stream_add_bytebuf_header(headers, name, name_len, value, value_len, copy)

Adds a byte-buffer header to the list of headers. If copy is set to true, this will result in an allocation for the header value. Otherwise, the value will be set to the memory address of 'value'.

Prototype

int aws_event_stream_add_bytebuf_header( struct aws_array_list *headers, const char *name, uint8_t name_len, uint8_t *value, uint16_t value_len, int8_t copy);
source
LibAwsEventStream.aws_event_stream_add_headerMethod
aws_event_stream_add_header(headers, header)

Adds a generic header to the list of headers. Makes a copy of the underlaying data.

Prototype

int aws_event_stream_add_header( struct aws_array_list *headers, const struct aws_event_stream_header_value_pair *header);
source
LibAwsEventStream.aws_event_stream_add_int16_headerMethod
aws_event_stream_add_int16_header(headers, name, name_len, value)

adds a 16 bit integer to the list of headers.

Prototype

int aws_event_stream_add_int16_header( struct aws_array_list *headers, const char *name, uint8_t name_len, int16_t value);
source
LibAwsEventStream.aws_event_stream_add_int16_header_by_cursorMethod
aws_event_stream_add_int16_header_by_cursor(headers, name, value)

Adds a int16-valued header to a header list

Arguments

  • headers: header list to add to
  • name: name of the header to add
  • value: value of the header to add

Returns

AWS_OP_SUCCESS on success, AWS_OP_ERR on failure

Prototype

int aws_event_stream_add_int16_header_by_cursor( struct aws_array_list *headers, struct aws_byte_cursor name, int16_t value);
source
LibAwsEventStream.aws_event_stream_add_int32_headerMethod
aws_event_stream_add_int32_header(headers, name, name_len, value)

adds a 32 bit integer to the list of headers.

Prototype

int aws_event_stream_add_int32_header( struct aws_array_list *headers, const char *name, uint8_t name_len, int32_t value);
source
LibAwsEventStream.aws_event_stream_add_int32_header_by_cursorMethod
aws_event_stream_add_int32_header_by_cursor(headers, name, value)

Adds a int32-valued header to a header list

Arguments

  • headers: header list to add to
  • name: name of the header to add
  • value: value of the header to add

Returns

AWS_OP_SUCCESS on success, AWS_OP_ERR on failure

Prototype

int aws_event_stream_add_int32_header_by_cursor( struct aws_array_list *headers, struct aws_byte_cursor name, int32_t value);
source
LibAwsEventStream.aws_event_stream_add_int64_headerMethod
aws_event_stream_add_int64_header(headers, name, name_len, value)

adds a 64 bit integer to the list of headers.

Prototype

int aws_event_stream_add_int64_header( struct aws_array_list *headers, const char *name, uint8_t name_len, int64_t value);
source
LibAwsEventStream.aws_event_stream_add_int64_header_by_cursorMethod
aws_event_stream_add_int64_header_by_cursor(headers, name, value)

Adds a int64-valued header to a header list

Arguments

  • headers: header list to add to
  • name: name of the header to add
  • value: value of the header to add

Returns

AWS_OP_SUCCESS on success, AWS_OP_ERR on failure

Prototype

int aws_event_stream_add_int64_header_by_cursor( struct aws_array_list *headers, struct aws_byte_cursor name, int64_t value);
source
LibAwsEventStream.aws_event_stream_add_string_headerMethod
aws_event_stream_add_string_header(headers, name, name_len, value, value_len, copy)

Adds a string header to the list of headers. If copy is set to true, this will result in an allocation for the header value. Otherwise, the value will be set to the memory address of 'value'.

Prototype

int aws_event_stream_add_string_header( struct aws_array_list *headers, const char *name, uint8_t name_len, const char *value, uint16_t value_len, int8_t copy);
source
LibAwsEventStream.aws_event_stream_add_string_header_by_cursorMethod
aws_event_stream_add_string_header_by_cursor(headers, name, value)

Adds a string-valued header to a header list

Arguments

  • headers: header list to add to
  • name: name of the header to add
  • value: value of the header to add

Returns

AWS_OP_SUCCESS on success, AWS_OP_ERR on failure

Prototype

int aws_event_stream_add_string_header_by_cursor( struct aws_array_list *headers, struct aws_byte_cursor name, struct aws_byte_cursor value);
source
LibAwsEventStream.aws_event_stream_add_timestamp_headerMethod
aws_event_stream_add_timestamp_header(headers, name, name_len, value)

adds a 64 bit integer representing milliseconds since unix epoch to the list of headers.

Prototype

int aws_event_stream_add_timestamp_header( struct aws_array_list *headers, const char *name, uint8_t name_len, int64_t value);
source
LibAwsEventStream.aws_event_stream_add_timestamp_header_by_cursorMethod
aws_event_stream_add_timestamp_header_by_cursor(headers, name, value)

Adds a timestamp-valued header to a header list

Arguments

  • headers: header list to add to
  • name: name of the header to add
  • value: value of the header to add

Returns

AWS_OP_SUCCESS on success, AWS_OP_ERR on failure

Prototype

int aws_event_stream_add_timestamp_header_by_cursor( struct aws_array_list *headers, struct aws_byte_cursor name, int64_t value);
source
LibAwsEventStream.aws_event_stream_add_uuid_headerMethod
aws_event_stream_add_uuid_header(headers, name, name_len, value)

adds a uuid buffer to the list of headers. Value must always be 16 bytes long.

Prototype

int aws_event_stream_add_uuid_header( struct aws_array_list *headers, const char *name, uint8_t name_len, const uint8_t *value);
source
LibAwsEventStream.aws_event_stream_add_uuid_header_by_cursorMethod
aws_event_stream_add_uuid_header_by_cursor(headers, name, value)

Adds a uuid-valued header to a header list

Arguments

  • headers: header list to add to
  • name: name of the header to add
  • value: value of the header to add

Returns

AWS_OP_SUCCESS on success, AWS_OP_ERR on failure

Prototype

int aws_event_stream_add_uuid_header_by_cursor( struct aws_array_list *headers, struct aws_byte_cursor name, struct aws_byte_cursor value);
source
LibAwsEventStream.aws_event_stream_channel_handler_increment_read_windowMethod
aws_event_stream_channel_handler_increment_read_window(handler, window_update_size)

Updates the read window for the channel if automatic_window_managemanet was set to false.

Prototype

void aws_event_stream_channel_handler_increment_read_window( struct aws_channel_handler *handler, size_t window_update_size);
source
LibAwsEventStream.aws_event_stream_channel_handler_newMethod
aws_event_stream_channel_handler_new(allocator, handler_options)

Allocates and initializes a new channel handler for processing aws_event_stream_message() events. Handler options must not be null.

Prototype

struct aws_channel_handler *aws_event_stream_channel_handler_new( struct aws_allocator *allocator, const struct aws_event_stream_channel_handler_options *handler_options);
source
LibAwsEventStream.aws_event_stream_channel_handler_write_messageMethod
aws_event_stream_channel_handler_write_message(handler, message, on_message_written, user_data)

Writes an aws_event_stream_message() to the channel. Once the channel flushes or an error occurs, on_message_written will be invoked. message should stay valid until the callback is invoked. If an error an occurs, the channel will automatically be shutdown.

Prototype

int aws_event_stream_channel_handler_write_message( struct aws_channel_handler *handler, struct aws_event_stream_message *message, aws_event_stream_channel_handler_on_message_written_fn *on_message_written, void *user_data);
source
LibAwsEventStream.aws_event_stream_header_nameMethod
aws_event_stream_header_name(header)

Returns the header name. Note: this value is not null terminated

Prototype

struct aws_byte_buf aws_event_stream_header_name( struct aws_event_stream_header_value_pair *header);
source
LibAwsEventStream.aws_event_stream_header_value_as_stringMethod
aws_event_stream_header_value_as_string(header)

Returns the header value as a string. Note: this value is not null terminated.

Prototype

struct aws_byte_buf aws_event_stream_header_value_as_string( struct aws_event_stream_header_value_pair *header);
source
LibAwsEventStream.aws_event_stream_header_value_as_uuidMethod
aws_event_stream_header_value_as_uuid(header)

Returns the header value a byte buffer which is 16 bytes long. Represents a UUID.

Prototype

struct aws_byte_buf aws_event_stream_header_value_as_uuid( struct aws_event_stream_header_value_pair *header);
source
LibAwsEventStream.aws_event_stream_header_value_lengthMethod
aws_event_stream_header_value_length(header)

Returns the length of the header value buffer. This is mostly intended for string and byte buffer types.

Prototype

uint16_t aws_event_stream_header_value_length(struct aws_event_stream_header_value_pair *header);
source
LibAwsEventStream.aws_event_stream_headers_list_cleanupMethod
aws_event_stream_headers_list_cleanup(headers)

Cleans up the headers list. Also deallocates any headers that were the result of a copy flag for strings or buffer.

Prototype

void aws_event_stream_headers_list_cleanup(struct aws_array_list *headers);
source
LibAwsEventStream.aws_event_stream_headers_list_initMethod
aws_event_stream_headers_list_init(headers, allocator)

initializes a headers list for you. It will default to a capacity of 4 in dynamic mode.

Prototype

int aws_event_stream_headers_list_init( struct aws_array_list *headers, struct aws_allocator *allocator);
source
LibAwsEventStream.aws_event_stream_library_clean_upMethod
aws_event_stream_library_clean_up()

Clean up internal datastructures used by aws-c-event-stream. Must not be called until application is done using functionality in aws-c-event-stream.

Prototype

void aws_event_stream_library_clean_up(void);
source
LibAwsEventStream.aws_event_stream_library_initMethod
aws_event_stream_library_init(allocator)

Initializes internal datastructures used by aws-c-event-stream. Must be called before using any functionality in aws-c-event-stream.

Prototype

void aws_event_stream_library_init(struct aws_allocator *allocator);
source
LibAwsEventStream.aws_event_stream_message_clean_upMethod
aws_event_stream_message_clean_up(message)

Cleans up any internally allocated memory. Always call this for API compatibility reasons, even if you only used the aws_aws_event_stream_message_from_buffer function.

Prototype

void aws_event_stream_message_clean_up(struct aws_event_stream_message *message);
source
LibAwsEventStream.aws_event_stream_message_from_bufferMethod
aws_event_stream_message_from_buffer(message, alloc, buffer)

Zero allocation, Zero copy. The message will simply wrap the buffer. The message functions are only useful as long as buffer is referencable memory.

Prototype

int aws_event_stream_message_from_buffer( struct aws_event_stream_message *message, struct aws_allocator *alloc, struct aws_byte_buf *buffer);
source
LibAwsEventStream.aws_event_stream_message_from_buffer_copyMethod
aws_event_stream_message_from_buffer_copy(message, alloc, buffer)

Allocates memory and copies buffer. Otherwise the same as aws_aws_event_stream_message_from_buffer. This is slower, but possibly safer.

Prototype

int aws_event_stream_message_from_buffer_copy( struct aws_event_stream_message *message, struct aws_allocator *alloc, const struct aws_byte_buf *buffer);
source
LibAwsEventStream.aws_event_stream_message_headersMethod
aws_event_stream_message_headers(message, headers)

Adds the headers for the message to list. The memory in each header is owned as part of the message, do not free it or pass its address around.

Prototype

int aws_event_stream_message_headers( const struct aws_event_stream_message *message, struct aws_array_list *headers);
source
LibAwsEventStream.aws_event_stream_message_initMethod
aws_event_stream_message_init(message, alloc, headers, payload)

Initializes with a list of headers, the payload, and a payload length. CRCs will be computed for you. If headers or payload is NULL, then the fields will be appropriately set to indicate no headers and/or no payload. Both payload and headers will result in an allocation.

Prototype

int aws_event_stream_message_init( struct aws_event_stream_message *message, struct aws_allocator *alloc, const struct aws_array_list *headers, const struct aws_byte_buf *payload);
source
LibAwsEventStream.aws_event_stream_message_to_debug_strMethod
aws_event_stream_message_to_debug_str(fd, message)

Writes the message to fd in json format. All strings and binary fields are base64 encoded.

Prototype

int aws_event_stream_message_to_debug_str( FILE *fd, const struct aws_event_stream_message *message);
source
LibAwsEventStream.aws_event_stream_read_headers_from_bufferMethod
aws_event_stream_read_headers_from_buffer(headers, buffer, headers_len)

Get the headers from the buffer, store them in the headers list. the user's responsibility to cleanup the list when they are finished with it. no buffer copies happen here, the lifetime of the buffer, must outlive the usage of the headers. returns error codes defined in the public interface.

Prototype

int aws_event_stream_read_headers_from_buffer( struct aws_array_list *headers, const uint8_t *buffer, size_t headers_len);
source
LibAwsEventStream.aws_event_stream_rpc_client_connection_closeMethod
aws_event_stream_rpc_client_connection_close(connection, shutdown_error_code)

Closes the connection if it is open and aws_event_stream_rpc_client_connection_options::on_connection_shutdown will be invoked upon shutdown. shutdown_error_code will indicate the reason for shutdown. For a graceful shutdown pass 0 or AWS_ERROR_SUCCESS.

Prototype

void aws_event_stream_rpc_client_connection_close( struct aws_event_stream_rpc_client_connection *connection, int shutdown_error_code);
source
LibAwsEventStream.aws_event_stream_rpc_client_connection_connectMethod
aws_event_stream_rpc_client_connection_connect(allocator, conn_options)

Initiate a new connection. If this function returns AWS_OP_SUCESSS, the aws_event_stream_rpc_client_connection_options::on_connection_setup is guaranteed to be called exactly once. If that callback successfully creates a connection, aws_event_stream_rpc_client_connection_options::on_connection_shutdown will be invoked upon connection closure. However if the connection was never successfully setup, aws_event_stream_rpc_client_connection_options::on_connection_shutdown will not be invoked later.

Prototype

int aws_event_stream_rpc_client_connection_connect( struct aws_allocator *allocator, const struct aws_event_stream_rpc_client_connection_options *conn_options);
source
LibAwsEventStream.aws_event_stream_rpc_client_connection_new_streamMethod
aws_event_stream_rpc_client_connection_new_stream(connection, continuation_options)

Create a new stream. continuation_option's callbacks will not be invoked, and nothing will be sent across the wire until aws_event_stream_rpc_client_continuation_activate() is invoked.

returns an instance of a aws_event_stream_rpc_client_continuation_token on success with a reference count of 1. You must call aws_event_stream_rpc_client_continuation_release() when you're finished with it. Returns NULL on failure.

Prototype

struct aws_event_stream_rpc_client_continuation_token * aws_event_stream_rpc_client_connection_new_stream( struct aws_event_stream_rpc_client_connection *connection, const struct aws_event_stream_rpc_client_stream_continuation_options *continuation_options);
source
LibAwsEventStream.aws_event_stream_rpc_client_connection_send_protocol_messageMethod
aws_event_stream_rpc_client_connection_send_protocol_message(connection, message_args, flush_fn, user_data)

Sends a message on the connection. These must be connection level messages (not application messages).

flush_fn will be invoked when the message has been successfully writen to the wire or when it fails.

returns AWS_OP_SUCCESS if the message was successfully created and queued, and in that case flush_fn will always be invoked. Otherwise, flush_fn will not be invoked.

Prototype

int aws_event_stream_rpc_client_connection_send_protocol_message( struct aws_event_stream_rpc_client_connection *connection, const struct aws_event_stream_rpc_message_args *message_args, aws_event_stream_rpc_client_message_flush_fn *flush_fn, void *user_data);
source
LibAwsEventStream.aws_event_stream_rpc_client_continuation_activateMethod
aws_event_stream_rpc_client_continuation_activate(continuation, operation_name, message_args, flush_fn, user_data)

Actually sends the initial stream to the peer. Callbacks from aws_event_stream_rpc_client_connection_new_stream() will actually be invoked if this function returns AWS_OP_SUCCESS, otherwise, the stream has not been queued and no callbacks will be invoked.

operation_name is the name to identify which logical rpc call you want to kick off with the peer. It must be non-empty. flush_fn will be invoked once the message has either been written to the wire or it fails.

Prototype

int aws_event_stream_rpc_client_continuation_activate( struct aws_event_stream_rpc_client_continuation_token *continuation, struct aws_byte_cursor operation_name, const struct aws_event_stream_rpc_message_args *message_args, aws_event_stream_rpc_client_message_flush_fn *flush_fn, void *user_data);
source
LibAwsEventStream.aws_event_stream_rpc_client_continuation_send_messageMethod
aws_event_stream_rpc_client_continuation_send_message(continuation, message_args, flush_fn, user_data)

Sends a message on the continuation. aws_event_stream_rpc_client_continuation_activate() must be successfully invoked prior to calling this function.

If this function returns AWS_OP_SUCCESS, flush_fn will be invoked once the message has either been written to the wire or it fails.

Prototype

int aws_event_stream_rpc_client_continuation_send_message( struct aws_event_stream_rpc_client_continuation_token *continuation, const struct aws_event_stream_rpc_message_args *message_args, aws_event_stream_rpc_client_message_flush_fn *flush_fn, void *user_data);
source
LibAwsEventStream.aws_event_stream_rpc_server_connection_closeMethod
aws_event_stream_rpc_server_connection_close(connection, shutdown_error_code)

Closes the connection (including all continuations on the connection), and releases the connection ref count. shutdown_error_code is the error code to use when shutting down the channel. Use AWS_ERROR_SUCCESS for non-error cases.

Prototype

void aws_event_stream_rpc_server_connection_close( struct aws_event_stream_rpc_server_connection *connection, int shutdown_error_code);
source
LibAwsEventStream.aws_event_stream_rpc_server_connection_from_existing_channelMethod
aws_event_stream_rpc_server_connection_from_existing_channel(server, channel, connection_options)

Bypasses server, and creates a connection on an already existing channel. No connection lifetime callbacks will be invoked on the returned connection. Returns NULL if an error occurs. If and only if, you use this API, the returned connection is already ref counted and you must call aws_event_stream_rpc_server_connection_release() even if you did not explictly call aws_event_stream_rpc_server_connection_acquire()

Prototype

struct aws_event_stream_rpc_server_connection * aws_event_stream_rpc_server_connection_from_existing_channel( struct aws_event_stream_rpc_server_listener *server, struct aws_channel *channel, const struct aws_event_stream_rpc_connection_options *connection_options);
source
LibAwsEventStream.aws_event_stream_rpc_server_connection_send_protocol_messageMethod
aws_event_stream_rpc_server_connection_send_protocol_message(connection, message_args, flush_fn, user_data)

Sends a protocol message on the connection (not application data). If the message is valid and successfully written to the channel, flush_fn will be invoked.

Prototype

int aws_event_stream_rpc_server_connection_send_protocol_message( struct aws_event_stream_rpc_server_connection *connection, const struct aws_event_stream_rpc_message_args *message_args, aws_event_stream_rpc_server_message_flush_fn *flush_fn, void *user_data);
source
LibAwsEventStream.aws_event_stream_rpc_server_continuation_send_messageMethod
aws_event_stream_rpc_server_continuation_send_message(continuation, message_args, flush_fn, user_data)

Sends an application message on the continuation. If the message is valid and successfully written to the channel, flush_fn will be invoked.

Prototype

int aws_event_stream_rpc_server_continuation_send_message( struct aws_event_stream_rpc_server_continuation_token *continuation, const struct aws_event_stream_rpc_message_args *message_args, aws_event_stream_rpc_server_message_flush_fn *flush_fn, void *user_data);
source
LibAwsEventStream.aws_event_stream_rpc_server_new_listenerMethod
aws_event_stream_rpc_server_new_listener(allocator, options)

Creates a listener with a ref count of 1. You are responsible for calling aws_event_stream_rpc_server_listener_release() when you're finished with the listener. Returns NULL if an error occurs.

Prototype

struct aws_event_stream_rpc_server_listener *aws_event_stream_rpc_server_new_listener( struct aws_allocator *allocator, struct aws_event_stream_rpc_server_listener_options *options);
source
LibAwsEventStream.aws_event_stream_streaming_decoder_clean_upMethod
aws_event_stream_streaming_decoder_clean_up(decoder)

Currently, no memory is allocated inside aws_aws_event_stream_streaming_decoder, but for future API compatibility, you should call this when finished with it.

Prototype

void aws_event_stream_streaming_decoder_clean_up( struct aws_event_stream_streaming_decoder *decoder);
source
LibAwsEventStream.aws_event_stream_streaming_decoder_initMethod
aws_event_stream_streaming_decoder_init(decoder, alloc, on_payload_segment, on_prelude, on_header, on_error, user_data)

Deprecated. Use aws_event_stream_streaming_decoder_init_from_options instead. Initialize a streaming decoder for messages with callbacks for usage and an optional user context pointer.

Prototype

void aws_event_stream_streaming_decoder_init( struct aws_event_stream_streaming_decoder *decoder, struct aws_allocator *alloc, aws_event_stream_process_on_payload_segment_fn *on_payload_segment, aws_event_stream_prelude_received_fn *on_prelude, aws_event_stream_header_received_fn *on_header, aws_event_stream_on_error_fn *on_error, void *user_data);
source
LibAwsEventStream.aws_event_stream_streaming_decoder_init_from_optionsMethod
aws_event_stream_streaming_decoder_init_from_options(decoder, allocator, options)

Initialize a streaming decoder for messages with callbacks for usage and an optional user context pointer.

Prototype

void aws_event_stream_streaming_decoder_init_from_options( struct aws_event_stream_streaming_decoder *decoder, struct aws_allocator *allocator, const struct aws_event_stream_streaming_decoder_options *options);
source
LibAwsEventStream.aws_event_stream_streaming_decoder_pumpMethod
aws_event_stream_streaming_decoder_pump(decoder, data)

The main driver of the decoder. Pass data that should be decoded with its length. A likely use-case here is in response to a read event from an io-device

Prototype

int aws_event_stream_streaming_decoder_pump( struct aws_event_stream_streaming_decoder *decoder, const struct aws_byte_buf *data);
source
LibAwsEventStream.aws_event_stream_write_headers_to_buffer_safeMethod
aws_event_stream_write_headers_to_buffer_safe(headers, buf)

Writes headers to buf assuming buf is large enough to hold the data. Prefer this function over the unsafe variant 'aws_event_stream_write_headers_to_buffer'.

Returns AWS_OP_SUCCESS if the headers were successfully and completely written and AWS_OP_ERR otherwise.

Prototype

int aws_event_stream_write_headers_to_buffer_safe( const struct aws_array_list *headers, struct aws_byte_buf *buf);
source