ELinks 0.16.1.1
encoding.c File Reference
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include "elinks.h"
#include "config/options.h"
#include "encoding/encoding.h"
#include "network/state.h"
#include "osdep/osdep.h"
#include "util/memory.h"
#include "util/string.h"
#include "encoding/brotli.h"
#include "encoding/bzip2.h"
#include "encoding/gzip.h"
#include "encoding/lzma.h"
#include "encoding/zstd.h"
Include dependency graph for encoding.c:

Data Structures

struct  dummy_enc_data

Functions

static int dummy_open (struct stream_encoded *stream, int fd)
static int dummy_read (struct stream_encoded *stream, char *data, int len)
static char * dummy_decode_buffer (struct stream_encoded *stream, char *data, int len, int *new_len)
static void dummy_close (struct stream_encoded *stream)
struct stream_encodedopen_encoded (int fd, stream_encoding_T encoding)
int read_encoded (struct stream_encoded *stream, char *data, int len)
char * decode_encoded_buffer (struct stream_encoded *stream, stream_encoding_T encoding, char *data, int len, int *new_len)
void close_encoded (struct stream_encoded *stream)
const char *const * listext_encoded (stream_encoding_T encoding)
stream_encoding_T guess_encoding (char *filename)
const char * get_encoding_name (stream_encoding_T encoding)
static stream_encoding_T try_encoding_extensions (struct string *filename, int *fd)
struct connection_state read_file (struct stream_encoded *stream, int readsize, struct string *page)
 Reads the file from stream in chunks of size readsize.
static int is_stdin_pipe (struct stat *stt, struct string *filename)
struct connection_state read_encoded_file (struct string *filename, struct string *page)

Variables

static const char *const dummy_extensions [] = { NULL }
static const struct decoding_backend dummy_decoding_backend
static const struct decoding_backend *const decoding_backends []

Function Documentation

◆ close_encoded()

void close_encoded ( struct stream_encoded * stream)

◆ decode_encoded_buffer()

char * decode_encoded_buffer ( struct stream_encoded * stream,
stream_encoding_T encoding,
char * data,
int len,
int * new_len )

◆ dummy_close()

void dummy_close ( struct stream_encoded * stream)
static

◆ dummy_decode_buffer()

char * dummy_decode_buffer ( struct stream_encoded * stream,
char * data,
int len,
int * new_len )
static

◆ dummy_open()

int dummy_open ( struct stream_encoded * stream,
int fd )
static

◆ dummy_read()

int dummy_read ( struct stream_encoded * stream,
char * data,
int len )
static

◆ get_encoding_name()

const char * get_encoding_name ( stream_encoding_T encoding)

◆ guess_encoding()

stream_encoding_T guess_encoding ( char * filename)

◆ is_stdin_pipe()

int is_stdin_pipe ( struct stat * stt,
struct string * filename )
inlinestatic

◆ listext_encoded()

const char *const * listext_encoded ( stream_encoding_T encoding)

◆ open_encoded()

struct stream_encoded * open_encoded ( int fd,
stream_encoding_T encoding )

◆ read_encoded()

int read_encoded ( struct stream_encoded * stream,
char * data,
int len )

◆ read_encoded_file()

struct connection_state read_encoded_file ( struct string * filename,
struct string * page )

◆ read_file()

struct connection_state read_file ( struct stream_encoded * stream,
int readsize,
struct string * page )

Reads the file from stream in chunks of size readsize.

stream should be in blocking mode. If it is in non-blocking mode, this function can return an empty string in page just because no more data is available yet, and the caller cannot know whether the true end of the stream has been reached.

Returns
a connection state. S_OK if all is well.

◆ try_encoding_extensions()

stream_encoding_T try_encoding_extensions ( struct string * filename,
int * fd )
inlinestatic

Variable Documentation

◆ decoding_backends

const struct decoding_backend* const decoding_backends[]
static
Initial value:
= {
}
#define brotli_decoding_backend
Definition brotli.h:15
#define bzip2_decoding_backend
Definition bzip2.h:14
static const struct decoding_backend dummy_decoding_backend
Definition encoding.c:74
#define gzip_decoding_backend
Definition gzip.h:14
#define lzma_decoding_backend
Definition lzma.h:14
#define zstd_decoding_backend
Definition zstd.h:14

◆ dummy_decoding_backend

const struct decoding_backend dummy_decoding_backend
static
Initial value:
= {
"none",
}
static char * dummy_decode_buffer(struct stream_encoded *stream, char *data, int len, int *new_len)
Definition encoding.c:55
static int dummy_read(struct stream_encoded *stream, char *data, int len)
Definition encoding.c:49
static void dummy_close(struct stream_encoded *stream)
Definition encoding.c:66
static const char *const dummy_extensions[]
Definition encoding.c:72
static int dummy_open(struct stream_encoded *stream, int fd)
Definition encoding.c:38

◆ dummy_extensions

const char* const dummy_extensions[] = { NULL }
static