1 #ifndef SEQUOIA_OPENPGP_PACKET_H 2 #define SEQUOIA_OPENPGP_PACKET_H 3 4 /*/ 5 /// Frees the Packet. 6 /*/ 7 void pgp_packet_free (pgp_packet_t p); 8 9 /*/ 10 /// Clones this object. 11 /*/ 12 pgp_packet_t pgp_packet_clone (pgp_packet_t keyid); 13 14 /*/ 15 /// Returns a human readable description of this object suitable for 16 /// debugging. 17 /*/ 18 char *pgp_packet_debug (const pgp_packet_t fp); 19 20 /*/ 21 /// Compares objects of this kind. 22 /*/ 23 bool pgp_packet_equal (const pgp_packet_t a, const pgp_packet_t b); 24 25 /*/ 26 /// Hashes this object. 27 /*/ 28 uint64_t pgp_packet_hash (pgp_packet_t keyid); 29 30 /*/ 31 /// Returns the `Packet's` corresponding OpenPGP tag. 32 /// 33 /// Tags are explained in [Section 4.3 of RFC 4880]. 34 /// 35 /// [Section 4.3 of RFC 4880]: https://tools.ietf.org/html/rfc4880#section-4.3 36 /*/ 37 pgp_tag_t pgp_packet_tag (pgp_packet_t p); 38 39 /*/ 40 /// Returns the parsed `Packet's` corresponding OpenPGP tag. 41 /// 42 /// Returns the packets tag, but only if it was successfully 43 /// parsed into the corresponding packet type. If e.g. a 44 /// Signature Packet uses some unsupported methods, it is parsed 45 /// into an `Packet::Unknown`. `tag()` returns `PGP_TAG_SIGNATURE`, 46 /// whereas `kind()` returns `0`. 47 /*/ 48 pgp_tag_t pgp_packet_kind (pgp_packet_t p); 49 50 /*/ 51 /// Returns a human-readable tag name. 52 /*/ 53 const char *pgp_tag_to_string (pgp_tag_t tag); 54 55 /*/ 56 /// Given a packet references the contained signature, if any. 57 /// 58 /// If the Packet is not of the `Packet::Signature` variant, this 59 /// function returns `NULL`. Objects returned from this function must 60 /// be deallocated using `pgp_signature_free` even though they only 61 /// reference the given packet. 62 /*/ 63 pgp_signature_t pgp_packet_ref_signature (pgp_packet_t p); 64 65 /*/ 66 /// Given a packet references the contained literal data packet, if 67 /// any. 68 /// 69 /// If the Packet is not of the `Packet::Literal` variant, this 70 /// function returns `NULL`. Objects returned from this function must 71 /// be deallocated using `pgp_literal_data_free` even though they only 72 /// reference the given packet. 73 /*/ 74 pgp_literal_t pgp_packet_ref_literal (pgp_packet_t p); 75 76 #endif 77