Alternative to mem_cred_t.add_cert added, which returns the certificate.
[strongswan.git] / src / libstrongswan / credentials / sets / mem_cred.h
index 18b42b9..3db57df 100644 (file)
@@ -1,4 +1,6 @@
 /*
+ * Copyright (C) 2010 Tobias Brunner
+ * Hochschule fuer Technik Rapperswil
  * Copyright (C) 2010 Martin Willi
  * Copyright (C) 2010 revosec AG
  *
@@ -24,6 +26,7 @@
 typedef struct mem_cred_t mem_cred_t;
 
 #include <credentials/credential_set.h>
+#include <utils/linked_list.h>
 
 /**
  * Generic in-memory credential set.
@@ -36,14 +39,54 @@ struct mem_cred_t {
        credential_set_t set;
 
        /**
+        * Add a certificate to the credential set.
+        *
+        * @param trusted               TRUE to serve certificate as trusted
+        * @param cert                  certificate, reference gets owned by set
+        */
+       void (*add_cert)(mem_cred_t *this, bool trusted, certificate_t *cert);
+
+       /**
+        * Add a certificate to the credential set, returning a reference to it or
+        * to a cached duplicate.
+        *
+        * @param trusted               TRUE to serve certificate as trusted
+        * @param cert                  certificate, reference gets owned by set
+        * @return                              reference to cert or a previously cached duplicate
+        */
+       certificate_t *(*add_cert_ref)(mem_cred_t *this, bool trusted,
+                                                                  certificate_t *cert);
+
+       /**
+        * Add a private key to the credential set.
+        *
+        * @param key                   key, reference gets owned by set
+        */
+       void (*add_key)(mem_cred_t *this, private_key_t *key);
+
+       /**
         * Add a shared key to the credential set.
         *
         * @param shared                shared key to add, gets owned by set
-        * @param ...                   NULL terminated list of owners identification_t*
+        * @param ...                   NULL terminated list of owners (identification_t*)
         */
        void (*add_shared)(mem_cred_t *this, shared_key_t *shared, ...);
 
        /**
+        * Add a shared key to the credential set.
+        *
+        * @param shared                shared key to add, gets owned by set
+        * @param owners                list of owners (identification_t*), gets owned
+        */
+       void (*add_shared_list)(mem_cred_t *this, shared_key_t *shared,
+                                                       linked_list_t *owners);
+
+       /**
+        * Clear all credentials from the credential set.
+        */
+       void (*clear)(mem_cred_t *this);
+
+       /**
         * Destroy a mem_cred_t.
         */
        void (*destroy)(mem_cred_t *this);