GNUnet 0.21.1
gnunet-service-cadet_hello.h File Reference

cadet service; dealing with hello messages More...

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

Go to the source code of this file.

Functions

void GCH_init (const struct GNUNET_CONFIGURATION_Handle *c)
 Initialize the hello subsystem. More...
 
void GCH_shutdown (void)
 Shut down the hello subsystem. More...
 
const struct GNUNET_MessageHeaderGCH_get_mine (void)
 Get own hello message. More...
 

Detailed Description

cadet service; dealing with hello messages

Author
Bartlomiej Polot
Christian Grothoff

All functions in this file should use the prefix GCH (Gnunet Cadet Hello)

Definition in file gnunet-service-cadet_hello.h.

Function Documentation

◆ GCH_init()

void GCH_init ( const struct GNUNET_CONFIGURATION_Handle c)

Initialize the hello subsystem.

Parameters
cConfiguration.

Definition at line 130 of file gnunet-service-cadet_hello.c.

131{
137 "peerstore",
138 NULL,
140 &error_cb,
141 NULL,
142 &sync_cb,
143 NULL,
144 &got_hello,
145 NULL);
146}
static void sync_cb(void *cls)
static void got_hello(void *cls, const struct GNUNET_PEERSTORE_Record *record, const char *err_msg)
Process each hello message received from peerinfo.
static struct GNUNET_PEERSTORE_Monitor * peerstore_notify
Our peerstore notification context.
static struct GNUNET_PEERSTORE_Handle * peerstore
Handle to the PEERSTORE service.
static void error_cb(void *cls)
@ GNUNET_YES
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
struct GNUNET_PEERSTORE_Monitor * GNUNET_PEERSTORE_monitor_start(const struct GNUNET_CONFIGURATION_Handle *cfg, int iterate_first, const char *sub_system, const struct GNUNET_PeerIdentity *peer, const char *key, GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls, GNUNET_SCHEDULER_TaskCallback sync_cb, void *sync_cb_cls, GNUNET_PEERSTORE_Processor callback, void *callback_cls)
Request watching a given key The monitoring can be filtered to contain only records matching peer and...
struct GNUNET_PEERSTORE_Handle * GNUNET_PEERSTORE_connect(const struct GNUNET_CONFIGURATION_Handle *cfg)
Connect to the PEERSTORE service.
#define GNUNET_PEERSTORE_HELLO_KEY
Key used for storing HELLO in the peerstore.

References error_cb(), GNUNET_assert, GNUNET_PEERSTORE_connect(), GNUNET_PEERSTORE_HELLO_KEY, GNUNET_PEERSTORE_monitor_start(), GNUNET_YES, got_hello(), peerstore, peerstore_notify, and sync_cb().

Referenced by run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GCH_shutdown()

void GCH_shutdown ( void  )

Shut down the hello subsystem.

Definition at line 153 of file gnunet-service-cadet_hello.c.

154{
155 if (NULL != peerstore_notify)
156 {
158 peerstore_notify = NULL;
159 }
160 if (NULL != peerstore)
161 {
163 peerstore = NULL;
164 }
165 if (NULL != mine)
166 {
168 mine = NULL;
169 }
170}
static struct GNUNET_MessageHeader * mine
Hello message of local peer.
#define GNUNET_free(ptr)
Wrapper around free.
void GNUNET_PEERSTORE_monitor_stop(struct GNUNET_PEERSTORE_Monitor *zm)
Stop monitoring.
void GNUNET_PEERSTORE_disconnect(struct GNUNET_PEERSTORE_Handle *h)
Disconnect from the PEERSTORE service.

References GNUNET_free, GNUNET_PEERSTORE_disconnect(), GNUNET_PEERSTORE_monitor_stop(), mine, peerstore, and peerstore_notify.

Referenced by shutdown_rest().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GCH_get_mine()

const struct GNUNET_MessageHeader * GCH_get_mine ( void  )

Get own hello message.

Returns
Own hello message.

Definition at line 179 of file gnunet-service-cadet_hello.c.

180{
182
183 if (NULL == mine)
184 {
190 }
191 return mine;
192}
static struct HostSet * builder
NULL if we are not currently iterating over peer information.
struct GNUNET_PeerIdentity my_full_id
Local peer own ID.
Definition: gnunet-hello.c:101
static struct GNUNET_CRYPTO_EddsaPrivateKey * my_private_key
Our private key.
Definition: gnunet-hello.c:96
void GNUNET_HELLO_builder_free(struct GNUNET_HELLO_Builder *builder)
Release resources of a builder.
Definition: hello-uri.c:373
struct GNUNET_HELLO_Builder * GNUNET_HELLO_builder_new(const struct GNUNET_PeerIdentity *pid)
Allocate builder.
Definition: hello-uri.c:355
struct GNUNET_MessageHeader * GNUNET_HELLO_builder_to_dht_hello_msg(const struct GNUNET_HELLO_Builder *builder, const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, struct GNUNET_TIME_Relative expiration_time)
Generate DHT HELLO message (without peer ID) from a builder.
Definition: hello-uri.c:666
#define GNUNET_TIME_UNIT_ZERO
Relative time zero.
Context for building (or parsing) HELLO URIs.
Definition: hello-uri.c:205

References builder, GNUNET_HELLO_builder_free(), GNUNET_HELLO_builder_new(), GNUNET_HELLO_builder_to_dht_hello_msg(), GNUNET_TIME_UNIT_ZERO, mine, my_full_id, and my_private_key.

Referenced by announce_id().

Here is the call graph for this function:
Here is the caller graph for this function: