Rizin
unix-like reverse engineering framework and cli tools
lzma_stream Struct Reference

Passing data to and from liblzma. More...

#include <base.h>

Public Attributes

const uint8_tnext_in
 
size_t avail_in
 
uint64_t total_in
 
uint8_tnext_out
 
size_t avail_out
 
uint64_t total_out
 
const lzma_allocatorallocator
 Custom memory allocation functions. More...
 
lzma_internalinternal
 
void * reserved_ptr1
 
void * reserved_ptr2
 
void * reserved_ptr3
 
void * reserved_ptr4
 
uint64_t reserved_int1
 
uint64_t reserved_int2
 
size_t reserved_int3
 
size_t reserved_int4
 
lzma_reserved_enum reserved_enum1
 
lzma_reserved_enum reserved_enum2
 

Detailed Description

Passing data to and from liblzma.

The lzma_stream structure is used for

  • passing pointers to input and output buffers to liblzma;
  • defining custom memory hander functions; and
  • holding a pointer to coder-specific internal data structures.

Typical usage:

  • After allocating lzma_stream (on stack or with malloc()), it must be initialized to LZMA_STREAM_INIT (see LZMA_STREAM_INIT for details).
  • Initialize a coder to the lzma_stream, for example by using lzma_easy_encoder() or lzma_auto_decoder(). Some notes:
    • In contrast to zlib, strm->next_in and strm->next_out are ignored by all initialization functions, thus it is safe to not initialize them yet.
    • The initialization functions always set strm->total_in and strm->total_out to zero.
    • If the initialization function fails, no memory is left allocated that would require freeing with lzma_end() even if some memory was associated with the lzma_stream structure when the initialization function was called.
  • Use lzma_code() to do the actual work.
  • Once the coding has been finished, the existing lzma_stream can be reused. It is OK to reuse lzma_stream with different initialization function without calling lzma_end() first. Old allocations are automatically freed.
  • Finally, use lzma_end() to free the allocated memory. lzma_end() never frees the lzma_stream structure itself.

Application may modify the values of total_in and total_out as it wants. They are updated by liblzma to match the amount of data read and written but aren't used for anything else except as a possible return values from lzma_get_progress().

Definition at line 485 of file base.h.

Member Data Documentation

◆ allocator

const lzma_allocator* lzma_stream::allocator

Custom memory allocation functions.

In most cases this is NULL which makes liblzma use the standard malloc() and free().

Note
In 5.0.x this is not a const pointer.

Definition at line 502 of file base.h.

Referenced by LZMA_API(), and lzma_strm_init().

◆ avail_in

◆ avail_out

◆ internal

lzma_internal* lzma_stream::internal

Internal state is not visible to applications.

Definition at line 505 of file base.h.

Referenced by LZMA_API(), and lzma_strm_init().

◆ next_in

◆ next_out

◆ reserved_enum1

lzma_reserved_enum lzma_stream::reserved_enum1

Definition at line 521 of file base.h.

Referenced by LZMA_API().

◆ reserved_enum2

lzma_reserved_enum lzma_stream::reserved_enum2

Definition at line 522 of file base.h.

Referenced by LZMA_API().

◆ reserved_int1

uint64_t lzma_stream::reserved_int1

Definition at line 517 of file base.h.

Referenced by LZMA_API().

◆ reserved_int2

uint64_t lzma_stream::reserved_int2

Definition at line 518 of file base.h.

Referenced by LZMA_API().

◆ reserved_int3

size_t lzma_stream::reserved_int3

Definition at line 519 of file base.h.

Referenced by LZMA_API().

◆ reserved_int4

size_t lzma_stream::reserved_int4

Definition at line 520 of file base.h.

Referenced by LZMA_API().

◆ reserved_ptr1

void* lzma_stream::reserved_ptr1

Definition at line 513 of file base.h.

Referenced by LZMA_API().

◆ reserved_ptr2

void* lzma_stream::reserved_ptr2

Definition at line 514 of file base.h.

Referenced by LZMA_API().

◆ reserved_ptr3

void* lzma_stream::reserved_ptr3

Definition at line 515 of file base.h.

Referenced by LZMA_API().

◆ reserved_ptr4

void* lzma_stream::reserved_ptr4

Definition at line 516 of file base.h.

Referenced by LZMA_API().

◆ total_in

uint64_t lzma_stream::total_in

◆ total_out

uint64_t lzma_stream::total_out

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