| Top |
A GMimeTnefReader iterates attributes without seeking. For MapiProperties,
Attachment and RecipientTable attributes, obtain a GMimeTnefPropertyReader
with g_mime_tnef_reader_get_property_reader() before advancing the reader.
For example, with reader
positioned on a MapiProperties attribute:
1 2 3 4 5 6 7 8 |
GMimeTnefPropertyReader *properties; properties = g_mime_tnef_reader_get_property_reader (reader, error); if (!properties) return FALSE; while (g_mime_tnef_property_reader_read_next_property (properties, error)) inspect_tag (g_mime_tnef_property_reader_get_tag (properties)); g_object_unref (properties); |
Malformed input is recovered where framing allows and reported through GMimeTnefComplianceLogger. A false iteration result with no GError means end-of-input or a malformed structure that cannot be continued; it does not prove that input was valid. Checksums are verified on the next attribute advance, so iterate to the end to validate the last attribute.
GMimeTnefReader * g_mime_tnef_reader_new (GMimeStream *stream,const GMimeTnefOptions *options);
Creates a forward-only reader without reading any input. The reader takes
a reference to stream
but does not close it. Stream offsets are relative
to its initial position, not to the underlying stream's origin.
const GMimeTnefOptions *
g_mime_tnef_reader_get_options (GMimeTnefReader *reader);
Gets the reader's construction options.
void g_mime_tnef_reader_set_compliance_logger (GMimeTnefReader *reader,GMimeTnefComplianceLogger logger,gpointer user_data,GDestroyNotify destroy);
Sets the callback before reading starts. Embedded readers inherit the outer reader's callback and diagnostic budget.
GMimeTnefComplianceOptions *
g_mime_tnef_reader_get_compliance_options
(GMimeTnefReader *reader);
Gets reporting options. Configure them before reading starts.
void g_mime_tnef_reader_set_compliance_options (GMimeTnefReader *reader,const GMimeTnefComplianceOptions *options);
Copies reporting options before reading starts. The cap is snapshotted when reading starts and shared with all embedded readers.
guint
g_mime_tnef_reader_get_depth (GMimeTnefReader *reader);
Gets the nesting depth; outermost readers have depth zero.
guint16
g_mime_tnef_reader_get_legacy_key (GMimeTnefReader *reader);
Gets the legacy key, available after the first read.
int
g_mime_tnef_reader_get_codepage (GMimeTnefReader *reader);
Gets the codepage used for 8-bit strings.
GMimeTnefAttributeLevel
g_mime_tnef_reader_get_level (GMimeTnefReader *reader);
Gets the current attribute's level.
GMimeTnefAttributeTag
g_mime_tnef_reader_get_tag (GMimeTnefReader *reader);
Gets the current attribute's tag.
GMimeTnefAttributeType
g_mime_tnef_reader_get_attribute_type (GMimeTnefReader *reader);
Gets the current attribute's type.
guint
g_mime_tnef_reader_get_length (GMimeTnefReader *reader);
Gets the current attribute's declared value length.
gint64
g_mime_tnef_reader_get_stream_offset (GMimeTnefReader *reader);
Gets the current attribute header's offset within the outermost stream.
gboolean g_mime_tnef_reader_read (GMimeTnefReader *reader,GError **error);
Advances to the next attribute, skipping unread bytes and checking the previous checksum. Existing child streams and property readers become invalid. Malformed input is reported through the compliance logger.
gboolean g_mime_tnef_reader_read_value_as_int16 (GMimeTnefReader *reader,gint16 *value,GError **error);
Reads an integer attribute, retaining its low 16 bits.
gboolean g_mime_tnef_reader_read_value_as_int32 (GMimeTnefReader *reader,gint32 *value,GError **error);
Reads a short, word, long or dword attribute. Scalar values may be reread. Malformed values are reported and returned as zero.
GDateTime * g_mime_tnef_reader_read_value_as_date_time (GMimeTnefReader *reader,GError **error);
Reads a date attribute. Legacy dates have no timezone; their fields are represented as UTC without a timezone conversion. Invalid dates are reported and represented by 0001-01-01.
char * g_mime_tnef_reader_read_value_as_string (GMimeTnefReader *reader,GError **error);
Claims and decodes a string, text, or message-class attribute as UTF-8. Trailing nul terminators are removed.
GBytes * g_mime_tnef_reader_read_value_as_bytes (GMimeTnefReader *reader,GError **error);
Claims and materializes an attribute's raw bytes. Exceeding a configured data limit reports a diagnostic, skips the value and returns empty bytes.
GMimeStream * g_mime_tnef_reader_open_value_stream (GMimeTnefReader *reader,GError **error);
Claims the attribute and opens a forward-only, read-only stream. It remains valid only until the reader advances. Closing it neither closes the input nor consumes the remainder. Materialization limits do not apply.
GMimeTnefPropertyReader * g_mime_tnef_reader_get_property_reader (GMimeTnefReader *reader,GError **error);
Claims a MapiProperties, Attachment or RecipientTable attribute. Repeated
calls return references to the same property reader. The property reader
is invalidated when reader
advances or is destroyed.