+/**
+ * Handler for LOOKUP message from client, sends information
+ * about ONE identity to the client immediately.
+ *
+ * @param cls unused
+ * @param message the message received
+ * @return #GNUNET_SYSERR if message was ill-formed
+ */
+static int
+check_lookup_by_suffix_message (void *cls,
+ const struct LookupMessage *message)
+{
+ GNUNET_MQ_check_zero_termination (message);
+ return GNUNET_OK;
+}
+
+
+/**
+ * Handler for LOOKUP_BY_SUFFIX message from client, sends information
+ * about ONE identity to the client immediately.
+ *
+ * @param cls a `struct GNUNET_SERVICE_Client *`
+ * @param message the message received
+ */
+static void
+handle_lookup_by_suffix_message (void *cls,
+ const struct LookupMessage *message)
+{
+ struct GNUNET_SERVICE_Client *client = cls;
+ const char *name;
+ struct GNUNET_MQ_Envelope *env;
+ struct Ego *lprefix;
+
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Received LOOKUP_BY_SUFFIX message from client\n");
+ name = (const char *) &message[1];
+ lprefix = NULL;
+ for (struct Ego *ego = ego_head; NULL != ego; ego = ego->next)
+ {
+
+ if ((strlen (ego->identifier) <= strlen (name)) &&
+ (0 == strcmp (ego->identifier,
+ &name[strlen (name) - strlen (ego->identifier)])) &&
+ ((strlen (name) == strlen (ego->identifier)) ||
+ ('.' == name[strlen (name) -
+ strlen (ego->identifier) - 1])) &&
+ ((NULL == lprefix) ||
+ (strlen (ego->identifier) > strlen (lprefix->identifier))))
+ {
+ /* found better match, update! */
+ lprefix = ego;
+ }
+ }
+ if (NULL != lprefix)
+ {
+ env = create_update_message (lprefix);
+ GNUNET_MQ_send (GNUNET_SERVICE_client_get_mq (client), env);
+ GNUNET_SERVICE_client_continue (client);
+ return;
+ }
+ send_result_code (client,
+ 0,
+ "ego not found");
+ GNUNET_SERVICE_client_continue (client);
+}
+
+