Planeshift
Classes | Defines | Typedefs | Enumerations | Functions

xdelta3.h File Reference

#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <stdint.h>

Go to the source code of this file.

Classes

struct  _xd3_addr_cache
struct  _xd3_config
struct  _xd3_desect
struct  _xd3_dinst
struct  _xd3_hash_cfg
struct  _xd3_hinst
struct  _xd3_iopt_buflist
struct  _xd3_output
struct  _xd3_rinst
struct  _xd3_rlist
struct  _xd3_sec_cfg
struct  _xd3_slist
struct  _xd3_smatcher
struct  _xd3_source
struct  _xd3_stream
struct  _xd3_whole_state
struct  _xd3_wininfo
struct  _xd3_winst

Defines

#define __USE_FILE_OFFSET64   1
#define _FILE_OFFSET_BITS   64
#define _LARGEFILE_SOURCE
#define DP   fprintf
#define EXIT_FAILURE   1
#define max(x, y)   ((x) < (y) ? (y) : (x))
#define min(x, y)   ((x) < (y) ? (x) : (y))
#define PYTHON_MODULE   0
#define Q   "ll"
#define REGRESSION_TEST   0
#define RINT   stderr,
#define SIZEOF_USIZE_T   4
#define SIZEOF_XOFF_T   8
#define SWIG_MODULE   0
#define UNALIGNED_OK   0
#define USE_UINT32
#define USE_UINT64
#define XD3_ALLOCSIZE   (1U<<14)
#define XD3_ASSERT(x)   (void)0
#define XD3_BUILD_DEFAULT   1
#define XD3_BUILD_FAST   1
#define XD3_BUILD_FASTER   1
#define XD3_BUILD_FASTEST   1
#define XD3_BUILD_SLOW   1
#define XD3_BUILD_SOFT   1
#define XD3_DEBUG   0
#define XD3_DEFAULT_IOPT_SIZE   (1U<<15)
#define XD3_DEFAULT_LEVEL   3
#define XD3_DEFAULT_SECONDARY_LEVEL   6
#define XD3_DEFAULT_SPREVSZ   (1U<<18)
#define XD3_DEFAULT_SRCWINSZ   (1U << 26)
#define XD3_DEFAULT_WINSIZE   (1U << 23)
#define XD3_ENCODER   1
#define XD3_HARDMAXWINSIZE   (1U<<24)
#define XD3_USE_LARGEFILE64   1

Typedefs

typedef unsigned int usize_t
typedef struct _xd3_addr_cache xd3_addr_cache
typedef void *( xd3_alloc_func )(void *opaque, usize_t items, usize_t size)
typedef struct _xd3_code_table_desc xd3_code_table_desc
typedef const xd3_dinst *( xd3_code_table_func )(void)
typedef struct
_xd3_code_table_sizes 
xd3_code_table_sizes
typedef intxd3_comp_table_func )(xd3_stream *stream, const uint8_t **data, usize_t *size)
typedef struct _xd3_config xd3_config
typedef struct _xd3_desect xd3_desect
typedef struct _xd3_dinst xd3_dinst
typedef void( xd3_free_func )(void *opaque, void *address)
typedef intxd3_getblk_func )(xd3_stream *stream, xd3_source *source, xoff_t blkno)
typedef struct _xd3_hash_cfg xd3_hash_cfg
typedef struct _xd3_hinst xd3_hinst
typedef struct _xd3_iopt_buflist xd3_iopt_buflist
typedef struct _xd3_output xd3_output
typedef struct _xd3_rinst xd3_rinst
typedef struct _xd3_rlist xd3_rlist
typedef struct _xd3_rpage xd3_rpage
typedef struct _xd3_sec_cfg xd3_sec_cfg
typedef struct _xd3_sec_stream xd3_sec_stream
typedef struct _xd3_sec_type xd3_sec_type
typedef struct _xd3_slist xd3_slist
typedef struct _xd3_smatcher xd3_smatcher
typedef struct _xd3_source xd3_source
typedef struct _xd3_stream xd3_stream
typedef struct _xd3_whole_state xd3_whole_state
typedef struct _xd3_wininfo xd3_wininfo
typedef struct _xd3_winst xd3_winst
typedef uint64_t xoff_t

Enumerations

enum  xd3_decode_state {
  DEC_VCHEAD = 0, DEC_HDRIND = 1, DEC_SECONDID = 2, DEC_TABLEN = 3,
  DEC_NEAR = 4, DEC_SAME = 5, DEC_TABDAT = 6, DEC_APPLEN = 7,
  DEC_APPDAT = 8, DEC_WININD = 9, DEC_CPYLEN = 10, DEC_CPYOFF = 11,
  DEC_ENCLEN = 12, DEC_TGTLEN = 13, DEC_DELIND = 14, DEC_DATALEN = 15,
  DEC_INSTLEN = 16, DEC_ADDRLEN = 17, DEC_CKSUM = 18, DEC_DATA = 19,
  DEC_INST = 20, DEC_ADDR = 21, DEC_EMIT = 22, DEC_FINISH = 23,
  DEC_ABORTED = 24
}
enum  xd3_encode_state {
  ENC_INIT = 0, ENC_INPUT = 1, ENC_SEARCH = 2, ENC_INSTR = 3,
  ENC_FLUSH = 4, ENC_POSTOUT = 5, ENC_POSTWIN = 6, ENC_ABORTED = 7
}
enum  xd3_flags {
  XD3_JUST_HDR = (1 << 1), XD3_SKIP_WINDOW = (1 << 2), XD3_SKIP_EMIT = (1 << 3), XD3_FLUSH = (1 << 4),
  XD3_SEC_DJW = (1 << 5), XD3_SEC_FGK = (1 << 6), XD3_SEC_TYPE = (XD3_SEC_DJW | XD3_SEC_FGK), XD3_SEC_NODATA = (1 << 7),
  XD3_SEC_NOINST = (1 << 8), XD3_SEC_NOADDR = (1 << 9), XD3_SEC_NOALL = (XD3_SEC_NODATA | XD3_SEC_NOINST | XD3_SEC_NOADDR), XD3_ADLER32 = (1 << 10),
  XD3_ADLER32_NOVER = (1 << 11), XD3_ALT_CODE_TABLE = (1 << 12), XD3_NOCOMPRESS = (1 << 13), XD3_BEGREEDY = (1 << 14),
  XD3_ADLER32_RECODE = (1 << 15), XD3_COMPLEVEL_SHIFT = 20, XD3_COMPLEVEL_MASK = (0xF << XD3_COMPLEVEL_SHIFT), XD3_COMPLEVEL_1 = (1 << XD3_COMPLEVEL_SHIFT),
  XD3_COMPLEVEL_2 = (2 << XD3_COMPLEVEL_SHIFT), XD3_COMPLEVEL_3 = (3 << XD3_COMPLEVEL_SHIFT), XD3_COMPLEVEL_6 = (6 << XD3_COMPLEVEL_SHIFT), XD3_COMPLEVEL_9 = (9 << XD3_COMPLEVEL_SHIFT)
}
enum  xd3_match_state { MATCH_TARGET = 0, MATCH_BACKWARD = 1, MATCH_FORWARD = 2, MATCH_SEARCHING = 3 }
enum  xd3_rvalues {
  XD3_INPUT = -17703, XD3_OUTPUT = -17704, XD3_GETSRCBLK = -17705, XD3_GOTHEADER = -17706,
  XD3_WINSTART = -17707, XD3_WINFINISH = -17708, XD3_TOOFARBACK = -17709, XD3_INTERNAL = -17710,
  XD3_INVALID = -17711, XD3_INVALID_INPUT = -17712, XD3_NOSECOND = -17713, XD3_UNIMPLEMENTED = -17714
}
enum  xd3_smatch_cfg {
  XD3_SMATCH_DEFAULT = 0, XD3_SMATCH_SLOW = 1, XD3_SMATCH_FAST = 2, XD3_SMATCH_FASTER = 3,
  XD3_SMATCH_FASTEST = 4, XD3_SMATCH_SOFT = 5
}

Functions

void xd3_abort_stream (xd3_stream *stream)
static void xd3_avail_input (xd3_stream *stream, const uint8_t *idata, usize_t isize)
static void xd3_blksize_add (xoff_t *blkno, usize_t *blkoff, const xd3_source *source, const usize_t add)
static void xd3_blksize_div (const xoff_t offset, const xd3_source *source, xoff_t *blkno, usize_t *blkoff)
int xd3_close_stream (xd3_stream *stream)
int xd3_config_stream (xd3_stream *stream, xd3_config *config)
static void xd3_consume_output (xd3_stream *stream)
int xd3_decode_input (xd3_stream *stream)
int xd3_decode_memory (const uint8_t *input, usize_t input_size, const uint8_t *source, usize_t source_size, uint8_t *output_buf, usize_t *output_size, usize_t avail_output, int flags)
int xd3_decode_stream (xd3_stream *stream, const uint8_t *input, usize_t input_size, uint8_t *output, usize_t *output_size, usize_t avail_size)
int xd3_encode_init_partial (xd3_stream *stream)
int xd3_encode_input (xd3_stream *stream)
int xd3_encode_memory (const uint8_t *input, usize_t input_size, const uint8_t *source, usize_t source_size, uint8_t *output_buffer, usize_t *output_size, usize_t avail_output, int flags)
int xd3_encode_stream (xd3_stream *stream, const uint8_t *input, usize_t input_size, uint8_t *output, usize_t *output_size, usize_t avail_output)
static xoff_t xd3_encoder_srcbase (xd3_stream *stream)
static usize_t xd3_encoder_srclen (xd3_stream *stream)
static int xd3_encoder_used_source (xd3_stream *stream)
static const char * xd3_errstring (xd3_stream *stream)
int xd3_found_match (xd3_stream *stream, usize_t pos, usize_t size, xoff_t addr, int is_source)
void xd3_free_stream (xd3_stream *stream)
int xd3_get_appheader (xd3_stream *stream, uint8_t **data, usize_t *size)
void xd3_init_cache (xd3_addr_cache *acache)
static void xd3_init_config (xd3_config *config, int flags)
void xd3_set_appheader (xd3_stream *stream, const uint8_t *data, usize_t size)
static void xd3_set_flags (xd3_stream *stream, int flags)
int xd3_set_source (xd3_stream *stream, xd3_source *source)
int xd3_set_source_and_size (xd3_stream *stream, xd3_source *source, xoff_t source_size)
const char * xd3_strerror (int ret)

Define Documentation

#define __USE_FILE_OFFSET64   1

Definition at line 135 of file xdelta3.h.

#define _FILE_OFFSET_BITS   64

Definition at line 140 of file xdelta3.h.

#define _LARGEFILE_SOURCE

Definition at line 137 of file xdelta3.h.

#define DP   fprintf

Definition at line 236 of file xdelta3.h.

#define EXIT_FAILURE   1

Definition at line 183 of file xdelta3.h.

#define max (   x,
 
)    ((x) < (y) ? (y) : (x))

Definition at line 314 of file xdelta3.h.

#define min (   x,
 
)    ((x) < (y) ? (x) : (y))

Definition at line 317 of file xdelta3.h.

#define PYTHON_MODULE   0

Definition at line 200 of file xdelta3.h.

#define Q   "ll"

Definition at line 147 of file xdelta3.h.

#define REGRESSION_TEST   0

Definition at line 189 of file xdelta3.h.

#define RINT   stderr,

Definition at line 237 of file xdelta3.h.

#define SIZEOF_USIZE_T   4

Definition at line 145 of file xdelta3.h.

#define SIZEOF_XOFF_T   8

Definition at line 144 of file xdelta3.h.

#define SWIG_MODULE   0

Definition at line 204 of file xdelta3.h.

#define UNALIGNED_OK   0

Definition at line 169 of file xdelta3.h.

#define USE_UINT32
Value:

Definition at line 158 of file xdelta3.h.

#define USE_UINT64
Value:

Definition at line 160 of file xdelta3.h.

#define XD3_ALLOCSIZE   (1U<<14)

Definition at line 53 of file xdelta3.h.

#define XD3_ASSERT (   x)    (void)0

Definition at line 293 of file xdelta3.h.

#define XD3_BUILD_DEFAULT   1

Definition at line 226 of file xdelta3.h.

#define XD3_BUILD_FAST   1

Definition at line 214 of file xdelta3.h.

#define XD3_BUILD_FASTER   1

Definition at line 217 of file xdelta3.h.

#define XD3_BUILD_FASTEST   1

Definition at line 220 of file xdelta3.h.

#define XD3_BUILD_SLOW   1

Definition at line 211 of file xdelta3.h.

#define XD3_BUILD_SOFT   1

Definition at line 223 of file xdelta3.h.

#define XD3_DEBUG   0

Definition at line 196 of file xdelta3.h.

#define XD3_DEFAULT_IOPT_SIZE   (1U<<15)

Definition at line 71 of file xdelta3.h.

#define XD3_DEFAULT_LEVEL   3

Definition at line 82 of file xdelta3.h.

#define XD3_DEFAULT_SECONDARY_LEVEL   6

Definition at line 86 of file xdelta3.h.

#define XD3_DEFAULT_SPREVSZ   (1U<<18)

Definition at line 76 of file xdelta3.h.

#define XD3_DEFAULT_SRCWINSZ   (1U << 26)

Definition at line 46 of file xdelta3.h.

#define XD3_DEFAULT_WINSIZE   (1U << 23)

Definition at line 41 of file xdelta3.h.

#define XD3_ENCODER   1

Definition at line 177 of file xdelta3.h.

#define XD3_HARDMAXWINSIZE   (1U<<24)

Definition at line 63 of file xdelta3.h.

#define XD3_USE_LARGEFILE64   1

Definition at line 90 of file xdelta3.h.


Typedef Documentation

typedef unsigned int usize_t

Definition at line 102 of file xdelta3.h.

Definition at line 248 of file xdelta3.h.

typedef void*( xd3_alloc_func)(void *opaque, usize_t items, usize_t size)

Definition at line 267 of file xdelta3.h.

typedef struct _xd3_code_table_desc xd3_code_table_desc

Definition at line 257 of file xdelta3.h.

typedef const xd3_dinst*( xd3_code_table_func)(void)

Definition at line 281 of file xdelta3.h.

typedef struct _xd3_code_table_sizes xd3_code_table_sizes

Definition at line 258 of file xdelta3.h.

typedef int( xd3_comp_table_func)(xd3_stream *stream, const uint8_t **data, usize_t *size)

Definition at line 282 of file xdelta3.h.

typedef struct _xd3_config xd3_config

Definition at line 256 of file xdelta3.h.

typedef struct _xd3_desect xd3_desect

Definition at line 250 of file xdelta3.h.

typedef struct _xd3_dinst xd3_dinst

Definition at line 244 of file xdelta3.h.

typedef void( xd3_free_func)(void *opaque, void *address)

Definition at line 270 of file xdelta3.h.

typedef int( xd3_getblk_func)(xd3_stream *stream, xd3_source *source, xoff_t blkno)

Definition at line 273 of file xdelta3.h.

typedef struct _xd3_hash_cfg xd3_hash_cfg

Definition at line 241 of file xdelta3.h.

typedef struct _xd3_hinst xd3_hinst

Definition at line 245 of file xdelta3.h.

Definition at line 251 of file xdelta3.h.

typedef struct _xd3_output xd3_output

Definition at line 249 of file xdelta3.h.

typedef struct _xd3_rinst xd3_rinst

Definition at line 243 of file xdelta3.h.

typedef struct _xd3_rlist xd3_rlist

Definition at line 252 of file xdelta3.h.

typedef struct _xd3_rpage xd3_rpage

Definition at line 247 of file xdelta3.h.

typedef struct _xd3_sec_cfg xd3_sec_cfg

Definition at line 254 of file xdelta3.h.

typedef struct _xd3_sec_stream xd3_sec_stream

Definition at line 255 of file xdelta3.h.

typedef struct _xd3_sec_type xd3_sec_type

Definition at line 253 of file xdelta3.h.

typedef struct _xd3_slist xd3_slist

Definition at line 259 of file xdelta3.h.

typedef struct _xd3_smatcher xd3_smatcher

Definition at line 242 of file xdelta3.h.

typedef struct _xd3_source xd3_source

Definition at line 240 of file xdelta3.h.

typedef struct _xd3_stream xd3_stream

Definition at line 239 of file xdelta3.h.

Definition at line 260 of file xdelta3.h.

typedef struct _xd3_wininfo xd3_wininfo

Definition at line 261 of file xdelta3.h.

typedef struct _xd3_winst xd3_winst

Definition at line 246 of file xdelta3.h.

typedef uint64_t xoff_t

Definition at line 143 of file xdelta3.h.


Enumeration Type Documentation

Enumerator:
DEC_VCHEAD 
DEC_HDRIND 
DEC_SECONDID 
DEC_TABLEN 
DEC_NEAR 
DEC_SAME 
DEC_TABDAT 
DEC_APPLEN 
DEC_APPDAT 
DEC_WININD 
DEC_CPYLEN 
DEC_CPYOFF 
DEC_ENCLEN 
DEC_TGTLEN 
DEC_DELIND 
DEC_DATALEN 
DEC_INSTLEN 
DEC_ADDRLEN 
DEC_CKSUM 
DEC_DATA 
DEC_INST 
DEC_ADDR 
DEC_EMIT 
DEC_FINISH 
DEC_ABORTED 

Definition at line 485 of file xdelta3.h.

Enumerator:
ENC_INIT 
ENC_INPUT 
ENC_SEARCH 
ENC_INSTR 
ENC_FLUSH 
ENC_POSTOUT 
ENC_POSTWIN 
ENC_ABORTED 

Definition at line 461 of file xdelta3.h.

enum xd3_flags
Enumerator:
XD3_JUST_HDR 
XD3_SKIP_WINDOW 
XD3_SKIP_EMIT 
XD3_FLUSH 
XD3_SEC_DJW 
XD3_SEC_FGK 
XD3_SEC_TYPE 
XD3_SEC_NODATA 
XD3_SEC_NOINST 
XD3_SEC_NOADDR 
XD3_SEC_NOALL 
XD3_ADLER32 
XD3_ADLER32_NOVER 
XD3_ALT_CODE_TABLE 
XD3_NOCOMPRESS 
XD3_BEGREEDY 
XD3_ADLER32_RECODE 
XD3_COMPLEVEL_SHIFT 
XD3_COMPLEVEL_MASK 
XD3_COMPLEVEL_1 
XD3_COMPLEVEL_2 
XD3_COMPLEVEL_3 
XD3_COMPLEVEL_6 
XD3_COMPLEVEL_9 

Definition at line 358 of file xdelta3.h.

Enumerator:
MATCH_TARGET 
MATCH_BACKWARD 
MATCH_FORWARD 
MATCH_SEARCHING 

Definition at line 442 of file xdelta3.h.

Enumerator:
XD3_INPUT 
XD3_OUTPUT 
XD3_GETSRCBLK 
XD3_GOTHEADER 
XD3_WINSTART 
XD3_WINFINISH 
XD3_TOOFARBACK 
XD3_INTERNAL 
XD3_INVALID 
XD3_INVALID_INPUT 
XD3_NOSECOND 
XD3_UNIMPLEMENTED 

Definition at line 327 of file xdelta3.h.

Enumerator:
XD3_SMATCH_DEFAULT 
XD3_SMATCH_SLOW 
XD3_SMATCH_FAST 
XD3_SMATCH_FASTER 
XD3_SMATCH_FASTEST 
XD3_SMATCH_SOFT 

Definition at line 418 of file xdelta3.h.


Function Documentation

void xd3_abort_stream ( xd3_stream stream)
static void xd3_avail_input ( xd3_stream stream,
const uint8_t *  idata,
usize_t  isize 
) [inline, static]

Definition at line 1263 of file xdelta3.h.

static void xd3_blksize_add ( xoff_t blkno,
usize_t blkoff,
const xd3_source source,
const usize_t  add 
) [inline, static]

Definition at line 1334 of file xdelta3.h.

static void xd3_blksize_div ( const xoff_t  offset,
const xd3_source source,
xoff_t blkno,
usize_t blkoff 
) [inline, static]

Definition at line 1324 of file xdelta3.h.

int xd3_close_stream ( xd3_stream stream)
int xd3_config_stream ( xd3_stream stream,
xd3_config config 
)
static void xd3_consume_output ( xd3_stream stream) [inline, static]

Definition at line 1282 of file xdelta3.h.

int xd3_decode_input ( xd3_stream stream)

Definition at line 723 of file xdelta3-decode.h.

int xd3_decode_memory ( const uint8_t *  input,
usize_t  input_size,
const uint8_t *  source,
usize_t  source_size,
uint8_t *  output_buf,
usize_t output_size,
usize_t  avail_output,
int  flags 
)
int xd3_decode_stream ( xd3_stream stream,
const uint8_t *  input,
usize_t  input_size,
uint8_t *  output,
usize_t output_size,
usize_t  avail_size 
)
int xd3_encode_init_partial ( xd3_stream stream)
int xd3_encode_input ( xd3_stream stream)
int xd3_encode_memory ( const uint8_t *  input,
usize_t  input_size,
const uint8_t *  source,
usize_t  source_size,
uint8_t *  output_buffer,
usize_t output_size,
usize_t  avail_output,
int  flags 
)
int xd3_encode_stream ( xd3_stream stream,
const uint8_t *  input,
usize_t  input_size,
uint8_t *  output,
usize_t output_size,
usize_t  avail_output 
)
static xoff_t xd3_encoder_srcbase ( xd3_stream stream) [inline, static]

Definition at line 1293 of file xdelta3.h.

static usize_t xd3_encoder_srclen ( xd3_stream stream) [inline, static]

Definition at line 1297 of file xdelta3.h.

static int xd3_encoder_used_source ( xd3_stream stream) [inline, static]

Definition at line 1289 of file xdelta3.h.

static const char* xd3_errstring ( xd3_stream stream) [inline, static]

Definition at line 1314 of file xdelta3.h.

int xd3_found_match ( xd3_stream stream,
usize_t  pos,
usize_t  size,
xoff_t  addr,
int  is_source 
)
void xd3_free_stream ( xd3_stream stream)
int xd3_get_appheader ( xd3_stream stream,
uint8_t **  data,
usize_t size 
)
void xd3_init_cache ( xd3_addr_cache acache)
static void xd3_init_config ( xd3_config config,
int  flags 
) [inline, static]

Definition at line 1239 of file xdelta3.h.

void xd3_set_appheader ( xd3_stream stream,
const uint8_t *  data,
usize_t  size 
)
static void xd3_set_flags ( xd3_stream stream,
int  flags 
) [inline, static]

Definition at line 1303 of file xdelta3.h.

int xd3_set_source ( xd3_stream stream,
xd3_source source 
)
int xd3_set_source_and_size ( xd3_stream stream,
xd3_source source,
xoff_t  source_size 
)
const char* xd3_strerror ( int  ret)