38stub_compress_init(
struct compress_context *compctx)
43stub_compress_uninit(
struct compress_context *compctx)
48stub_compress(
struct buffer *buf,
struct buffer work,
struct compress_context *compctx,
57 uint8_t *head =
BPTR(buf);
58 uint8_t *tail =
BEND(buf);
64 *head = NO_COMPRESS_BYTE_SWAP;
69 *header = NO_COMPRESS_BYTE;
74stub_decompress(
struct buffer *buf,
struct buffer work,
struct compress_context *compctx,
84 uint8_t *head =
BPTR(buf);
88 if (c != NO_COMPRESS_BYTE_SWAP)
90 dmsg(
D_COMP_ERRORS,
"Bad compression stub (swap) decompression header byte: %d", c);
98 if (c != NO_COMPRESS_BYTE)
108stubv2_compress(
struct buffer *buf,
struct buffer work,
struct compress_context *compctx,
116 compv2_escape_data_ifneeded(buf);
120stubv2_decompress(
struct buffer *buf,
struct buffer work,
struct compress_context *compctx,
128 uint8_t *head =
BPTR(buf);
131 if (head[0] != COMP_ALGV2_INDICATOR_BYTE)
148 if (head[0] != COMP_ALGV2_UNCOMPRESSED_BYTE)
150 dmsg(
D_COMP_ERRORS,
"Bad compression stubv2 decompression header byte: %d", *head);
156const struct compress_alg compv2_stub_alg = {
"stubv2", stub_compress_init, stub_compress_uninit,
157 stubv2_compress, stubv2_decompress };
159const struct compress_alg comp_stub_alg = {
"stub", stub_compress_init, stub_compress_uninit,
160 stub_compress, stub_decompress };
static bool buf_safe(const struct buffer *buf, size_t len)
static bool buf_advance(struct buffer *buf, int size)
static uint8_t * buf_prepend(struct buffer *buf, int size)
#define COMP_F_SWAP
initial command byte is swapped with last byte in buffer to preserve payload alignment
Wrapper structure for dynamically allocated memory.
int len
Length in bytes of the actual content within the allocated memory.
Packet geometry parameters.