GMimeDecoder

GMimeDecoder — Incremental MIME decoder interface

Functions

Types and Values

Description

Decoders retain incomplete sequences between calls. Malformed encoded input follows MimeKit's tolerant recovery rather than reporting argument errors. Overlapping buffers are supported, copying the input when necessary. Complete each encoded stream with g_mime_decoder_flush(), even when no input remains. Reset before decoding a new stream.

Functions

g_mime_decoder_get_encoding ()

GMimeContentEncoding
g_mime_decoder_get_encoding (GMimeDecoder *decoder);

Parameters

decoder

a decoder

 

Returns

the content encoding.


g_mime_decoder_clone ()

GMimeDecoder *
g_mime_decoder_clone (GMimeDecoder *decoder);

Parameters

decoder

a decoder

 

Returns

an independent decoder with identical state.

[transfer full]


g_mime_decoder_estimate_output_length ()

gsize
g_mime_decoder_estimate_output_length (GMimeDecoder *decoder,
                                       gsize input_length);

Includes buffered input emitted by decode or flush without changing state.

Parameters

decoder

a decoder

 

input_length

number of input bytes

 

Returns

the required capacity, or G_MAXSIZE if it is not representable.


g_mime_decoder_decode ()

gsize
g_mime_decoder_decode (GMimeDecoder *decoder,
                       const guint8 *input,
                       gsize input_length,
                       guint8 *output,
                       gsize output_capacity);

Argument violations are programming errors checked before changing state. Empty input does not finalize incomplete sequences; use g_mime_decoder_flush() at the end of the encoded stream.

Parameters

decoder

a decoder

 

input

input bytes.

[nullable][array length=input_length]

input_length

input length

 

output

writable output buffer.

[out caller-allocates][array length=output_capacity]

output_capacity

capacity, at least the estimated output length

 

Returns

the number of bytes written.


g_mime_decoder_flush ()

gsize
g_mime_decoder_flush (GMimeDecoder *decoder,
                      const guint8 *input,
                      gsize input_length,
                      guint8 *output,
                      gsize output_capacity);

Decodes final input and emits recoverable buffered bytes. Base64 and uuencode recover complete bytes from partial groups; quoted-printable preserves incomplete escapes literally. Fragments that cannot produce a byte are discarded. yEnc discards dangling escapes and incomplete framing, preserving its running checksum.

Call even when the final input is empty. Repeated empty flushes produce no more output. Reset before decoding another stream. Buffer overlap and argument checks follow g_mime_decoder_decode(); capacity must include buffered input as reported by g_mime_decoder_estimate_output_length().

Parameters

decoder

a decoder

 

input

final input bytes.

[nullable][array length=input_length]

input_length

input length, or zero to complete previously decoded input

 

output

writable output buffer.

[out caller-allocates][array length=output_capacity]

output_capacity

capacity, at least the estimated output length

 

Returns

the number of bytes written.


g_mime_decoder_reset ()

void
g_mime_decoder_reset (GMimeDecoder *decoder);

Discards incomplete sequences and resets the decoder.

Parameters

decoder

a decoder

 

Types and Values

GMimeDecoder

typedef struct _GMimeDecoder GMimeDecoder;