summaryrefslogtreecommitdiffstats
path: root/openpgp-ffi/include/sequoia/openpgp.h
diff options
context:
space:
mode:
authorNeal H. Walfield <neal@pep.foundation>2019-05-28 20:49:11 +0200
committerNeal H. Walfield <neal@pep.foundation>2019-05-28 22:23:30 +0200
commit97f9072481bd68a881f1a7579ff829130f010e44 (patch)
treec5b4115f7837505b53a36b4b113c3b8fc684b1e6 /openpgp-ffi/include/sequoia/openpgp.h
parentdaaa47823639bd2c9c52090187e2d787ab8891b4 (diff)
openpgp-ffi: Add bindings for new UserID methods
- Providing bindings for UserID::other and UserID::address_or_other. - Improve related documentation to reflect the changes to the parser.
Diffstat (limited to 'openpgp-ffi/include/sequoia/openpgp.h')
-rw-r--r--openpgp-ffi/include/sequoia/openpgp.h67
1 files changed, 61 insertions, 6 deletions
diff --git a/openpgp-ffi/include/sequoia/openpgp.h b/openpgp-ffi/include/sequoia/openpgp.h
index 4a40de13..69a872e3 100644
--- a/openpgp-ffi/include/sequoia/openpgp.h
+++ b/openpgp-ffi/include/sequoia/openpgp.h
@@ -1089,8 +1089,13 @@ const uint8_t *pgp_user_id_value (pgp_packet_t uid,
/// The User ID is parsed as an [RFC 2822 mailbox], and the display
/// name is extracted.
///
-/// If the User ID is not a valid RFC 2822 mailbox production,
-/// then an error is returned.
+/// Note: invalid email addresses are accepted in order to support
+/// things like URIs of the form `Hostname
+/// <ssh://server@example.net>`.
+///
+/// If the User ID is otherwise not a valid RFC 2822 mailbox
+/// production, then an error is returned.
+///
///
/// If the User ID does not contain a display, *name is set
/// to NULL.
@@ -1106,8 +1111,12 @@ pgp_status_t pgp_user_id_name(pgp_error_t *errp, pgp_packet_t uid,
/// The User ID is parsed as an [RFC 2822 mailbox], and the first
/// comment is extracted.
///
-/// If the User ID is not a valid RFC 2822 mailbox production,
-/// then an error is returned.
+/// Note: invalid email addresses are accepted in order to support
+/// things like URIs of the form `Hostname
+/// <ssh://server@example.net>`.
+///
+/// If the User ID is otherwise not a valid RFC 2822 mailbox
+/// production, then an error is returned.
///
/// If the User ID does not contain a comment, *commentp is set
/// to NULL.
@@ -1123,8 +1132,12 @@ pgp_status_t pgp_user_id_comment(pgp_error_t *errp, pgp_packet_t uid,
/// The User ID is parsed as an [RFC 2822 mailbox], and the email
/// address is extracted.
///
-/// If the User ID is not a valid RFC 2822 mailbox production,
-/// then an error is returned.
+/// Note: invalid email addresses are accepted in order to support
+/// things like URIs of the form `Hostname
+/// <ssh://server@example.net>`.
+///
+/// If the User ID is otherwise not a valid RFC 2822 mailbox
+/// production, then an error is returned.
///
/// If the User ID does not contain an email address, *addressp is set
/// to NULL.
@@ -1135,6 +1148,48 @@ pgp_status_t pgp_user_id_address(pgp_error_t *errp, pgp_packet_t uid,
char **addressp);
/*/
+/// Returns the User ID's invalid address, if any.
+///
+/// The User ID is parsed as an [RFC 2822 mailbox], and if the address
+/// is invalid, that is returned.
+///
+/// Note: invalid email addresses are accepted in order to support
+/// things like URIs of the form `Hostname
+/// <ssh://server@example.net>`.
+///
+/// If the User ID is otherwise not a valid RFC 2822 mailbox
+/// production, then an error is returned.
+///
+/// If the User ID does not contain an invalid address, *otherp is
+/// set to NULL.
+///
+/// [RFC 2822 mailbox]: https://tools.ietf.org/html/rfc2822#section-3.4
+/*/
+pgp_status_t pgp_user_id_other(pgp_error_t *errp, pgp_packet_t uid,
+ char **addressp);
+
+/*/
+/// Returns the User ID's email address, if any.
+///
+/// The User ID is parsed as an [RFC 2822 mailbox], and the email
+/// address, whether it is valid or not, is extracted.
+///
+/// Note: invalid email addresses are accepted in order to support
+/// things like URIs of the form `Hostname
+/// <ssh://server@example.net>`.
+///
+/// If the User ID is otherwise not a valid RFC 2822 mailbox
+/// production, then an error is returned.
+///
+/// If the User ID does not contain an address (valid or invalid),
+/// *addressp is set to NULL.
+///
+/// [RFC 2822 mailbox]: https://tools.ietf.org/html/rfc2822#section-3.4
+/*/
+pgp_status_t pgp_user_id_address_or_other(pgp_error_t *errp, pgp_packet_t uid,
+ char **addressp);
+
+/*/
/// Returns a normalized version of the UserID's email address.
///
/// Normalized email addresses are primarily needed when email