*/
#include "platform.h"
#include "gnunet_util_lib.h"
-#include "gnunet_regex_lib.h"
+#include "regex_internal_lib.h"
#include "regex_ipc.h"
/**
* Search handle (if this client is searching).
*/
- struct GNUNET_REGEX_search_handle *sh;
+ struct REGEX_INTERNAL_Search *sh;
/**
* Announcement handle (if this client is announcing).
*/
- struct GNUNET_REGEX_announce_handle *ah;
+ struct REGEX_INTERNAL_Announcement *ah;
/**
* Refresh frequency for announcements.
*/
static struct GNUNET_SERVER_NotificationContext *nc;
+/**
+ * Private key for this peer.
+ */
+static struct GNUNET_CRYPTO_EccPrivateKey *my_private_key;
+
/**
* Task run during shutdown.
stats = NULL;
GNUNET_SERVER_notification_context_destroy (nc);
nc = NULL;
+ GNUNET_CRYPTO_ecc_key_free (my_private_key);
+ my_private_key = NULL;
}
}
if (NULL != ce->ah)
{
- GNUNET_REGEX_announce_cancel (ce->ah);
+ REGEX_INTERNAL_announce_cancel (ce->ah);
ce->ah = NULL;
}
if (NULL != ce->sh)
{
- GNUNET_REGEX_search_cancel (ce->sh);
+ REGEX_INTERNAL_search_cancel (ce->sh);
ce->sh = NULL;
}
GNUNET_CONTAINER_DLL_remove (client_head, client_tail, ce);
{
struct ClientEntry *ce = cls;
- GNUNET_REGEX_reannounce (ce->ah);
+ REGEX_INTERNAL_reannounce (ce->ah);
ce->refresh_task = GNUNET_SCHEDULER_add_delayed (ce->frequency,
&reannounce,
ce);
}
ce = GNUNET_new (struct ClientEntry);
ce->client = client;
- ce->ah = GNUNET_REGEX_announce (dht,
- &am->pid,
- regex,
- ntohs (am->compression),
- stats);
+ ce->ah = REGEX_INTERNAL_announce (dht,
+ my_private_key,
+ regex,
+ ntohs (am->compression),
+ stats);
if (NULL == ce->ah)
{
GNUNET_break (0);
}
ce = GNUNET_new (struct ClientEntry);
ce->client = client;
- ce->sh = GNUNET_REGEX_search (dht,
+ ce->sh = REGEX_INTERNAL_search (dht,
string,
&handle_search_result,
ce,
{&handle_search, NULL, GNUNET_MESSAGE_TYPE_REGEX_SEARCH, 0},
{NULL, NULL, 0, 0}
};
+
+ my_private_key = GNUNET_CRYPTO_ecc_key_create_from_configuration (cfg);
+ if (NULL == my_private_key)
+ {
+ GNUNET_SCHEDULER_shutdown ();
+ return;
+ }
dht = GNUNET_DHT_connect (cfg, 1024);
if (NULL == dht)
{
+ GNUNET_CRYPTO_ecc_key_free (my_private_key);
+ my_private_key = NULL;
GNUNET_SCHEDULER_shutdown ();
return;
}