GMimeAuthenticationResults

GMimeAuthenticationResults — Authentication result header models

Functions

GMimeAuthenticationResults * g_mime_authentication_results_new ()
GMimeAuthenticationResults * g_mime_authentication_results_parse ()
char * g_mime_authentication_results_to_string ()
const char * g_mime_authentication_results_get_authentication_service_identifier ()
gboolean g_mime_authentication_results_get_instance ()
void g_mime_authentication_results_set_instance ()
void g_mime_authentication_results_clear_instance ()
gboolean g_mime_authentication_results_get_version ()
void g_mime_authentication_results_set_version ()
void g_mime_authentication_results_clear_version ()
int g_mime_authentication_results_get_result_count ()
GMimeAuthenticationMethodResult * g_mime_authentication_results_get_result ()
void g_mime_authentication_results_set_result ()
void g_mime_authentication_results_add_result ()
void g_mime_authentication_results_insert_result ()
int g_mime_authentication_results_index_of_result ()
gboolean g_mime_authentication_results_contains_result ()
gboolean g_mime_authentication_results_remove_result ()
void g_mime_authentication_results_remove_result_at ()
void g_mime_authentication_results_clear_results ()
GMimeAuthenticationMethodResult * g_mime_authentication_method_result_new ()
char * g_mime_authentication_method_result_to_string ()
const char * g_mime_authentication_method_result_get_method ()
const char * g_mime_authentication_method_result_get_result ()
const char * g_mime_authentication_method_result_get_office365_authentication_service_identifier ()
gboolean g_mime_authentication_method_result_get_version ()
void g_mime_authentication_method_result_set_version ()
void g_mime_authentication_method_result_clear_version ()
const char * g_mime_authentication_method_result_get_result_comment ()
void g_mime_authentication_method_result_set_result_comment ()
const char * g_mime_authentication_method_result_get_reason ()
void g_mime_authentication_method_result_set_reason ()
const char * g_mime_authentication_method_result_get_action ()
int g_mime_authentication_method_result_get_property_count ()
GMimeAuthenticationMethodProperty * g_mime_authentication_method_result_get_property ()
void g_mime_authentication_method_result_set_property ()
void g_mime_authentication_method_result_add_property ()
void g_mime_authentication_method_result_insert_property ()
int g_mime_authentication_method_result_index_of_property ()
gboolean g_mime_authentication_method_result_contains_property ()
gboolean g_mime_authentication_method_result_remove_property ()
void g_mime_authentication_method_result_remove_property_at ()
void g_mime_authentication_method_result_clear_properties ()
GMimeAuthenticationMethodProperty * g_mime_authentication_method_property_new ()
const char * g_mime_authentication_method_property_get_property_type ()
const char * g_mime_authentication_method_property_get_property ()
const char * g_mime_authentication_method_property_get_value ()
char * g_mime_authentication_method_property_to_string ()

Types and Values

Description

Parsed Authentication-Results and ARC-Authentication-Results values, with MimeKit-compatible recovery for Office365 and dotted authentication methods. Collections retain references, preserve order and allow duplicate objects. The models describe reported results; they neither authenticate a message nor establish whether a header or its authentication service is trustworthy.

Constructors and setters store UTF-8 strings without syntax validation. Comments retain their inner comment syntax, including escapes and nesting. Use GMimeHeader to fold serialized values for transport. g_mime_authentication_results_to_string() produces unfolded model text, not a complete header.

Functions

g_mime_authentication_results_new ()

GMimeAuthenticationResults *
g_mime_authentication_results_new (const char *authserv_id);

Creates a model, copying authserv_id without validating its syntax.

Parameters

authserv_id

the authentication service identifier

 

Returns

an empty result collection with no version or ARC instance.

[transfer full]


g_mime_authentication_results_parse ()

GMimeAuthenticationResults *
g_mime_authentication_results_parse (const char *text,
                                     gssize length,
                                     GError **error);

Parses a bounded value, including ARC instance numbers and common Office365 deviations. Missing methods become "none". Numbers must be nonnegative signed 32-bit integers. Comments and quoted strings are unfolded; property quoting is retained. Invalid UTF-8 in text values is replaced with U+FFFD, while embedded NUL bytes are rejected.

Parameters

text

the header value, without the field name

 

length

the byte length, or -1 for a NUL-terminated string

 

error

return location for a parse error.

[nullable]

Returns

the parsed model, or NULL with GMIME_ERROR_PARSE_ERROR and a relative byte offset on malformed input.

[transfer full][nullable]


g_mime_authentication_results_to_string ()

char *
g_mime_authentication_results_to_string
                               (GMimeAuthenticationResults *results);

Formats the service, optional numbers and ordered method results.

Parameters

results

authentication results

 

Returns

the unfolded value, without a field name or final newline.

[transfer full]


g_mime_authentication_results_get_authentication_service_identifier ()

const char *
g_mime_authentication_results_get_authentication_service_identifier
                               (GMimeAuthenticationResults *results);

Gets the identifier of the service reporting these results.

Parameters

results

authentication results

 

Returns

the service identifier, or NULL for Office365 values that omit it.

[transfer none][nullable]


g_mime_authentication_results_get_instance ()

gboolean
g_mime_authentication_results_get_instance
                               (GMimeAuthenticationResults *results,
                                int *instance);

Gets the optional ARC instance without conflating zero with absence.

Parameters

results

authentication results

 

instance

the instance, or zero when absent.

[out][optional]

Returns

whether an ARC instance is present.


g_mime_authentication_results_set_instance ()

void
g_mime_authentication_results_set_instance
                               (GMimeAuthenticationResults *results,
                                int instance);

Sets the instance without range validation, as in MimeKit.

Parameters

results

authentication results

 

instance

the ARC instance

 

g_mime_authentication_results_clear_instance ()

void
g_mime_authentication_results_clear_instance
                               (GMimeAuthenticationResults *results);

Removes the optional ARC instance.

Parameters

results

authentication results

 

g_mime_authentication_results_get_version ()

gboolean
g_mime_authentication_results_get_version
                               (GMimeAuthenticationResults *results,
                                int *version);

Gets the optional header version without conflating zero with absence.

Parameters

results

authentication results

 

version

the version, or zero when absent.

[out][optional]

Returns

whether an Authentication-Results version is present.


g_mime_authentication_results_set_version ()

void
g_mime_authentication_results_set_version
                               (GMimeAuthenticationResults *results,
                                int version);

Sets the version without range validation, as in MimeKit.

Parameters

results

authentication results

 

version

the version

 

g_mime_authentication_results_clear_version ()

void
g_mime_authentication_results_clear_version
                               (GMimeAuthenticationResults *results);

Removes the optional version.

Parameters

results

authentication results

 

g_mime_authentication_results_get_result_count ()

int
g_mime_authentication_results_get_result_count
                               (GMimeAuthenticationResults *results);

Gets the size of the ordered method-result collection.

Parameters

results

authentication results

 

Returns

the number of method results.


g_mime_authentication_results_get_result ()

GMimeAuthenticationMethodResult *
g_mime_authentication_results_get_result
                               (GMimeAuthenticationResults *results,
                                int index);

Gets an existing entry without adding a reference.

Parameters

results

authentication results

 

index

a zero-based result index

 

Returns

the result owned by results .

[transfer none]


g_mime_authentication_results_set_result ()

void
g_mime_authentication_results_set_result
                               (GMimeAuthenticationResults *results,
                                int index,
                                GMimeAuthenticationMethodResult *result);

Retains the replacement before releasing the old entry. Duplicates are allowed.

Parameters

results

authentication results

 

index

an existing result index

 

result

the replacement result.

[transfer none]

g_mime_authentication_results_add_result ()

void
g_mime_authentication_results_add_result
                               (GMimeAuthenticationResults *results,
                                GMimeAuthenticationMethodResult *result);

Appends a retained reference, allowing duplicates.

Parameters

results

authentication results

 

result

the result to append.

[transfer none]

g_mime_authentication_results_insert_result ()

void
g_mime_authentication_results_insert_result
                               (GMimeAuthenticationResults *results,
                                int index,
                                GMimeAuthenticationMethodResult *result);

Inserts a retained reference at index .

Parameters

results

authentication results

 

index

an index from zero through the result count

 

result

the result to insert.

[transfer none]

g_mime_authentication_results_index_of_result ()

int
g_mime_authentication_results_index_of_result
                               (GMimeAuthenticationResults *results,
                                GMimeAuthenticationMethodResult *result);

Searches by object identity, not by serialized value.

Parameters

results

authentication results

 

result

the result to find

 

Returns

the first matching instance index, or -1 if absent.


g_mime_authentication_results_contains_result ()

gboolean
g_mime_authentication_results_contains_result
                               (GMimeAuthenticationResults *results,
                                GMimeAuthenticationMethodResult *result);

Tests collection membership by object identity.

Parameters

results

authentication results

 

result

the result to find

 

Returns

whether the exact result instance belongs to the collection.


g_mime_authentication_results_remove_result ()

gboolean
g_mime_authentication_results_remove_result
                               (GMimeAuthenticationResults *results,
                                GMimeAuthenticationMethodResult *result);

Removes only the first occurrence, preserving the remaining order.

Parameters

results

authentication results

 

result

the result to remove.

[transfer none]

Returns

whether a result was removed.


g_mime_authentication_results_remove_result_at ()

void
g_mime_authentication_results_remove_result_at
                               (GMimeAuthenticationResults *results,
                                int index);

Releases and removes the entry at index .

Parameters

results

authentication results

 

index

an existing result index

 

g_mime_authentication_results_clear_results ()

void
g_mime_authentication_results_clear_results
                               (GMimeAuthenticationResults *results);

Releases all results without changing the service, version or instance.

Parameters

results

authentication results

 

g_mime_authentication_method_result_new ()

GMimeAuthenticationMethodResult *
g_mime_authentication_method_result_new
                               (const char *method,
                                const char *result);

Creates a method result, copying both strings without syntax validation.

Parameters

method

the authentication method

 

result

the reported result

 

Returns

a method result with an empty property collection.

[transfer full]


g_mime_authentication_method_result_to_string ()

char *
g_mime_authentication_method_result_to_string
                               (GMimeAuthenticationMethodResult *result);

Formats the method, result and associated details without folding.

Parameters

result

a method result

 

Returns

the unfolded method result, including its properties.

[transfer full]


g_mime_authentication_method_result_get_method ()

const char *
g_mime_authentication_method_result_get_method
                               (GMimeAuthenticationMethodResult *result);

Gets the authentication method, such as "dkim" or "spf".

Parameters

result

a method result

 

Returns

the method name, preserving case.

[transfer none]


g_mime_authentication_method_result_get_result ()

const char *
g_mime_authentication_method_result_get_result
                               (GMimeAuthenticationMethodResult *result);

Gets the reported outcome, such as "pass" or "fail".

Parameters

result

a method result

 

Returns

the reported result, preserving case.

[transfer none]


g_mime_authentication_method_result_get_office365_authentication_service_identifier ()

const char *
g_mime_authentication_method_result_get_office365_authentication_service_identifier
                               (GMimeAuthenticationMethodResult *result);

Gets the nonstandard per-method service identifier, when present.

Parameters

result

a method result

 

Returns

the Office365 method-specific service identifier.

[transfer none][nullable]


g_mime_authentication_method_result_get_version ()

gboolean
g_mime_authentication_method_result_get_version
                               (GMimeAuthenticationMethodResult *result,
                                int *version);

Gets the optional method version without conflating zero with absence.

Parameters

result

a method result

 

version

the version, or zero when absent.

[out][optional]

Returns

whether a method version is present.


g_mime_authentication_method_result_set_version ()

void
g_mime_authentication_method_result_set_version
                               (GMimeAuthenticationMethodResult *result,
                                int version);

Sets the version without range validation, as in MimeKit.

Parameters

result

a method result

 

version

the version

 

g_mime_authentication_method_result_clear_version ()

void
g_mime_authentication_method_result_clear_version
                               (GMimeAuthenticationMethodResult *result);

Removes the optional method version.

Parameters

result

a method result

 

g_mime_authentication_method_result_get_result_comment ()

const char *
g_mime_authentication_method_result_get_result_comment
                               (GMimeAuthenticationMethodResult *result);

Gets the first comment following the result, retaining inner escapes and nesting.

Parameters

result

a method result

 

Returns

the inner comment syntax, without outer parentheses.

[transfer none][nullable]


g_mime_authentication_method_result_set_result_comment ()

void
g_mime_authentication_method_result_set_result_comment
                               (GMimeAuthenticationMethodResult *result,
                                const char *comment);

Copies the comment without escaping, unfolding or syntax validation.

Parameters

result

a method result

 

comment

inner comment syntax, or NULL to clear.

[nullable]

g_mime_authentication_method_result_get_reason ()

const char *
g_mime_authentication_method_result_get_reason
                               (GMimeAuthenticationMethodResult *result);

Gets the explanatory reason associated with the result.

Parameters

result

a method result

 

Returns

the reason text.

[transfer none][nullable]


g_mime_authentication_method_result_set_reason ()

void
g_mime_authentication_method_result_set_reason
                               (GMimeAuthenticationMethodResult *result,
                                const char *reason);

Copies the reason. A nonempty reason takes precedence over an action when serializing; an empty or absent reason allows the parsed action.

Parameters

result

a method result

 

reason

the reason, or NULL to clear.

[nullable]

g_mime_authentication_method_result_get_action ()

const char *
g_mime_authentication_method_result_get_action
                               (GMimeAuthenticationMethodResult *result);

Gets the nonstandard action reported by the authentication service.

Parameters

result

a method result

 

Returns

the parsed action text.

[transfer none][nullable]


g_mime_authentication_method_result_get_property_count ()

int
g_mime_authentication_method_result_get_property_count
                               (GMimeAuthenticationMethodResult *result);

Gets the size of the ordered property collection.

Parameters

result

a method result

 

Returns

the number of properties.


g_mime_authentication_method_result_get_property ()

GMimeAuthenticationMethodProperty *
g_mime_authentication_method_result_get_property
                               (GMimeAuthenticationMethodResult *result,
                                int index);

Gets an existing entry without adding a reference.

Parameters

result

a method result

 

index

a zero-based property index

 

Returns

the property owned by result .

[transfer none]


g_mime_authentication_method_result_set_property ()

void
g_mime_authentication_method_result_set_property
                               (GMimeAuthenticationMethodResult *result,
                                int index,
                                GMimeAuthenticationMethodProperty *property);

Retains the replacement before releasing the old entry. Duplicates are allowed.

Parameters

result

a method result

 

index

an existing property index

 

property

the replacement property.

[transfer none]

g_mime_authentication_method_result_add_property ()

void
g_mime_authentication_method_result_add_property
                               (GMimeAuthenticationMethodResult *result,
                                GMimeAuthenticationMethodProperty *property);

Appends a retained reference, allowing duplicates.

Parameters

result

a method result

 

property

the property to append.

[transfer none]

g_mime_authentication_method_result_insert_property ()

void
g_mime_authentication_method_result_insert_property
                               (GMimeAuthenticationMethodResult *result,
                                int index,
                                GMimeAuthenticationMethodProperty *property);

Inserts a retained reference at index .

Parameters

result

a method result

 

index

an index from zero through the property count

 

property

the property to insert.

[transfer none]

g_mime_authentication_method_result_index_of_property ()

int
g_mime_authentication_method_result_index_of_property
                               (GMimeAuthenticationMethodResult *result,
                                GMimeAuthenticationMethodProperty *property);

Searches by object identity, not by serialized value.

Parameters

result

a method result

 

property

the property to find

 

Returns

the first matching instance index, or -1 if absent.


g_mime_authentication_method_result_contains_property ()

gboolean
g_mime_authentication_method_result_contains_property
                               (GMimeAuthenticationMethodResult *result,
                                GMimeAuthenticationMethodProperty *property);

Tests collection membership by object identity.

Parameters

result

a method result

 

property

the property to find

 

Returns

whether the exact property instance belongs to the collection.


g_mime_authentication_method_result_remove_property ()

gboolean
g_mime_authentication_method_result_remove_property
                               (GMimeAuthenticationMethodResult *result,
                                GMimeAuthenticationMethodProperty *property);

Removes only the first occurrence, preserving the remaining order.

Parameters

result

a method result

 

property

the property to remove.

[transfer none]

Returns

whether a property was removed.


g_mime_authentication_method_result_remove_property_at ()

void
g_mime_authentication_method_result_remove_property_at
                               (GMimeAuthenticationMethodResult *result,
                                int index);

Releases and removes the entry at index .

Parameters

result

a method result

 

index

an existing property index

 

g_mime_authentication_method_result_clear_properties ()

void
g_mime_authentication_method_result_clear_properties
                               (GMimeAuthenticationMethodResult *result);

Releases every property without changing other result fields.

Parameters

result

a method result

 

g_mime_authentication_method_property_new ()

GMimeAuthenticationMethodProperty *
g_mime_authentication_method_property_new
                               (const char *ptype,
                                const char *property,
                                const char *value);

Empty values and values containing MIME token specials are quoted when serialized. Parsed properties instead preserve their original quoting, except that empty values are always quoted.

Parameters

ptype

the property type, such as "header" or "smtp"

 

property

the property name

 

value

the property value

 

Returns

an immutable property.

[transfer full]


g_mime_authentication_method_property_get_property_type ()

const char *
g_mime_authentication_method_property_get_property_type
                               (GMimeAuthenticationMethodProperty *property);

Gets the property namespace, such as "header" or "smtp".

Parameters

property

an authentication property

 

Returns

the property type.

[transfer none]


g_mime_authentication_method_property_get_property ()

const char *
g_mime_authentication_method_property_get_property
                               (GMimeAuthenticationMethodProperty *property);

Gets the name within the property namespace.

Parameters

property

an authentication property

 

Returns

the property name.

[transfer none]


g_mime_authentication_method_property_get_value ()

const char *
g_mime_authentication_method_property_get_value
                               (GMimeAuthenticationMethodProperty *property);

Gets the property value without its surrounding quoting syntax.

Parameters

property

an authentication property

 

Returns

the property value.

[transfer none]


g_mime_authentication_method_property_to_string ()

char *
g_mime_authentication_method_property_to_string
                               (GMimeAuthenticationMethodProperty *property);

Formats the type, name and value as a property assignment.

Parameters

property

an authentication property

 

Returns

the serialized property, without leading whitespace.

[transfer full]

Types and Values

GMimeAuthenticationResults

typedef struct _GMimeAuthenticationResults GMimeAuthenticationResults;

An Authentication-Results or ARC-Authentication-Results header value.


GMimeAuthenticationMethodResult

typedef struct _GMimeAuthenticationMethodResult GMimeAuthenticationMethodResult;

An authentication method, its result and ordered properties.


GMimeAuthenticationMethodProperty

typedef struct _GMimeAuthenticationMethodProperty GMimeAuthenticationMethodProperty;

An immutable authentication method property.