GNUnet 0.22.2
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 132 of file gnunet-service-cadet_hello.c.

133{
139 "peerstore",
140 NULL,
142 &error_cb,
143 NULL,
144 &sync_cb,
145 NULL,
146 &got_hello,
147 NULL);
148}
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 155 of file gnunet-service-cadet_hello.c.

156{
157 if (NULL != peerstore_notify)
158 {
160 peerstore_notify = NULL;
161 }
162 if (NULL != peerstore)
163 {
165 peerstore = NULL;
166 }
167 if (NULL != mine)
168 {
170 mine = NULL;
171 }
172}
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 181 of file gnunet-service-cadet_hello.c.

182{
184
185 if (NULL == mine)
186 {
192 }
193 return mine;
194}
static struct GNUNET_CRYPTO_EddsaPrivateKey my_private_key
Peer private key.
Definition: gnunet-core.c:60
static struct GNUNET_PeerIdentity my_full_id
Peer identity.
Definition: gnunet-core.c:65
static struct HostSet * builder
NULL if we are not currently iterating over peer information.
void GNUNET_HELLO_builder_free(struct GNUNET_HELLO_Builder *builder)
Release resources of a builder.
Definition: hello-uri.c:453
struct GNUNET_HELLO_Builder * GNUNET_HELLO_builder_new(const struct GNUNET_PeerIdentity *pid)
Allocate builder.
Definition: hello-uri.c:401
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:822
#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: