aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_escrow_lib.h
diff options
context:
space:
mode:
authorjospaeth <spaethj@in.tum.de>2020-07-16 13:41:56 +0200
committerjospaeth <spaethj@in.tum.de>2020-07-16 13:41:56 +0200
commita8b7f94fadb36299b55f15faaa5f4fda143ba9bb (patch)
tree5641541a01aba222d1131166baca6e33dfd2d4f4 /src/include/gnunet_escrow_lib.h
parentf6007d417be9f3030dad817151ed39d896d233ba (diff)
downloadgnunet-a8b7f94fadb36299b55f15faaa5f4fda143ba9bb.tar.gz
gnunet-a8b7f94fadb36299b55f15faaa5f4fda143ba9bb.zip
change plugin functions to support async code
Diffstat (limited to 'src/include/gnunet_escrow_lib.h')
-rw-r--r--src/include/gnunet_escrow_lib.h139
1 files changed, 122 insertions, 17 deletions
diff --git a/src/include/gnunet_escrow_lib.h b/src/include/gnunet_escrow_lib.h
index 297926581..01abae846 100644
--- a/src/include/gnunet_escrow_lib.h
+++ b/src/include/gnunet_escrow_lib.h
@@ -65,12 +65,103 @@ enum GNUNET_ESCROW_Verification_Result {
65 * Struct for the escrow anchor 65 * Struct for the escrow anchor
66 */ 66 */
67struct GNUNET_ESCROW_Anchor { 67struct GNUNET_ESCROW_Anchor {
68 /**
69 * The escrow method.
70 */
68 enum GNUNET_ESCROW_Key_Escrow_Method method; 71 enum GNUNET_ESCROW_Key_Escrow_Method method;
72
73 /**
74 * The size of the anchor data.
75 */
69 uint32_t size; 76 uint32_t size;
70}; 77};
71 78
72 79
73/** 80/**
81 * Function called after the initialization of the identity service.
82 * Passed via cls to the callback of GNUNET_IDENTITY_connect
83 */
84typedef void (*GNUNET_ESCROW_IdentityInitContinuation) ();
85
86/**
87 * Continuation for PUT and RENEW operations.
88 *
89 * @param cls closure
90 * @param escrowAnchor the escrow anchor needed to get the data back
91 */
92typedef void (*GNUNET_ESCROW_AnchorContinuation) (
93 void *cls,
94 struct GNUNET_ESCROW_Anchor *escrowAnchor);
95
96/**
97 * Continuation for a GET operation.
98 *
99 * @param cls closure
100 * @param ego a new identity ego restored from the escrow
101 */
102typedef void (*GNUNET_ESCROW_EgoContinuation) (
103 void *cls,
104 const struct GNUNET_IDENTITY_Ego *ego);
105
106/**
107 * Continuation for a VERIFY operation.
108 *
109 * @param cls closure
110 * @param verificationResult the result of the verification, i.e.
111 * GNUNET_ESCROW_VALID if the escrow could successfully by restored,
112 * GNUNET_ESCROW_RENEW_NEEDED if the escrow needs to be renewed,
113 * GNUNET_ESCROW_INVALID otherwise
114 */
115typedef void (*GNUNET_ESCROW_VerifyContinuation) (
116 void *cls,
117 int verificationResult);
118
119
120/**
121 * Handle for the escrow component.
122 */
123struct GNUNET_ESCROW_Handle
124{
125 /**
126 * Configuration to use.
127 */
128 const struct GNUNET_CONFIGURATION_Handle *cfg;
129};
130
131
132/**
133 * Handle for an operation with the escrow component.
134 */
135struct GNUNET_ESCROW_Operation
136{
137 /**
138 * Main escrow handle.
139 */
140 struct GNUNET_ESCROW_Handle *h;
141
142 /**
143 * Continuation for a PUT operation.
144 */
145 GNUNET_ESCROW_AnchorContinuation cb_put;
146
147 /**
148 * Continuation for a RENEW operation.
149 */
150 GNUNET_ESCROW_AnchorContinuation cb_renew;
151
152 /**
153 * Continuation for a GET operation.
154 */
155 GNUNET_ESCROW_EgoContinuation cb_get;
156
157 /**
158 * Continuation for a VERIFY operation.
159 */
160 GNUNET_ESCROW_VerifyContinuation cb_verify;
161};
162
163
164/**
74 * Initialize the escrow component. 165 * Initialize the escrow component.
75 * 166 *
76 * @param cfg the configuration to use 167 * @param cfg the configuration to use
@@ -98,14 +189,18 @@ GNUNET_ESCROW_fini (
98 * @param h the handle for the escrow component 189 * @param h the handle for the escrow component
99 * @param ego the identity ego to put in escrow 190 * @param ego the identity ego to put in escrow
100 * @param method the escrow method to use 191 * @param method the escrow method to use
192 * @param cb function to call with the escrow anchor on completion
193 * @param cb_cls closure for @a cb
101 * 194 *
102 * @return the escrow anchor needed to get the data back 195 * @return handle to abort the operation
103 */ 196 */
104void * 197struct GNUNET_ESCROW_Operation *
105GNUNET_ESCROW_put ( 198GNUNET_ESCROW_put (
106 struct GNUNET_ESCROW_Handle *h, 199 struct GNUNET_ESCROW_Handle *h,
107 const struct GNUNET_IDENTITY_Ego *ego, 200 const struct GNUNET_IDENTITY_Ego *ego,
108 enum GNUNET_ESCROW_Key_Escrow_Method method); 201 enum GNUNET_ESCROW_Key_Escrow_Method method,
202 GNUNET_ESCROW_AnchorContinuation cb,
203 void *cb_cls);
109 204
110 205
111/** 206/**
@@ -114,14 +209,18 @@ GNUNET_ESCROW_put (
114 * @param h the handle for the escrow component 209 * @param h the handle for the escrow component
115 * @param escrowAnchor the escrow anchor returned by the GNUNET_ESCROW_put method 210 * @param escrowAnchor the escrow anchor returned by the GNUNET_ESCROW_put method
116 * @param method the escrow method to use 211 * @param method the escrow method to use
212 * @param cb function to call with the escrow anchor on completion
213 * @param cb_cls closure for @a cb
117 * 214 *
118 * @return the escrow anchor needed to get the data back 215 * @return handle to abort the operation
119 */ 216 */
120void * 217struct GNUNET_ESCROW_Operation *
121GNUNET_ESCROW_renew ( 218GNUNET_ESCROW_renew (
122 struct GNUNET_ESCROW_Handle *h, 219 struct GNUNET_ESCROW_Handle *h,
123 void *escrowAnchor, 220 struct GNUNET_ESCROW_Anchor *escrowAnchor,
124 enum GNUNET_ESCROW_Key_Escrow_Method method); 221 enum GNUNET_ESCROW_Key_Escrow_Method method,
222 GNUNET_ESCROW_AnchorContinuation cb,
223 void *cb_cls);
125 224
126 225
127/** 226/**
@@ -131,15 +230,19 @@ GNUNET_ESCROW_renew (
131 * @param escrowAnchor the escrow anchor returned by the GNUNET_ESCROW_put method 230 * @param escrowAnchor the escrow anchor returned by the GNUNET_ESCROW_put method
132 * @param egoName the name of the ego to get back 231 * @param egoName the name of the ego to get back
133 * @param method the escrow method to use 232 * @param method the escrow method to use
233 * @param cb function to call with the restored ego on completion
234 * @param cb_cls closure for @a cb
134 * 235 *
135 * @return a new identity ego restored from the escrow 236 * @return handle to abort the operation
136 */ 237 */
137const struct GNUNET_IDENTITY_Ego * 238struct GNUNET_ESCROW_Operation *
138GNUNET_ESCROW_get ( 239GNUNET_ESCROW_get (
139 struct GNUNET_ESCROW_Handle *h, 240 struct GNUNET_ESCROW_Handle *h,
140 void *escrowAnchor, 241 struct GNUNET_ESCROW_Anchor *escrowAnchor,
141 char *egoName, 242 char *egoName,
142 enum GNUNET_ESCROW_Key_Escrow_Method method); 243 enum GNUNET_ESCROW_Key_Escrow_Method method,
244 GNUNET_ESCROW_EgoContinuation cb,
245 void *cb_cls);
143 246
144 247
145/** 248/**
@@ -149,17 +252,19 @@ GNUNET_ESCROW_get (
149 * @param ego the identity ego that was put into escrow 252 * @param ego the identity ego that was put into escrow
150 * @param escrowAnchor the escrow anchor returned by the GNUNET_ESCROW_put method 253 * @param escrowAnchor the escrow anchor returned by the GNUNET_ESCROW_put method
151 * @param method the escrow method to use 254 * @param method the escrow method to use
255 * @param cb function to call with the verification result on completion
256 * @param cb_cls closure for @a cb
152 * 257 *
153 * @return GNUNET_ESCROW_VALID if the escrow could successfully by restored, 258 * @return handle to abort the operation
154 * GNUNET_ESCROW_RENEW_NEEDED if the escrow needs to be renewed,
155 * GNUNET_ESCROW_INVALID otherwise
156 */ 259 */
157int 260struct GNUNET_ESCROW_Operation *
158GNUNET_ESCROW_verify ( 261GNUNET_ESCROW_verify (
159 struct GNUNET_ESCROW_Handle *h, 262 struct GNUNET_ESCROW_Handle *h,
160 const struct GNUNET_IDENTITY_Ego *ego, 263 const struct GNUNET_IDENTITY_Ego *ego,
161 void *escrowAnchor, 264 struct GNUNET_ESCROW_Anchor *escrowAnchor,
162 enum GNUNET_ESCROW_Key_Escrow_Method method); 265 enum GNUNET_ESCROW_Key_Escrow_Method method,
266 GNUNET_ESCROW_VerifyContinuation cb,
267 void *cb_cls);
163 268
164 269
165/** 270/**