aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_zklaim_service.h
blob: 6654555ab8d2b1ceaee376338f3b68b83220d9e3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
/*
     This file is part of GNUnet.
     Copyright (C) 2016 GNUnet e.V.

     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
     Affero General Public License for more details.

     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/>.
*/

/**
 * @author Martin Schanzenbach
 *
 * @file
 * ZKlaim service. Manage ZKlaim issuers etc.
 *
 * @defgroup zklaim  ZKlaim service
 * @{
 */
#ifndef GNUNET_ZKLAIM_SERVICE_H
#define GNUNET_ZKLAIM_SERVICE_H

#ifdef __cplusplus
extern "C"
{
#if 0                           /* keep Emacsens' auto-indent happy */
}
#endif
#endif

#include "gnunet_util_lib.h"

/**
 * Version number of GNUnet Identity Provider API.
 */
#define GNUNET_ZKLAIM_VERSION 0x00000000

/**
 * Handle to access the identity service.
 */
struct GNUNET_ZKLAIM_Handle;

/**
 * Handle for an operation with the zklaim service.
 */
struct GNUNET_ZKLAIM_Operation;

/**
 * Context
 */
struct GNUNET_ZKLAIM_Context;

/**
 * Connect to the ZKlaim service.
 *
 * @param cfg Configuration to contact the service.
 * @return handle to communicate with the service
 */
struct GNUNET_ZKLAIM_Handle *
GNUNET_ZKLAIM_connect (const struct GNUNET_CONFIGURATION_Handle *cfg);

/**
 * Iterator called for each attribute and data.
 *
 * @param cls closure
 * @param name name of attribute
 * @param data attribute data (can be modified)
 */
typedef void
(*GNUNET_ZKLAIM_PayloadIterator) (void *cls,
                                  const char* name,
                                  uint64_t *data);



/**
 * Continuation called to notify client about result of the
 * operation.
 *
 * @param cls closure
 * @param success #GNUNET_SYSERR on failure (including timeout/queue drop/failure to validate)
 *                #GNUNET_NO if content was already there or not found
 *                #GNUNET_YES (or other positive value) on success
 * @param emsg NULL on success, otherwise an error message
 */
typedef void
(*GNUNET_ZKLAIM_ContextResult) (void *cls,
                                const struct GNUNET_ZKLAIM_Context *ctx);



/**
 * Continuation called to notify client about result of the
 * operation.
 *
 * @param cls closure
 * @param success #GNUNET_SYSERR on failure (including timeout/queue drop/failure to validate)
 *                #GNUNET_NO if content was already there or not found
 *                #GNUNET_YES (or other positive value) on success
 * @param emsg NULL on success, otherwise an error message
 */
typedef void
(*GNUNET_ZKLAIM_ContinuationWithStatus) (void *cls,
                                         int32_t success,
                                         const char *emsg);


/**
 * Create a new issuer context
 *
 * @param h handle to the identity provider
 * @param pkey private key of the identity
 * @param attr the attribute
 * @param exp_interval the relative expiration interval for the attribute
 * @param cont continuation to call when done
 * @param cont_cls closure for @a cont
 * @return handle to abort the request
 */
struct GNUNET_ZKLAIM_Operation *
GNUNET_ZKLAIM_context_create (struct GNUNET_ZKLAIM_Handle *h,
                              const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey,
                              const char *context_name,
                              const char *attr_list,
                              GNUNET_ZKLAIM_ContinuationWithStatus cont,
                              void *cont_cls);

/**
 * Disconnect from service.
 *
 * @param h service to disconnect
 */
void
GNUNET_ZKLAIM_disconnect (struct GNUNET_ZKLAIM_Handle *h);


/**
 * Cancel an operation.  Note that the operation MAY still
 * be executed; this merely cancels the continuation; if the request
 * was already transmitted, the service may still choose to complete
 * the operation.
 *
 * @param op operation to cancel
 */
void
GNUNET_ZKLAIM_cancel (struct GNUNET_ZKLAIM_Operation *op);

#if 0                           /* keep Emacsens' auto-indent happy */
{
#endif
#ifdef __cplusplus
}
#endif


/* ifndef GNUNET_ZKLAIM_SERVICE_H */
#endif

/** @} */ /* end of group identity */

/* end of gnunet_zklaim_service.h */