ELinks 0.18.0
encoding.h File Reference
#include "network/state.h"
#include "util/string.h"
Include dependency graph for encoding.h:
This graph shows which files directly or indirectly include this file:

Data Structures

struct  stream_encoded
 
struct  decoding_backend
 

Typedefs

typedef unsigned char stream_encoding_T
 

Enumerations

enum  stream_encoding {
  ENCODING_NONE = 0 , ENCODING_GZIP , ENCODING_BZIP2 , ENCODING_LZMA ,
  ENCODING_BROTLI , ENCODING_ZSTD , ENCODINGS_KNOWN
}
 

Functions

struct stream_encodedopen_encoded (int, stream_encoding_T)
 
int read_encoded (struct stream_encoded *, char *, int)
 
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 *)
 
const char *const * listext_encoded (stream_encoding_T)
 
stream_encoding_T guess_encoding (char *filename)
 
const char * get_encoding_name (stream_encoding_T encoding)
 
struct connection_state read_file (struct stream_encoded *stream, int readsize, struct string *page)
 Reads the file from stream in chunks of size readsize.
 
struct connection_state read_encoded_file (struct string *filename, struct string *source)
 

Typedef Documentation

◆ stream_encoding_T

typedef unsigned char stream_encoding_T

Enumeration Type Documentation

◆ stream_encoding

Enumerator
ENCODING_NONE 
ENCODING_GZIP 
ENCODING_BZIP2 
ENCODING_LZMA 
ENCODING_BROTLI 
ENCODING_ZSTD 
ENCODINGS_KNOWN 

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 )

◆ get_encoding_name()

const char * get_encoding_name ( stream_encoding_T encoding)

◆ guess_encoding()

stream_encoding_T guess_encoding ( char * filename)

◆ 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 * source )

◆ 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.