gnunet-service-mesh_local.c gnunet-service-mesh_local.h \
gnunet-service-mesh_peer.c gnunet-service-mesh_peer.h \
gnunet-service-mesh_dht.c gnunet-service-mesh_dht.h \
+ gnunet-service-mesh_hello.c gnunet-service-mesh_hello.h \
mesh_path.c mesh_path.h \
mesh_common.c \
gnunet-service-mesh.c
$(top_builddir)/src/core/libgnunetcore.la \
$(top_builddir)/src/dht/libgnunetdht.la \
$(top_builddir)/src/statistics/libgnunetstatistics.la \
+ $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \
$(top_builddir)/src/block/libgnunetblock.la
gnunet_service_mesh_DEPENDENCIES = \
$(top_builddir)/src/util/libgnunetutil.la \
$(top_builddir)/src/core/libgnunetcore.la \
$(top_builddir)/src/dht/libgnunetdht.la \
$(top_builddir)/src/statistics/libgnunetstatistics.la \
+ $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \
$(top_builddir)/src/block/libgnunetblock.la
if LINUX
gnunet_service_mesh_LDFLAGS = -lrt
--- /dev/null
+/*
+ This file is part of GNUnet.
+ (C) 2014 Christian Grothoff (and other contributing authors)
+
+ GNUnet is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 3, 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
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNUnet; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#include "platform.h"
+#include "gnunet_util_lib.h"
+
+#include "gnunet_statistics_service.h"
+#include "gnunet_peerinfo_service.h"
+
+#include "mesh_protocol.h"
+#include "mesh_path.h"
+
+#include "gnunet-service-mesh_hello.h"
+#include "gnunet-service-mesh_peer.h"
+
+#define LOG(level, ...) GNUNET_log_from(level,"mesh-hll",__VA_ARGS__)
+
+
+/******************************************************************************/
+/******************************** STRUCTS **********************************/
+/******************************************************************************/
+
+
+
+/******************************************************************************/
+/******************************* GLOBALS ***********************************/
+/******************************************************************************/
+
+/**
+ * Global handle to the statistics service.
+ */
+extern struct GNUNET_STATISTICS_Handle *stats;
+
+/**
+ * Local peer own ID (memory efficient handle).
+ */
+extern GNUNET_PEER_Id myid;
+
+/**
+ * Local peer own ID (full value).
+ */
+extern struct GNUNET_PeerIdentity my_full_id;
+
+
+/**
+ * Don't try to recover tunnels if shutting down.
+ */
+extern int shutting_down;
+
+
+/**
+ * Hello message of local peer.
+ */
+const struct GNUNET_HELLO_Message *mine;
+
+/**
+ * Handle to peerinfo service.
+ */
+static struct GNUNET_PEERINFO_Handle *peerinfo;
+
+/**
+ * Iterator context.
+ */
+struct GNUNET_PEERINFO_NotifyContext* nc;
+
+
+/******************************************************************************/
+/******************************** STATIC ***********************************/
+/******************************************************************************/
+
+/**
+ * Process each hello message received from peerinfo.
+ *
+ * @param cls the 'struct GetUriContext'
+ * @param peer identity of the peer
+ * @param hello addresses of the peer
+ * @param err_msg error message
+ */
+static void
+got_hello (void *cls, const struct GNUNET_PeerIdentity *id,
+ const struct GNUNET_HELLO_Message *hello,
+ const char *err_msg)
+{
+ struct MeshPeer *peer;
+
+ if (NULL == id)
+ LOG (GNUNET_ERROR_TYPE_ERROR, "not a valid id\n");
+
+ peer = GMP_get (id);
+ GMP_set_hello (peer, hello);
+}
+
+
+/******************************************************************************/
+/******************************** API ***********************************/
+/******************************************************************************/
+
+
+void
+GMH_init (const struct GNUNET_CONFIGURATION_Handle *c)
+{
+ GNUNET_assert (NULL != nc);
+ peerinfo = GNUNET_PEERINFO_connect (c);
+ nc = GNUNET_PEERINFO_notify (c, GNUNET_NO, &got_hello, NULL);
+}
+
+
+void
+GMH_shutdown ()
+{
+ if (NULL != nc)
+ {
+ GNUNET_PEERINFO_notify_cancel (nc);
+ nc = NULL;
+ }
+ if (NULL != peerinfo)
+ {
+ GNUNET_PEERINFO_disconnect (peerinfo);
+ peerinfo = NULL;
+ }
+}
+
+
+const struct GNUNET_HELLO_Message *
+GMH_get_mine (void)
+{
+ return mine;
+}
+
+
+const struct GNUNET_HELLO_Message *
+GMH_get (const struct GNUNET_PeerIdentity *id)
+{
+ return GMP_get_hello (GMP_get (id));
+}
+
+void
+GMH_2s ()
+{
+}
+
+
--- /dev/null
+/*
+ This file is part of GNUnet.
+ (C) 2014 Christian Grothoff (and other contributing authors)
+
+ GNUnet is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 3, 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
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNUnet; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+/**
+ * @file mesh/gnunet-service-mesh_hello.h
+ * @brief mesh service; dealing with hello messages
+ * @author Bartlomiej Polot
+ *
+ * All functions in this file should use the prefix GMH (Gnunet Mesh Hello)
+ */
+
+#ifndef GNUNET_SERVICE_MESH_HELLO_H
+#define GNUNET_SERVICE_MESH_HELLO_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#if 0 /* keep Emacsens' auto-indent happy */
+}
+#endif
+#endif
+
+#include "platform.h"
+#include "gnunet_util_lib.h"
+
+
+void
+GMH_init (const struct GNUNET_CONFIGURATION_Handle *c);
+
+void
+GMH_shutdown ();
+
+
+
+#if 0 /* keep Emacsens' auto-indent happy */
+{
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+/* ifndef GNUNET_MESH_SERVICE_HELLO_H */
+#endif
+/* end of gnunet-mesh-service_hello.h */