| Top |
These APIs handle single-part and multipart blocks, bounded input lines, filenames, size validation and CRC-32 trailers. They do not assemble files, interpret MIME or undo NNTP dot-stuffing. Filenames are untrusted metadata, never filesystem paths. Instances are not thread-safe.
GMimeYencOptions *
g_mime_yenc_options_clone (GMimeYencOptions *options);
guint
g_mime_yenc_options_get_max_line_length
(GMimeYencOptions *options);
void g_mime_yenc_options_set_max_line_length (GMimeYencOptions *options,guint length);
gint64
g_mime_yenc_options_get_max_decoded_size
(GMimeYencOptions *options);
void g_mime_yenc_options_set_max_decoded_size (GMimeYencOptions *options,gint64 size);
const char *
g_mime_yenc_options_get_filename_charset
(GMimeYencOptions *options);
gboolean g_mime_yenc_options_set_filename_charset (GMimeYencOptions *options,const char *charset,GError **error);
The format does not declare a charset. The default ISO-8859-1 preserves every filename byte. Conversion errors are reported without replacement.
GMimeNewLineFormat
g_mime_yenc_options_get_newline_format
(GMimeYencOptions *options);
void g_mime_yenc_options_set_newline_format (GMimeYencOptions *options,GMimeNewLineFormat format);
GMimeYencHeader * g_mime_yenc_header_new (const char *filename,gint64 size,guint line_length,guint part_number,guint total_parts,gint64 begin,gint64 end,GError **error);
Multipart ranges must fall within the file size. A total part count, when specified, must include the part number. Filenames are metadata, not paths.
filename |
a nonempty UTF-8 filename without CR, LF or surrounding ASCII spaces |
|
size |
the entire file size, nonnegative |
|
line_length |
the nominal payload line length, normally 128; writers support 60 through 998 |
|
part_number |
the part number, or zero for a single-part block |
|
total_parts |
the total part count, or zero if unspecified |
|
begin |
the one-based inclusive range start, or zero for a single-part block |
|
end |
the one-based inclusive range end, or zero for a single-part block |
|
error |
return location for an error |
const char *
g_mime_yenc_header_get_filename (GMimeYencHeader *header);
guint
g_mime_yenc_header_get_line_length (GMimeYencHeader *header);
guint
g_mime_yenc_header_get_part_number (GMimeYencHeader *header);
guint
g_mime_yenc_header_get_total_parts (GMimeYencHeader *header);
gint64
g_mime_yenc_header_get_decoded_size (GMimeYencHeader *header);
GMimeYencReader * g_mime_yenc_reader_new (GMimeStream *stream,GMimeYencOptions *options);
Takes an independent snapshot of the options and retains a stream reference.
stream |
the source stream, not necessarily seekable |
|
options |
options, or |
[nullable] |
gboolean g_mime_yenc_reader_read_next (GMimeYencReader *reader,GError **error);
Skips surrounding text, respecting the line limit even outside blocks. Decode the current block before calling again. Clean EOF is not an error.
gboolean g_mime_yenc_reader_decode_to (GMimeYencReader *reader,GMimeStream *destination,GError **error);
Leaves the destination open and unflushed. Discard its output on failure. Missing checksums are accepted; present block checksums are verified. Whole-file checksums of partial ranges are unverified metadata.
GMimeYencHeader *
g_mime_yenc_reader_get_header (GMimeYencReader *reader);
gint64
g_mime_yenc_reader_get_decoded_size (GMimeYencReader *reader);
gboolean g_mime_yenc_reader_get_checksum (GMimeYencReader *reader,guint32 *checksum);
reader |
a yEnc reader |
|
checksum |
the computed finalized block CRC-32, or zero if unavailable. |
[out] |
gboolean g_mime_yenc_reader_get_expected_checksum (GMimeYencReader *reader,guint32 *checksum);
For partial ranges this checksum is unverified metadata.
reader |
a yEnc reader |
|
checksum |
the advertised whole-file CRC-32, or zero if unavailable. |
[out] |
gboolean g_mime_yenc_reader_get_expected_part_checksum (GMimeYencReader *reader,guint32 *checksum);
GMimeYencWriter * g_mime_yenc_writer_new (GMimeStream *stream,GMimeYencOptions *options);
Takes an independent snapshot of the options and retains a stream reference.
stream |
the destination, not necessarily seekable |
|
options |
options, or |
[nullable] |
gboolean g_mime_yenc_writer_write (GMimeYencWriter *writer,GMimeYencHeader *header,GMimeStream *source,const guint32 *file_checksum,guint32 *checksum,GError **error);
Writes framing, payload and a trailer. Leaves the source open and does not flush the destination. A partial range's supplied whole-file checksum is emitted without verification. For a whole-file block it must match. Validation before output does not invalidate the writer; size, checksum or I/O failures once writing begins do invalidate it.
typedef struct _GMimeYencOptions GMimeYencOptions;
Boxed options copied by readers and writers. Defaults are CRLF output, ISO-8859-1 filenames, a 16384-byte line limit excluding the newline, and a 1 GiB decoded-block limit. Readers accept CRLF and LF independently of the output newline setting. Filename conversion never substitutes bytes.
typedef struct _GMimeYencHeader GMimeYencHeader;
Immutable block metadata. Multipart ranges are one-based and inclusive; the size is the entire file size, not the current part size. Metadata alone does not imply that content has been validated.
typedef struct _GMimeYencReader GMimeYencReader;
Call g_mime_yenc_reader_read_next() followed by
g_mime_yenc_reader_decode_to() for each block. Decode to a GMimeStreamNull
to discard a block while still validating it. Do not access the source
directly: the reader buffers beyond the current block.
Output is provisional until decoding succeeds. A parsing or I/O failure invalidates the reader. Stream references are retained, not explicitly closed; non-seekable sources are supported.
typedef struct _GMimeYencWriter GMimeYencWriter;
Writes complete blocks without buffering entire files. Each source must contain exactly the declared block size at its current position; multipart sources contain only the indicated range. A failed write may leave partial output and invalidates the writer. Stream references are retained, not explicitly closed. No MIME headers or NNTP framing are generated.