MeterLogger
|
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <assert.h>
#include <string.h>
#include <err.h>
#include <fcntl.h>
#include "heatshrink_encoder.h"
#include "heatshrink_decoder.h"
Go to the source code of this file.
Data Structures | |
struct | io_handle |
struct | config |
Macros | |
#define | DEF_WINDOW_SZ2 11 |
#define | DEF_LOOKAHEAD_SZ2 4 |
#define | DEF_DECODER_INPUT_BUFFER_SIZE 256 |
#define | DEF_BUFFER_SIZE (64 * 1024) |
#define | LOG(...) /* NO-OP */ |
Enumerations | |
enum | IO_mode { IO_READ, IO_WRITE } |
enum | Operation { OP_ENC, OP_DEC } |
Functions | |
static void | usage (void) |
static void | die (char *msg) |
static void | report (config *cfg) |
static io_handle * | handle_open (char *fname, IO_mode m, size_t buf_sz) |
static ssize_t | handle_read (io_handle *io, size_t size, uint8_t **buf) |
static int | handle_drop (io_handle *io, size_t size) |
static ssize_t | handle_sink (io_handle *io, size_t size, uint8_t *input) |
static void | handle_close (io_handle *io) |
static void | close_and_report (config *cfg) |
static int | encoder_sink_read (config *cfg, heatshrink_encoder *hse, uint8_t *data, size_t data_sz) |
static int | encode (config *cfg) |
static int | decoder_sink_read (config *cfg, heatshrink_decoder *hsd, uint8_t *data, size_t data_sz) |
static int | decode (config *cfg) |
static void | proc_args (config *cfg, int argc, char **argv) |
int | main (int argc, char **argv) |
Variables | |
static const int | version_major = HEATSHRINK_VERSION_MAJOR |
static const int | version_minor = HEATSHRINK_VERSION_MINOR |
static const int | version_patch = HEATSHRINK_VERSION_PATCH |
static const char | author [] = HEATSHRINK_AUTHOR |
static const char | url [] = HEATSHRINK_URL |
#define DEF_BUFFER_SIZE (64 * 1024) |
Definition at line 15 of file heatshrink.c.
Referenced by proc_args().
#define DEF_DECODER_INPUT_BUFFER_SIZE 256 |
Definition at line 14 of file heatshrink.c.
Referenced by proc_args().
#define DEF_LOOKAHEAD_SZ2 4 |
Definition at line 13 of file heatshrink.c.
Referenced by proc_args().
#define DEF_WINDOW_SZ2 11 |
Definition at line 12 of file heatshrink.c.
Referenced by proc_args().
#define LOG | ( | ... | ) | /* NO-OP */ |
Definition at line 20 of file heatshrink.c.
Referenced by handle_close(), handle_drop(), handle_read(), and handle_sink().
enum IO_mode |
Enumerator | |
---|---|
IO_READ | |
IO_WRITE |
Definition at line 65 of file heatshrink.c.
enum Operation |
Enumerator | |
---|---|
OP_ENC | |
OP_DEC |
Definition at line 66 of file heatshrink.c.
|
static |
Definition at line 216 of file heatshrink.c.
References free, handle_close(), config::in, config::out, report(), and config::verbose.
Referenced by decode(), and encode().
|
static |
Definition at line 327 of file heatshrink.c.
References close_and_report(), config::decoder_input_buffer_size, decoder_sink_read(), die(), handle_drop(), handle_read(), heatshrink_decoder_alloc(), heatshrink_decoder_finish(), heatshrink_decoder_free(), hsd, HSDR_FINISH_DONE, config::in, config::lookahead_sz2, NULL, printf, and config::window_sz2.
Referenced by main().
|
static |
Definition at line 290 of file heatshrink.c.
References die(), handle_sink(), heatshrink_decoder_finish(), heatshrink_decoder_poll(), heatshrink_decoder_sink(), HSDR_FINISH_DONE, HSDR_POLL_MORE, memset, and config::out.
Referenced by decode().
|
static |
Definition at line 91 of file heatshrink.c.
References report().
Referenced by decode(), decoder_sink_read(), encode(), encoder_sink_read(), and main().
|
static |
Definition at line 259 of file heatshrink.c.
References close_and_report(), die(), encoder_sink_read(), handle_drop(), handle_read(), heatshrink_encoder_alloc(), heatshrink_encoder_free(), hse, config::in, config::lookahead_sz2, NULL, printf, and config::window_sz2.
Referenced by main().
|
static |
Definition at line 224 of file heatshrink.c.
References die(), handle_sink(), heatshrink_encoder_finish(), heatshrink_encoder_poll(), heatshrink_encoder_sink(), HSER_FINISH_DONE, HSER_POLL_MORE, memset, and config::out.
Referenced by encode().
|
static |
Definition at line 203 of file heatshrink.c.
References io_handle::buf, io_handle::fd, io_handle::fill, IO_WRITE, LOG, io_handle::mode, and io_handle::total.
Referenced by close_and_report().
Definition at line 169 of file heatshrink.c.
References io_handle::fill, LOG, and io_handle::read.
Referenced by decode(), and encode().
Definition at line 99 of file heatshrink.c.
References io_handle::fd, free, IO_READ, IO_WRITE, malloc, memset, io_handle::mode, NULL, io_handle::size, and strcmp.
Referenced by main().
Definition at line 133 of file heatshrink.c.
References io_handle::buf, io_handle::fd, io_handle::fill, IO_READ, LOG, io_handle::mode, NULL, printf, io_handle::read, io_handle::size, and io_handle::total.
Referenced by decode(), and encode().
Definition at line 185 of file heatshrink.c.
References io_handle::buf, io_handle::fd, io_handle::fill, IO_WRITE, LOG, memcpy, io_handle::mode, io_handle::size, and io_handle::total.
Referenced by decoder_sink_read(), and encoder_sink_read().
int main | ( | int | argc, |
char ** | argv | ||
) |
Definition at line 422 of file heatshrink.c.
References config::buffer_size, config::cmd, decode(), die(), encode(), handle_open(), config::in, config::in_fname, IO_READ, IO_WRITE, memset, NULL, OP_DEC, OP_ENC, config::out, config::out_fname, printf, proc_args(), strcmp, and usage().
|
static |
Definition at line 376 of file heatshrink.c.
References config::buffer_size, config::cmd, config::decoder_input_buffer_size, DEF_BUFFER_SIZE, DEF_DECODER_INPUT_BUFFER_SIZE, DEF_LOOKAHEAD_SZ2, DEF_WINDOW_SZ2, config::in_fname, config::lookahead_sz2, OP_DEC, OP_ENC, config::out_fname, usage(), config::verbose, and config::window_sz2.
Referenced by main().
|
static |
Definition at line 367 of file heatshrink.c.
References io_handle::fd, config::in, config::in_fname, config::lookahead_sz2, config::out, io_handle::total, and config::window_sz2.
Referenced by close_and_report(), and die().
|
static |
Definition at line 29 of file heatshrink.c.
References author, url, version_major, version_minor, and version_patch.
Referenced by main(), and proc_args().
|
static |
Definition at line 26 of file heatshrink.c.
Referenced by usage().
|
static |
Definition at line 27 of file heatshrink.c.
Referenced by httpdSendResp(), and usage().
|
static |
Definition at line 23 of file heatshrink.c.
Referenced by usage().
|
static |
Definition at line 24 of file heatshrink.c.
Referenced by usage().
|
static |
Definition at line 25 of file heatshrink.c.
Referenced by usage().