2 This file is part of GNUnet
3 Copyright (C) 2012-2014 GNUnet e.V.
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
22 * @author Martin Schanzenbach
25 * API to the Credential service
27 * @defgroup credential Credential service
32 #ifndef GNUNET_CREDENTIAL_SERVICE_H
33 #define GNUNET_CREDENTIAL_SERVICE_H
35 #include "gnunet_util_lib.h"
36 #include "gnunet_gns_service.h"
41 #if 0 /* keep Emacsens' auto-indent happy */
48 * Connection to the Credential service.
50 struct GNUNET_CREDENTIAL_Handle;
53 * Handle to control a lookup operation.
55 struct GNUNET_CREDENTIAL_LookupRequest;
59 * Initialize the connection with the Credential service.
61 * @param cfg configuration to use
62 * @return handle to the Credential service, or NULL on error
64 struct GNUNET_Credential_Handle *
65 GNUNET_CREDENTIAL_connect (const struct GNUNET_CONFIGURATION_Handle *cfg);
69 * Shutdown connection with the Credentail service.
71 * @param handle connection to shut down
74 GNUNET_CREDENTIAL_disconnect (struct GNUNET_CREDENTIAL_Handle *handle);
78 * Iterator called on obtained result for a Credential lookup.
81 * @param issuer the issuer chain
82 * @param issuer_len length of issuer chain
83 * @param rd the records in reply
85 typedef void (*GNUNET_CREDENTIAL_LookupResultProcessor) (void *cls,
86 struct GNUNET_IDENTITY_Ego *issuer,
88 const struct GNUNET_CREDENTIAL_Value *value);
92 * Perform an asynchronous lookup operation for a credential.
94 * @param handle handle to the Credential service
95 * @param credential the credential to look up
96 * @param subject Ego to check the credential for
97 * @param proc function to call on result
98 * @param proc_cls closure for processor
99 * @return handle to the queued request
101 struct GNUNET_CREDENTIAL_LookupRequest *
102 GNUNET_CREDENTIAL_lookup (struct GNUNET_CREDENTIAL_Handle *handle,
103 const char *credential,
104 const struct GNUNET_IDENTITY_Ego *subject,
105 GNUNET_CREDENTIAL_LookupResultProcessor proc,
110 * Issue a credential to an identity
112 * @param handle handle to the Credential service
113 * @param issuer the identity that issues the credential
114 * @param subject the subject of the credential
115 * @param credential the name of the credential
116 * @param value the value of the credential
117 * @return handle to the queued request
119 struct GNUNET_CREDENTIAL_IssueRequest *
120 GNUNET_CREDENTIAL_issue (struct GNUNET_CREDENTIAL_Handle *handle,
121 struct GNUNET_IDENTITY_Ego *issuer,
122 struct GNUNET_IDENTITY_Ego *subject,
123 const char *credential,
124 struct GNUNET_CREDENTIAL_Value *value,
125 GNUNET_CREDENTIAL_IssueResultProcessor proc,
129 * Remove a credential
131 * @param handle handle to the Credential service
132 * @param issuer the identity that issued the credential
133 * @param subject the subject of the credential
134 * @param credential the name of the credential
135 * @return handle to the queued request
137 struct GNUNET_CREDENTIAL_IssueRequest *
138 GNUNET_CREDENTIAL_remove (struct GNUNET_CREDENTIAL_Handle *handle,
139 struct GNUNET_IDENTITY_Ego *issuer,
140 struct GNUNET_IDENTITY_Ego *subject,
141 const char *credential,
142 GNUNET_CREDENTIAL_IssueResultProcessor proc,
148 * Cancel pending lookup request
150 * @param lr the lookup request to cancel
153 GNUNET_CREDENTIAL_lookup_cancel (struct GNUNET_CREDENTIAL_LookupRequest *lr);
156 #if 0 /* keep Emacsens' auto-indent happy */
165 /** @} */ /* end of group */