h->init = NULL;
LOG (GNUNET_ERROR_TYPE_DEBUG, "Connected to core service of peer `%s'.\n",
GNUNET_i2s (&h->me));
- init (h->cls, h, &h->me);
+ init (h->cls, &h->me);
}
else
{
* @param peer peer identity this notification is about
*/
static void
-connected_peer_callback (void *cls, const struct GNUNET_PeerIdentity *peer)
+connected_peer_callback (void *cls,
+ const struct GNUNET_PeerIdentity *peer)
{
struct GNUNET_CRYPTO_HashAsciiEncoded enc;
printf (_("Peer `%s'\n"), (const char *) &enc);
}
-void
+
+static void
monitor_notify_startup (void *cls,
- struct GNUNET_CORE_Handle * server,
- const struct GNUNET_PeerIdentity *
- my_identity)
+ const struct GNUNET_PeerIdentity *my_identity)
{
my_id = (*my_identity);
}
}
-
/**
* Main function that will be run by the scheduler.
*
static void
-init_notify (void *cls, struct GNUNET_CORE_Handle *server,
+init_notify (void *cls,
const struct GNUNET_PeerIdentity *my_identity)
{
struct PeerContext *p = cls;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Core connection to `%4s' established\n",
GNUNET_i2s (my_identity));
- GNUNET_assert (server != NULL);
p->id = *my_identity;
- p->ch = server;
if (cls == &p1)
{
GNUNET_assert (ok == 2);
static void
-init_notify (void *cls, struct GNUNET_CORE_Handle *server,
+init_notify (void *cls,
const struct GNUNET_PeerIdentity *my_identity)
{
struct PeerContext *p = cls;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Connection to CORE service of `%4s' established\n",
GNUNET_i2s (my_identity));
- GNUNET_assert (server != NULL);
p->id = *my_identity;
- p->ch = server;
if (cls == &p1)
{
GNUNET_assert (ok == 2);
static void
-init (void *cls, struct GNUNET_CORE_Handle *core,
+init (void *cls,
const struct GNUNET_PeerIdentity *my_identity)
{
- if (core == NULL)
+ if (NULL == my_identity)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Could NOT connect to CORE;\n");
+ GNUNET_break (0);
return;
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
static void
-init_notify (void *cls, struct GNUNET_CORE_Handle *server,
+init_notify (void *cls,
const struct GNUNET_PeerIdentity *my_identity)
{
struct PeerContext *p = cls;
- GNUNET_assert (server != NULL);
- GNUNET_assert (p->ch == server);
- if (cls == &p1)
+ if (p == &p1)
{
/* connect p2 */
p2.ch =
}
else
{
- GNUNET_assert (cls == &p2);
+ GNUNET_assert (p == &p2);
GNUNET_SCHEDULER_cancel (timeout_task_id);
GNUNET_SCHEDULER_add_now (&shutdown_task, NULL);
}
static void
-init_notify (void *cls, struct GNUNET_CORE_Handle *server,
+init_notify (void *cls,
const struct GNUNET_PeerIdentity *my_identity)
{
struct PeerContext *p = cls;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Connection to CORE service of `%4s' established\n",
GNUNET_i2s (my_identity));
- GNUNET_assert (server != NULL);
+ GNUNET_assert (NULL != my_identity);
p->id = *my_identity;
- GNUNET_assert (p->ch == server);
if (cls == &p1)
{
GNUNET_assert (ok == 2);
* To be called on core init/fail.
*
* @param cls service closure
- * @param server handle to the server for this service
* @param identity the public identity of this peer
*/
static void
-core_init (void *cls, struct GNUNET_CORE_Handle *server,
+core_init (void *cls,
const struct GNUNET_PeerIdentity *identity)
{
- GNUNET_assert (server != NULL);
my_identity = *identity;
}
* Called on core init.
*
* @param cls unused
- * @param server legacy
* @param identity this peer's identity
*/
static void
-core_init (void *cls, struct GNUNET_CORE_Handle *server,
+core_init (void *cls,
const struct GNUNET_PeerIdentity *identity)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
* Core startup callback
*
* @param cls unused
- * @param server core service's server handle
* @param my_identity my id
*/
static void
core_startup_handler (void *cls,
- struct GNUNET_CORE_Handle *server,
const struct GNUNET_PeerIdentity *my_identity)
{
- me = *my_identity;
+ me = *my_identity;
}
-void
+
+static void
schedule_transmisson (struct NodeComCtx *e_ctx);
-size_t
+
+static size_t
transmit_read_wrapper (void *cls, size_t bufsize, void *buf)
{
struct NodeComCtx *e_ctx = cls;
return res;
}
-void
+
+static void
schedule_transmisson (struct NodeComCtx *e_ctx)
{
if (NULL != e_ctx->n->cth)
* directly (which should work if you are authorized...).
*
* @param cls closure
- * @param server handle to the server, NULL if we failed
* @param my_identity ID of this peer, NULL if we failed
*/
static void
-peer_init_handler (void *cls, struct GNUNET_CORE_Handle *server,
+peer_init_handler (void *cls,
const struct GNUNET_PeerIdentity *my_identity)
{
my_id = *my_identity;
static struct GNUNET_PeerIdentity me;
+
static void
-core_init (void *cls, struct GNUNET_CORE_Handle *server,
+core_init (void *cls,
const struct GNUNET_PeerIdentity *my_identity)
{
me = *my_identity;
}
+
/**
* Core handler for p2p hostlist advertisements
*
* @param cls closure
* @param peer identity of the sender
* @param message advertisement message we got
- * @return GNUNET_OK on success
+ * @return #GNUNET_OK on success
*/
static int
advertisement_handler (void *cls, const struct GNUNET_PeerIdentity *peer,
* do this later).
*
* @param cls closure
- * @param server handle to the server, NULL if we failed;
- * TODO: consider removing this argument, it is redundant...
* @param my_identity ID of this peer, NULL if we failed
*/
typedef void (*GNUNET_CORE_StartupCallback) (void *cls,
- struct GNUNET_CORE_Handle * server,
const struct GNUNET_PeerIdentity *my_identity);
}
static void
-core_init_cb (void *cls, struct GNUNET_CORE_Handle *server,
- const struct GNUNET_PeerIdentity *my_identity)
+core_init_cb (void *cls,
+ const struct GNUNET_PeerIdentity *my_identity)
{
my_peer_id = *my_identity;
GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Connected to core service\n");
* To be called on core init/fail.
*
* @param cls Closure (config)
- * @param server handle to the server for this service
* @param identity the public identity of this peer
*/
static void
-core_init (void *cls, struct GNUNET_CORE_Handle *server,
+core_init (void *cls,
const struct GNUNET_PeerIdentity *identity)
{
const struct GNUNET_CONFIGURATION_Handle *c = cls;
static int i = 0;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Core init\n");
- GNUNET_break (core_handle == server);
- if (0 != memcmp (identity, &my_full_id, sizeof (my_full_id)) ||
- NULL == server)
+ if (0 != memcmp (identity, &my_full_id, sizeof (my_full_id)))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Wrong CORE service\n"));
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
* To be called on core init/fail.
*
* @param cls Closure (config)
- * @param server handle to the server for this service
* @param identity the public identity of this peer
*/
static void
-core_init (void *cls, struct GNUNET_CORE_Handle *server,
+core_init (void *cls,
const struct GNUNET_PeerIdentity *identity)
{
const struct GNUNET_CONFIGURATION_Handle *c = cls;
static int i = 0;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Core init\n");
- GNUNET_break (core_handle == server);
- if (0 != memcmp (identity, &my_full_id, sizeof (my_full_id)) ||
- NULL == server)
+ if (0 != memcmp (identity, &my_full_id, sizeof (my_full_id)))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Wrong CORE service\n"));
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
* Called on core init/fail.
*
* @param cls service closure
- * @param server handle to the server for this service
* @param identity the public identity of this peer
*/
static void
-core_init (void *cls, struct GNUNET_CORE_Handle *server,
+core_init (void *cls,
const struct GNUNET_PeerIdentity *identity)
{
struct GNUNET_TIME_Absolute now;
struct GNUNET_TIME_Absolute prev_time;
- if (NULL == server)
+ if (NULL == identity)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Connection to core FAILED!\n");
GNUNET_SCHEDULER_shutdown ();
* do this later).
*
* @param cls closure
- * @param server handle to the server, NULL if we failed
* @param my_identity ID of this peer, NULL if we failed
*/
static void
-core_startup_cb (void *cls, struct GNUNET_CORE_Handle *server,
+core_startup_cb (void *cls,
const struct GNUNET_PeerIdentity *my_identity)
{
struct CacheEntry *entry = cls;
return;
}
GNUNET_assert (NULL == entry->peer_identity);
- GNUNET_break (NULL != server);
- entry->core_handle = server;
- entry->peer_identity = GNUNET_malloc (sizeof (struct GNUNET_PeerIdentity));
+ // FIXME: why is this dynamically allocated?
+ entry->peer_identity = GNUNET_new (struct GNUNET_PeerIdentity);
memcpy (entry->peer_identity, my_identity,
sizeof (struct GNUNET_PeerIdentity));
if (0 == entry->demand)
/**
- * Function called after GNUNET_CORE_connect has succeeded
+ * Function called after #GNUNET_CORE_connect has succeeded
* (or failed for good).
*
* @param cls closure
- * @param server handle to the server, NULL if we failed
* @param my_id ID of this peer, NULL if we failed
*/
static void
-core_init (void *cls, struct GNUNET_CORE_Handle *server,
+core_init (void *cls,
const struct GNUNET_PeerIdentity *my_id)
{
- if (server == NULL)
+ if (NULL == my_id)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
_
GNUNET_SCHEDULER_shutdown ();
return;
}
- handle = server;
my_identity = *my_id;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "I am peer `%s'\n", GNUNET_i2s (my_id));
- peerinfo_notify = GNUNET_PEERINFO_notify (cfg, GNUNET_NO, &process_peer, NULL);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "I am peer `%s'\n",
+ GNUNET_i2s (my_id));
+ peerinfo_notify = GNUNET_PEERINFO_notify (cfg, GNUNET_NO,
+ &process_peer, NULL);
}