GNUnet  0.10.x
Functions
gnunet-service-dht_hello.h File Reference

GNUnet DHT integration with peerinfo. More...

#include "gnunet_util_lib.h"
#include "gnunet_hello_lib.h"
Include dependency graph for gnunet-service-dht_hello.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

const struct GNUNET_HELLO_MessageGDS_HELLO_get (const struct GNUNET_PeerIdentity *peer)
 Obtain a peer's HELLO if available. More...
 
void GDS_HELLO_init (void)
 Initialize HELLO subsystem. More...
 
void GDS_HELLO_done (void)
 Shutdown HELLO subsystem. More...
 

Detailed Description

GNUnet DHT integration with peerinfo.

Author
Christian Grothoff

Definition in file gnunet-service-dht_hello.h.

Function Documentation

◆ GDS_HELLO_get()

const struct GNUNET_HELLO_Message* GDS_HELLO_get ( const struct GNUNET_PeerIdentity peer)

Obtain a peer's HELLO if available.

Parameters
peerpeer to look for a HELLO from
Returns
HELLO for the given peer

Definition at line 53 of file gnunet-service-dht_hello.c.

References GNUNET_CONTAINER_multipeermap_get().

Referenced by handle_find_peer().

54 {
55  if (NULL == peer_to_hello)
56  return NULL;
58 }
static struct GNUNET_CONTAINER_MultiPeerMap * peer_to_hello
Hash map of peers to HELLOs.
void * GNUNET_CONTAINER_multipeermap_get(const struct GNUNET_CONTAINER_MultiPeerMap *map, const struct GNUNET_PeerIdentity *key)
Given a key find a value in the map matching the key.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GDS_HELLO_init()

void GDS_HELLO_init ( void  )

Initialize HELLO subsystem.

Definition at line 103 of file gnunet-service-dht_hello.c.

References GDS_cfg, GNUNET_CONTAINER_multipeermap_create(), GNUNET_NO, GNUNET_PEERINFO_notify(), and process_hello().

Referenced by run().

104 {
106  GNUNET_NO,
107  &process_hello,
108  NULL);
110  GNUNET_NO);
111 }
static struct GNUNET_PEERINFO_NotifyContext * pnc
Handle for peerinfo notifications.
#define GNUNET_NO
Definition: gnunet_common.h:78
static struct GNUNET_CONTAINER_MultiPeerMap * peer_to_hello
Hash map of peers to HELLOs.
struct GNUNET_CONTAINER_MultiPeerMap * GNUNET_CONTAINER_multipeermap_create(unsigned int len, int do_not_copy_keys)
Create a multi peer map (hash map for public keys of peers).
struct GNUNET_PEERINFO_NotifyContext * GNUNET_PEERINFO_notify(const struct GNUNET_CONFIGURATION_Handle *cfg, int include_friend_only, GNUNET_PEERINFO_Processor callback, void *callback_cls)
Call a method whenever our known information about peers changes.
static void process_hello(void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_HELLO_Message *hello, const char *err_msg)
Function called for each HELLO known to PEERINFO.
const struct GNUNET_CONFIGURATION_Handle * GDS_cfg
Configuration we use.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GDS_HELLO_done()

void GDS_HELLO_done ( void  )

Shutdown HELLO subsystem.

Definition at line 131 of file gnunet-service-dht_hello.c.

References free_hello(), GNUNET_CONTAINER_multipeermap_destroy(), GNUNET_CONTAINER_multipeermap_iterate(), and GNUNET_PEERINFO_notify_cancel().

Referenced by shutdown_task().

132 {
133  if (NULL != pnc)
134  {
136  pnc = NULL;
137  }
138  if (NULL != peer_to_hello)
139  {
141  &free_hello,
142  NULL);
144  }
145 }
static struct GNUNET_PEERINFO_NotifyContext * pnc
Handle for peerinfo notifications.
void GNUNET_PEERINFO_notify_cancel(struct GNUNET_PEERINFO_NotifyContext *nc)
Stop notifying about changes.
static struct GNUNET_CONTAINER_MultiPeerMap * peer_to_hello
Hash map of peers to HELLOs.
void GNUNET_CONTAINER_multipeermap_destroy(struct GNUNET_CONTAINER_MultiPeerMap *map)
Destroy a hash map.
int GNUNET_CONTAINER_multipeermap_iterate(struct GNUNET_CONTAINER_MultiPeerMap *map, GNUNET_CONTAINER_PeerMapIterator it, void *it_cls)
Iterate over all entries in the map.
static int free_hello(void *cls, const struct GNUNET_PeerIdentity *key, void *hello)
Free memory occopied by the HELLO.
Here is the call graph for this function:
Here is the caller graph for this function: