4 #ifndef AZ_USTREAM_BASE_H 5 #define AZ_USTREAM_BASE_H 320 #include "az_pal_os.h" 321 #include "azure_macro_utils/macro_utils.h" 322 #include "umock_c/umock_c_prod.h" 356 size_t buffer_length,
size_t*
const size);
463 #define AZ_USTREAM_IS_NOT_TYPE_OF(handle, type_api) ((handle == NULL) || (handle->control_block == NULL) || (handle->control_block->api == NULL) || (handle->control_block->api != &type_api)) 597 return ustream_instance->
control_block->
api->
read(ustream_instance, buffer, buffer_length, size);
846 return ustream_instance->
control_block->
api->
clone(ustream_instance_clone, ustream_instance, offset);
Structure for data control block.
Structure to keep track of concatenated ustreams.
static AZ_ULIB_RESULT az_ustream_clone(AZ_USTREAM *ustream_instance_clone, AZ_USTREAM *ustream_instance, offset_t offset)
Initializes a new instance of the ustream and returns it.
struct AZ_USTREAM_DATA_CB_TAG AZ_USTREAM_DATA_CB
Structure for data control block.
struct AZ_USTREAM_MULTI_DATA_CB_TAG AZ_USTREAM_MULTI_DATA_CB
Structure to keep track of concatenated ustreams.
static AZ_ULIB_RESULT az_ustream_release(AZ_USTREAM *ustream_instance, offset_t position)
Releases all the resources related to the Data Source before and including the released position.
Structure for instance control block.
volatile uint32_t ustream_two_ref_count
enum AZ_ULIB_RESULT_TAG AZ_ULIB_RESULT
Enumeration of ulib results.
const AZ_USTREAM_INTERFACE * api
vTable with the ustream APIs.
size_t offset_t
Define offset_t with the same size as size_t.
static AZ_ULIB_RESULT az_ustream_dispose(AZ_USTREAM *ustream_instance)
Release all the resources allocated to control the instance of the ustream.
AZ_RELEASE_CALLBACK control_block_release
AZ_ULIB_RESULT(* clone)(AZ_USTREAM *ustream_instance_clone, AZ_USTREAM *ustream_instance, offset_t offset)
AZ_ULIB_RESULT(* set_position)(AZ_USTREAM *ustream_instance, offset_t position)
struct AZ_USTREAM_INTERFACE_TAG AZ_USTREAM_INTERFACE
vTable with the ustream APIs.
static AZ_ULIB_RESULT az_ustream_reset(AZ_USTREAM *ustream_instance)
Changes the current position to the first valid position.
AZ_ULIB_RESULT(* get_remaining_size)(AZ_USTREAM *ustream_instance, size_t *const size)
Configuration options for ulib.
offset_t inner_current_position
static AZ_ULIB_RESULT az_ustream_set_position(AZ_USTREAM *ustream_instance, offset_t position)
Change the current position of the ustream.
void * AZ_USTREAM_DATA
Pointer to the data from which to read.
AZ_ULIB_RESULT(* read)(AZ_USTREAM *ustream_instance, uint8_t *const buffer, size_t buffer_length, size_t *const size)
AZ_RELEASE_CALLBACK data_release
volatile uint32_t ref_count
AZ_ULIB_RESULT(* reset)(AZ_USTREAM *ustream_instance)
void(* AZ_RELEASE_CALLBACK)(void *)
Signature of the function to release memory passed to the ustream.
offset_t inner_first_valid_position
static AZ_ULIB_RESULT az_ustream_get_remaining_size(AZ_USTREAM *ustream_instance, size_t *const size)
Returns the remaining size of the ustream.
AZ_ULIB_RESULT(* get_position)(AZ_USTREAM *ustream_instance, offset_t *const position)
AZ_USTREAM_DATA_CB control_block
AZ_ULIB_RESULT(* dispose)(AZ_USTREAM *ustream_instance)
AZ_USTREAM_DATA_CB * control_block
volatile uint32_t ustream_one_ref_count
static AZ_ULIB_RESULT az_ustream_read(AZ_USTREAM *ustream_instance, uint8_t *const buffer, size_t buffer_length, size_t *const size)
Gets the next portion of the ustream starting at the current position.
static AZ_ULIB_RESULT az_ustream_get_position(AZ_USTREAM *ustream_instance, offset_t *const position)
Returns the current position in the ustream.
AZ_ULIB_RESULT(* release)(AZ_USTREAM *ustream_instance, offset_t position)
pointer to a platform specific struct for a lock implementation