aboutsummaryrefslogtreecommitdiff
path: root/src/escrow/escrow_plugin_helper.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/escrow/escrow_plugin_helper.c')
-rw-r--r--src/escrow/escrow_plugin_helper.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/escrow/escrow_plugin_helper.c b/src/escrow/escrow_plugin_helper.c
index ca45b6837..7192123d9 100644
--- a/src/escrow/escrow_plugin_helper.c
+++ b/src/escrow/escrow_plugin_helper.c
@@ -29,6 +29,7 @@
29#include "gnunet_util_lib.h" 29#include "gnunet_util_lib.h"
30#include "gnunet_identity_service.h" 30#include "gnunet_identity_service.h"
31#include "gnunet_escrow_plugin.h" 31#include "gnunet_escrow_plugin.h"
32#include "escrow.h"
32 33
33 34
34/** 35/**
@@ -180,6 +181,40 @@ ESCROW_cleanup_ego_list (struct ESCROW_PluginHandle *ph)
180} 181}
181 182
182 183
184/**
185 * Build an anchor struct.
186 *
187 * @param method escrow method
188 * @param egoName name of the ego
189 * @param data anchor data
190 * @param data_size size of the anchor data
191 *
192 * @return a new anchor struct
193 */
194struct GNUNET_ESCROW_Anchor *
195ESCROW_build_anchor (enum GNUNET_ESCROW_Key_Escrow_Method method,
196 const char *egoName,
197 void *data,
198 uint32_t data_size)
199{
200 struct GNUNET_ESCROW_Anchor *anchor;
201 char *ptr;
202
203 anchor = GNUNET_malloc (sizeof (struct GNUNET_ESCROW_Anchor)
204 + data_size
205 + strlen (egoName) + 1);
206 anchor->method = method;
207 anchor->size = data_size;
208 ptr = (char *)&anchor[1];
209 GNUNET_memcpy (ptr, data, data_size);
210 ptr += data_size;
211 anchor->egoName = ptr;
212 strcpy (ptr, egoName);
213
214 return anchor;
215}
216
217
183static char * 218static char *
184string_to_upper (const char *str) 219string_to_upper (const char *str)
185{ 220{