MIME codecs

MIME codecs — Concrete MIME encoders and decoders

Functions

Types and Values

Description

Base64, quoted-printable, uuencode, yEnc, and pass-through implementations of GMimeEncoder and GMimeDecoder.

Functions

g_mime_base64_encoder_new ()

GMimeBase64Encoder *
g_mime_base64_encoder_new (void);

Uses LF line endings for compatibility with existing native callers.

Returns

a Base64 encoder using 76-character lines.

[transfer full]


g_mime_base64_encoder_new_with_max_line_length ()

GMimeBase64Encoder *
g_mime_base64_encoder_new_with_max_line_length
                               (guint max_line_length);

The effective length is capped at 76 and rounded down to a multiple of four. Uses LF line endings.

Parameters

max_line_length

a line length between 60 and 998

 

Returns

a Base64 encoder.

[transfer full]


g_mime_base64_encoder_new_with_newline_format ()

GMimeBase64Encoder *
g_mime_base64_encoder_new_with_newline_format
                               (GMimeNewLineFormat newline_format,
                                guint max_line_length);

Creates a Base64 encoder with the selected line endings. The effective line length excludes the terminator, is capped at 76, and is rounded down to a multiple of four. Clone, reset and flush preserve the configuration.

Parameters

newline_format

LF or CRLF line endings

 

max_line_length

a line length between 60 and 998

 

Returns

a Base64 encoder.

[transfer full]


g_mime_base64_decoder_new ()

GMimeBase64Decoder *
g_mime_base64_decoder_new (void);

Returns

a Base64 decoder.

[transfer full]


g_mime_quoted_printable_encoder_new ()

GMimeQuotedPrintableEncoder *
g_mime_quoted_printable_encoder_new (void);

Uses LF line endings for compatibility with existing native callers.

Returns

a quoted-printable encoder using 76-character lines.

[transfer full]


g_mime_quoted_printable_encoder_new_with_max_line_length ()

GMimeQuotedPrintableEncoder *
g_mime_quoted_printable_encoder_new_with_max_line_length
                               (guint max_line_length);

The effective length is capped at 76. Uses LF line endings.

Parameters

max_line_length

a line length between 60 and 998

 

Returns

a quoted-printable encoder.

[transfer full]


g_mime_quoted_printable_encoder_new_with_newline_format ()

GMimeQuotedPrintableEncoder *
g_mime_quoted_printable_encoder_new_with_newline_format
                               (GMimeNewLineFormat newline_format,
                                guint max_line_length);

Creates a quoted-printable encoder with the selected line endings for both hard and soft breaks. The line length excludes the terminator and is capped at 76. Bare CR is still encoded as content. Clone, reset and flush preserve the configuration.

Parameters

newline_format

LF or CRLF line endings

 

max_line_length

a line length between 60 and 998

 

Returns

a quoted-printable encoder.

[transfer full]


g_mime_quoted_printable_decoder_new ()

GMimeQuotedPrintableDecoder *
g_mime_quoted_printable_decoder_new (gboolean rfc2047);

Parameters

rfc2047

whether to map unescaped underscores to spaces in encoded words

 

Returns

a quoted-printable decoder.

[transfer full]


g_mime_uu_encoder_new ()

GMimeUUEncoder *
g_mime_uu_encoder_new (void);

Emits payload lines and a zero-length terminating line, not begin/end markers. Uses LF line endings for compatibility with existing native callers.

Returns

a uuencoder.

[transfer full]


g_mime_uu_encoder_new_with_newline_format ()

GMimeUUEncoder *
g_mime_uu_encoder_new_with_newline_format
                               (GMimeNewLineFormat newline_format);

Creates a uuencoder using the selected line endings for payload lines and the zero-length terminating line. It does not emit begin/end markers. Clone, reset and flush preserve the configuration.

Parameters

newline_format

LF or CRLF line endings

 

Returns

a uuencoder.

[transfer full]


g_mime_uu_decoder_new ()

GMimeUUDecoder *
g_mime_uu_decoder_new (gboolean payload_only);

A zero-length payload line ends decoding. Reset restores the initial mode.

Parameters

payload_only

whether decoding begins immediately instead of finding a begin-line

 

Returns

a uudecoder.

[transfer full]


g_mime_pass_through_encoder_new ()

GMimePassThroughEncoder *
g_mime_pass_through_encoder_new (GMimeContentEncoding encoding);

Parameters

encoding

the reported content encoding

 

Returns

an encoder which copies bytes without transformation.

[transfer full]


g_mime_pass_through_decoder_new ()

GMimePassThroughDecoder *
g_mime_pass_through_decoder_new (GMimeContentEncoding encoding);

Parameters

encoding

the reported content encoding

 

Returns

a decoder which copies bytes without transformation.

[transfer full]


g_mime_yenc_encoder_new ()

GMimeYencEncoder *
g_mime_yenc_encoder_new (void);

Emits payload only, without =ybegin, =ypart, or =yend lines.

Returns

a yEnc encoder using 128-character lines.

[transfer full]


g_mime_yenc_encoder_new_with_max_line_length ()

GMimeYencEncoder *
g_mime_yenc_encoder_new_with_max_line_length
                               (guint max_line_length);

An escape pair is never split, so a line can exceed the limit by one byte.

Parameters

max_line_length

a line length between 60 and 998

 

Returns

a yEnc encoder.

[transfer full]


g_mime_yenc_encoder_new_with_newline_format ()

GMimeYencEncoder *
g_mime_yenc_encoder_new_with_newline_format
                               (GMimeNewLineFormat newline_format,
                                guint max_line_length);

Creates a payload encoder. An escape pair may extend a line by one byte. The constructors without a newline argument retain their LF default.

Parameters

newline_format

DOS (CRLF) or Unix (LF) line endings

 

max_line_length

a line length between 60 and 998

 

Returns

a yEnc encoder.

[transfer full]


g_mime_yenc_encoder_get_checksum ()

guint32
g_mime_yenc_encoder_get_checksum (GMimeYencEncoder *encoder);

The running CRC-32 starts at 0xffffffff. Complement the returned value to obtain the conventional final CRC-32. Flush retains the checksum; only reset restores the initial value.

Parameters

encoder

a yEnc encoder

 

Returns

the uncomplemented running checksum.


g_mime_yenc_decoder_new ()

GMimeYencDecoder *
g_mime_yenc_decoder_new (gboolean payload_only);

Full-block decoding skips the =ybegin and optional =ypart header lines. A line beginning with =y ends decoding until reset. Metadata, sizes, and advertised checksums are not validated; callers can compare the computed checksum themselves.

Parameters

payload_only

whether to decode immediately instead of finding a =ybegin line

 

Returns

a yEnc decoder.

[transfer full]


g_mime_yenc_decoder_get_checksum ()

guint32
g_mime_yenc_decoder_get_checksum (GMimeYencDecoder *decoder);

The running CRC-32 starts at 0xffffffff. Complement the returned value to obtain the conventional final CRC-32. Reset restores the initial value.

Parameters

decoder

a yEnc decoder

 

Returns

the uncomplemented running checksum.

Types and Values

GMimeBase64Encoder

typedef struct _GMimeBase64Encoder GMimeBase64Encoder;

Incremental Base64 encoder with MIME line wrapping.


GMimeBase64Decoder

typedef struct _GMimeBase64Decoder GMimeBase64Decoder;

Incremental Base64 decoder which ignores non-alphabet bytes.


GMimeQuotedPrintableEncoder

typedef struct _GMimeQuotedPrintableEncoder GMimeQuotedPrintableEncoder;

Incremental quoted-printable encoder with MIME line wrapping.


GMimeQuotedPrintableDecoder

typedef struct _GMimeQuotedPrintableDecoder GMimeQuotedPrintableDecoder;

Incremental body or RFC 2047 quoted-printable decoder.


GMimeUUEncoder

typedef struct _GMimeUUEncoder GMimeUUEncoder;

Incremental uuencode payload encoder.


GMimeUUDecoder

typedef struct _GMimeUUDecoder GMimeUUDecoder;

Incremental full-block or payload-only uudecoder.


GMimePassThroughEncoder

typedef struct _GMimePassThroughEncoder GMimePassThroughEncoder;

An encoder which copies bytes unchanged.


GMimePassThroughDecoder

typedef struct _GMimePassThroughDecoder GMimePassThroughDecoder;

A decoder which copies bytes unchanged.


GMimeYencEncoder

typedef struct _GMimeYencEncoder GMimeYencEncoder;

Incremental yEnc payload encoder with a running CRC-32 checksum. Flush ends the current line but retains the checksum until reset.


GMimeYencDecoder

typedef struct _GMimeYencDecoder GMimeYencDecoder;

Incremental full-block or payload-only yEnc decoder with a running CRC-32 checksum. Header and trailer metadata are not validated.