![]() |
GNUnet
0.11.x
|
Helper library for handling HELLO URIs. More...
Macros | |
#define | GNUNET_HELLO_ADDRESS_EXPIRATION |
For how long are HELLO signatures valid? More... | |
Typedefs | |
typedef void(* | GNUNET_HELLO_UriCallback) (void *cls, const char *uri) |
Callback function used to extract URIs from a builder. More... | |
Helper library for handling HELLO URIs.
#define GNUNET_HELLO_ADDRESS_EXPIRATION |
For how long are HELLO signatures valid?
Definition at line 54 of file gnunet_hello_uri_lib.h.
typedef void(* GNUNET_HELLO_UriCallback) (void *cls, const char *uri) |
Callback function used to extract URIs from a builder.
cls | closure |
uri | one of the URIs |
Definition at line 196 of file gnunet_hello_uri_lib.h.
struct GNUNET_HELLO_Builder* GNUNET_HELLO_builder_new | ( | const struct GNUNET_PeerIdentity * | pid | ) |
Allocate builder.
pid | peer the builder is for |
Definition at line 301 of file hello-uri.c.
References builder, GNUNET_new, and pid.
Referenced by GNUNET_HELLO_builder_from_block(), GNUNET_HELLO_builder_from_url(), and run().
void GNUNET_HELLO_builder_free | ( | struct GNUNET_HELLO_Builder * | builder | ) |
Release resources of a builder.
[in] | builder | to free |
Definition at line 312 of file hello-uri.c.
References builder, GNUNET_assert, GNUNET_CONTAINER_DLL_remove, and GNUNET_free.
Referenced by GDS_NEIGHBOURS_handle_get(), GNUNET_HELLO_builder_from_block(), GNUNET_HELLO_builder_from_url(), handle_dht_local_hello_offer(), and shutdown_task().
struct GNUNET_HELLO_Builder* GNUNET_HELLO_builder_from_msg | ( | const struct GNUNET_MessageHeader * | msg | ) |
Parse msg into builder.
msg | message to parse |
Definition at line 330 of file hello-uri.c.
References GNUNET_break, GNUNET_break_op, GNUNET_HELLO_builder_from_block(), GNUNET_MESSAGE_TYPE_HELLO_URI, h, msg, GNUNET_MessageHeader::size, size, and GNUNET_MessageHeader::type.
struct GNUNET_HELLO_Builder* GNUNET_HELLO_builder_from_block | ( | const void * | block, |
size_t | block_size | ||
) |
Parse block into builder.
block | DHT block to parse |
block_size | number of bytes in block |
Definition at line 353 of file hello-uri.c.
References bh, end, GNUNET_break, GNUNET_break_op, GNUNET_HELLO_builder_add_address(), GNUNET_HELLO_builder_free(), GNUNET_HELLO_builder_new(), GNUNET_OK, GNUNET_SYSERR, GNUNET_TIME_absolute_ntoh(), ret, and verify_hello().
Referenced by GDS_NEIGHBOURS_handle_get(), and GNUNET_HELLO_builder_from_msg().
struct GNUNET_HELLO_Builder* GNUNET_HELLO_builder_from_url | ( | const char * | url | ) |
Parse GNUnet HELLO url into builder.
url | URL to parse |
Definition at line 409 of file hello-uri.c.
References dummy, GNUNET_asprintf(), GNUNET_break, GNUNET_break_op, GNUNET_free, GNUNET_HELLO_builder_add_address(), GNUNET_HELLO_builder_free(), GNUNET_HELLO_builder_new(), GNUNET_OK, GNUNET_STRINGS_string_to_data(), GNUNET_STRINGS_urldecode(), GNUNET_SYSERR, GNUNET_TIME_absolute_from_s(), len, pid, q, ret, uri, and verify_hello().
Referenced by handle_dht_local_hello_offer().
struct GNUNET_MQ_Envelope* GNUNET_HELLO_builder_to_env | ( | const struct GNUNET_HELLO_Builder * | builder, |
const struct GNUNET_CRYPTO_EddsaPrivateKey * | priv | ||
) |
Generate envelope with GNUnet HELLO message (including peer ID) from a builder.
builder | builder to serialize |
priv | private key to use to sign the result |
Definition at line 547 of file hello-uri.c.
References builder, env, GNUNET_assert, GNUNET_break, GNUNET_HELLO_builder_to_block(), GNUNET_MESSAGE_TYPE_HELLO_URI, GNUNET_MQ_msg_extra, GNUNET_NO, GNUNET_OK, and msg.
struct GNUNET_MessageHeader* GNUNET_HELLO_builder_to_dht_hello_msg | ( | const struct GNUNET_HELLO_Builder * | builder, |
const struct GNUNET_CRYPTO_EddsaPrivateKey * | priv | ||
) |
Generate DHT HELLO message (without peer ID) from a builder.
builder | builder to serialize |
priv | private key to use to sign the result |
Definition at line 579 of file hello-uri.c.
References buf, builder, BlockHeader::expiration_time, GNUNET_ALIGN, GNUNET_assert, GNUNET_break, GNUNET_HELLO_builder_to_block(), GNUNET_malloc, GNUNET_MESSAGE_TYPE_DHT_P2P_HELLO, GNUNET_NO, GNUNET_OK, msg, BlockHeader::sig, GNUNET_MessageHeader::size, and GNUNET_MessageHeader::type.
Referenced by broadcast_hello().
char* GNUNET_HELLO_builder_to_url | ( | const struct GNUNET_HELLO_Builder * | builder, |
const struct GNUNET_CRYPTO_EddsaPrivateKey * | priv | ||
) |
Generate GNUnet HELLO URI from a builder.
builder | builder to serialize |
priv | private key to use to sign the result |
Definition at line 627 of file hello-uri.c.
Referenced by check_dht_local_hello_offer().
enum GNUNET_GenericReturnValue GNUNET_HELLO_builder_to_block | ( | const struct GNUNET_HELLO_Builder * | builder, |
const struct GNUNET_CRYPTO_EddsaPrivateKey * | priv, | ||
void * | block, | ||
size_t * | block_size | ||
) |
Generate DHT block from a builder.
builder | the builder to serialize | |
priv | private key to use to sign the result | |
[out] | block | where to write the block, NULL to only calculate block_size |
[in,out] | block_size | input is number of bytes available in block, output is number of bytes needed in block |
Definition at line 627 of file hello-uri.c.
Referenced by GNUNET_HELLO_builder_to_dht_hello_msg(), GNUNET_HELLO_builder_to_env(), and handle_find_my_hello().
enum GNUNET_GenericReturnValue GNUNET_HELLO_builder_add_address | ( | struct GNUNET_HELLO_Builder * | builder, |
const char * | address | ||
) |
Add individual address to the builder.
[in,out] | builder | to update |
address | address URI to add |
Definition at line 627 of file hello-uri.c.
References builder, GNUNET_asprintf(), GNUNET_break, GNUNET_free, GNUNET_HELLO_ADDRESS_EXPIRATION, GNUNET_STRINGS_data_to_string_alloc(), GNUNET_STRINGS_urlencode(), GNUNET_TIME_relative_to_timestamp(), GNUNET_TIME_timestamp_to_s(), result, and sign_hello().
Referenced by GNUNET_HELLO_builder_from_block(), GNUNET_HELLO_builder_from_url(), and u_address_add().
enum GNUNET_GenericReturnValue GNUNET_HELLO_builder_del_address | ( | struct GNUNET_HELLO_Builder * | builder, |
const char * | address | ||
) |
Remove individual address from the builder.
[in,out] | builder | to update |
address | address URI to remove |
Definition at line 627 of file hello-uri.c.
Referenced by u_address_del().
void GNUNET_HELLO_builder_iterate | ( | const struct GNUNET_HELLO_Builder * | builder, |
struct GNUNET_PeerIdentity * | pid, | ||
GNUNET_HELLO_UriCallback | uc, | ||
void * | uc_cls | ||
) |
Iterate over URIs in a builder.
builder | builder to iterate over | |
[out] | pid | set to the peer the builder is for |
uc | callback invoked for each URI, can be NULL | |
uc_cls | closure for addrgen |
Definition at line 815 of file hello-uri.c.
Referenced by GDS_NEIGHBOURS_handle_get(), and handle_dht_local_hello_offer().
enum GNUNET_GenericReturnValue GNUNET_HELLO_dht_msg_to_block | ( | const struct GNUNET_MessageHeader * | hello, |
const struct GNUNET_PeerIdentity * | pid, | ||
void ** | block, | ||
size_t * | block_size, | ||
struct GNUNET_TIME_Absolute * | block_expiration | ||
) |
Convert a DHT hello message to a HELLO block.
hello | the HELLO message | |
pid | peer that created the hello | |
[out] | block | set to the HELLO block |
[out] | block_size | set to number of bytes in block |
[out] | block_expiration | set to expiration time of block |
Definition at line 815 of file hello-uri.c.
Referenced by handle_dht_p2p_hello().