global reindent, now with uncrustify hook enabled
[oweals/gnunet.git] / src / credential / credential.h
index 3ba8e9c9e7420778c06335a5fe785c6c525fc808..3d76bbf4fb69d8492582d917a710ed44784bffaa 100644 (file)
@@ -2,25 +2,25 @@
       This file is part of GNUnet
       Copyright (C) 2012-2013 GNUnet e.V.
 
-      GNUnet is free software; you can redistribute it and/or modify
-      it under the terms of the GNU General Public License as published
-      by the Free Software Foundation; either version 3, or (at your
-      option) any later version.
+      GNUnet is free software: you can redistribute it and/or modify it
+      under the terms of the GNU Affero General Public License as published
+      by the Free Software Foundation, either version 3 of the License,
+      or (at your option) any later version.
 
       GNUnet is distributed in the hope that it will be useful, but
       WITHOUT ANY WARRANTY; without even the implied warranty of
       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-      General Public License for more details.
+      Affero General Public License for more details.
 
-      You should have received a copy of the GNU General Public License
-      along with GNUnet; see the file COPYING.  If not, write to the
-      Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-      Boston, MA 02110-1301, USA.
+      You should have received a copy of the GNU Affero General Public License
+      along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+     SPDX-License-Identifier: AGPL3.0-or-later
  */
 /**
  * @file credential/credential.h
  * @brief IPC messages between CREDENTIAL API and CREDENTIAL service
- * @author Adnan Husain 
+ * @author Martin Schanzenbach
  */
 #ifndef CREDENTIAL_H
 #define CREDENTIAL_H
 
 GNUNET_NETWORK_STRUCT_BEGIN
 
+/**
+ * Message from client to Credential service to collect credentials.
+ */
+struct CollectMessage
+{
+  /**
+   * Header of type #GNUNET_MESSAGE_TYPE_CREDENTIAL_VERIFY
+   */
+  struct GNUNET_MessageHeader header;
+
+  /**
+   * Subject public key
+   */
+  struct GNUNET_CRYPTO_EcdsaPrivateKey subject_key;
+
+  /**
+   * Trust anchor
+   */
+  struct GNUNET_CRYPTO_EcdsaPublicKey issuer_key;
+
+  /**
+   * Length of the issuer attribute
+   */
+  uint16_t issuer_attribute_len;
+
+  /**
+   * Unique identifier for this request (for key collisions).
+   */
+  uint32_t id GNUNET_PACKED;
+
+  /* Followed by the zero-terminated attribute */
+};
+
+
 /**
  * Message from client to Credential service to verify attributes.
  */
@@ -50,32 +84,31 @@ struct VerifyMessage
   struct GNUNET_CRYPTO_EcdsaPublicKey issuer_key;
 
   /**
-   * Length of the issuer attribute
+   * Number of credentials
    */
-  uint16_t issuer_attribute_len;
+  uint32_t c_count;
 
   /**
-   * Length of the subject attribute
+   * Length of the issuer attribute
    */
-  uint16_t subject_attribute_len;
+  uint16_t issuer_attribute_len;
 
   /**
    * Unique identifier for this request (for key collisions).
    */
   uint32_t id GNUNET_PACKED;
 
-  /* Followed by the zero-terminated attributes to look up */
-
+  /* Followed by the zero-terminated attribute and credentials to look up */
 };
 
 
 /**
  * Message from CREDENTIAL service to client: new results.
  */
-struct VerifyResultMessage
+struct DelegationChainResultMessage
 {
   /**
-    * Header of type #GNUNET_MESSAGE_TYPE_CREDENTIAL_VERIFY_RESULT
+   * Header of type #GNUNET_MESSAGE_TYPE_CREDENTIAL_VERIFY_RESULT
    */
   struct GNUNET_MessageHeader header;
 
@@ -83,7 +116,7 @@ struct VerifyResultMessage
    * Unique identifier for this request (for key collisions).
    */
   uint32_t id GNUNET_PACKED;
-  
+
   /**
    * Indicates if credential has been found at all
    */
@@ -100,11 +133,84 @@ struct VerifyResultMessage
   uint32_t c_count GNUNET_PACKED;
 
   /* followed by ad_count GNUNET_CREDENTIAL_RecordData structs*/
+};
 
+struct DelegationRecordData
+{
+  /**
+   * Subject key
+   */
+  struct GNUNET_CRYPTO_EcdsaPublicKey subject_key;
+
+  /**
+   * Subject attributes
+   */
+  uint32_t subject_attribute_len GNUNET_PACKED;
+};
+
+
+struct ChainEntry
+{
+  /**
+   * Issuer key
+   */
+  struct GNUNET_CRYPTO_EcdsaPublicKey issuer_key;
+
+  /**
+   * Subject key
+   */
+  struct GNUNET_CRYPTO_EcdsaPublicKey subject_key;
+
+  /**
+   * Issuer attributes
+   */
+  uint32_t issuer_attribute_len GNUNET_PACKED;
+
+  /**
+   * Subject attributes
+   */
+  uint32_t subject_attribute_len GNUNET_PACKED;
+};
+
+
+struct CredentialEntry
+{
+  /**
+   * The signature for this credential by the issuer
+   */
+  struct GNUNET_CRYPTO_EcdsaSignature signature;
+
+  /**
+   * Signature meta
+   */
+  struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
+
+  /**
+   * Public key of the issuer
+   */
+  struct GNUNET_CRYPTO_EcdsaPublicKey issuer_key;
+
+  /**
+   * Public key of the subject this credential was issued to
+   */
+  struct GNUNET_CRYPTO_EcdsaPublicKey subject_key;
+
+  /**
+   * Expiration time of this credential
+   */
+  uint64_t expiration GNUNET_PACKED;
+
+  /**
+   * Issuer attribute length
+   */
+  uint32_t issuer_attribute_len;
+
+  /**
+   * Followed by the attribute string
+   */
 };
 
 
 GNUNET_NETWORK_STRUCT_END
 
 #endif
-