diff libpurple/certificate.h @ 18941:425f494bd1ec

- CertificateVerifier register/unregister/find - certificate_verify added, probably will change - struct Verifier: start_verification added
author William Ehlhardt <williamehlhardt@gmail.com>
date Fri, 22 Jun 2007 23:30:26 +0000
parents 5fa287322a82
children 02102eccc4be
line wrap: on
line diff
--- a/libpurple/certificate.h	Fri Jun 22 20:49:32 2007 +0000
+++ b/libpurple/certificate.h	Fri Jun 22 23:30:26 2007 +0000
@@ -159,6 +159,12 @@
 
 /** A set of operations used to provide logic for verifying a Certificate's
  *  authenticity.
+ *
+ * A Verifier provider must fill out these fields, then register it using
+ * purple_certificate_register_verifier()
+ *
+ * The (scheme_name, name) value must be unique for each Verifier - you may not
+ * register more than one Verifier of the same name for each Scheme
  */
 struct _PurpleCertificateVerifier
 {
@@ -171,6 +177,18 @@
 	 * using this Verifier
 	 */
 	gchar *scheme_name;
+
+	/**
+	 * Start the verification process
+	 *
+	 * To be called from purple_certificate_verify once it has
+	 * constructed the request. This will use the information in the
+	 * given VerificationRequest to check the certificate and callback
+	 * the requester with the verification results.
+	 *
+	 * @param vrq      Request to process
+	 */
+	void (* start_verification)(PurpleCertificateVerificationRequest *vrq);
 };
 
 /** Structure for a single certificate request
@@ -182,6 +200,10 @@
 {
 	/** Reference to the verification logic used */
 	PurpleCertificateVerifier *verifier;
+	/** Reference to the scheme used.
+	 *
+	 * This is looked up from the Verifier when the Request is generated
+	 */
 
 	/**
 	 * Name to check that the certificate is issued to
@@ -239,6 +261,33 @@
 gboolean
 purple_certificate_unregister_scheme(PurpleCertificateScheme *scheme);
 
+/** Look up a registered PurpleCertificateVerifier by scheme and name
+ * @param scheme_name  Scheme name. Case insensitive.
+ * @param ver_name     The verifier name. Case insensitive.
+ * @return Pointer to the located Verifier, or NULL if it isn't found.
+ */
+PurpleCertificateVerifier *
+purple_certificate_find_verifier(const gchar *scheme_name, const gchar *ver_name);
+
+
+/**
+ * Register a CertificateVerifier with libpurple
+ *
+ * @param vr     Verifier to register.
+ * @return TRUE if register succeeded, otherwise FALSE
+ */
+gboolean
+purple_certificate_register_verifier(PurpleCertificateVerifier *vr);
+
+/**
+ * Unregister a CertificateVerifier with libpurple
+ *
+ * @param vr     Verifier to unregister.
+ * @return TRUE if register succeeded, otherwise FALSE
+ */
+gboolean
+purple_certificate_unregister_verifier(PurpleCertificateVerifier *vr);
+
 /* TODO: ADD STUFF HERE */
 
 /*@}*/