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 struct GNUNET_PeerIdentity *pid, const char *uri) |
Callback function used to extract URIs from a builder. More... | |
Functions | |
struct GNUNET_HELLO_Builder * | GNUNET_HELLO_builder_new (const struct GNUNET_PeerIdentity *pid) |
Allocate builder. More... | |
const struct GNUNET_PeerIdentity * | GNUNET_HELLO_builder_get_id (const struct GNUNET_HELLO_Builder *builder) |
Get the PeerIdentity for this builder. More... | |
void | GNUNET_HELLO_builder_free (struct GNUNET_HELLO_Builder *builder) |
Release resources of a builder. More... | |
struct GNUNET_HELLO_Builder * | GNUNET_HELLO_builder_from_msg (const struct GNUNET_MessageHeader *msg) |
Parse msg into builder. More... | |
struct GNUNET_HELLO_Builder * | GNUNET_HELLO_builder_from_block (const void *block, size_t block_size) |
Parse block into builder. More... | |
struct GNUNET_HELLO_Builder * | GNUNET_HELLO_builder_from_url (const char *url) |
Parse GNUnet HELLO url into builder. More... | |
struct GNUNET_TIME_Absolute | GNUNET_HELLO_builder_get_expiration_time (const struct GNUNET_MessageHeader *msg) |
Get the expiration time for this HELLO. More... | |
struct GNUNET_MQ_Envelope * | GNUNET_HELLO_builder_to_env (const struct GNUNET_HELLO_Builder *builder, const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, struct GNUNET_TIME_Relative expiration_time) |
Generate envelope with GNUnet HELLO message (including peer ID) from a builder. More... | |
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. More... | |
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. More... | |
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, struct GNUNET_TIME_Relative expiration_time) |
Generate DHT block from a builder. More... | |
enum GNUNET_GenericReturnValue | GNUNET_HELLO_builder_add_address (struct GNUNET_HELLO_Builder *builder, const char *address) |
Add individual address to the builder. More... | |
enum GNUNET_GenericReturnValue | GNUNET_HELLO_builder_del_address (struct GNUNET_HELLO_Builder *builder, const char *address) |
Remove individual address from the builder. More... | |
const struct GNUNET_PeerIdentity * | GNUNET_HELLO_builder_iterate (const struct GNUNET_HELLO_Builder *builder, GNUNET_HELLO_UriCallback uc, void *uc_cls) |
Iterate over URIs in a builder. More... | |
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. More... | |
char * | GNUNET_HELLO_address_to_prefix (const char *address) |
Given an address as a string, extract the prefix that identifies the communicator offering transmissions to that address. More... | |
void | GNUNET_HELLO_sign_address (const char *address, enum GNUNET_NetworkType nt, struct GNUNET_TIME_Absolute mono_time, const struct GNUNET_CRYPTO_EddsaPrivateKey *private_key, void **result, size_t *result_size) |
Build address record by signing raw information with private key. More... | |
Helper library for handling HELLO URIs.
#define GNUNET_HELLO_ADDRESS_EXPIRATION |
For how long are HELLO signatures valid?
Definition at line 58 of file gnunet_hello_uri_lib.h.
typedef void(* GNUNET_HELLO_UriCallback) (void *cls, const struct GNUNET_PeerIdentity *pid, const char *uri) |
Callback function used to extract URIs from a builder.
cls | closure |
uri | one of the URIs |
Definition at line 221 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 355 of file hello-uri.c.
References builder, GNUNET_new, and pid.
Referenced by GCH_get_mine(), GNUNET_HELLO_builder_from_block(), GNUNET_HELLO_builder_from_url(), and run().
const struct GNUNET_PeerIdentity* GNUNET_HELLO_builder_get_id | ( | const struct GNUNET_HELLO_Builder * | builder | ) |
Get the PeerIdentity for this builder.
Definition at line 366 of file hello-uri.c.
References builder.
Referenced by check_hello(), free_store_context(), and hosts_directory_scan_callback().
void GNUNET_HELLO_builder_free | ( | struct GNUNET_HELLO_Builder * | builder | ) |
Release resources of a builder.
[in] | builder | to free |
Definition at line 373 of file hello-uri.c.
References builder, GNUNET_assert, GNUNET_CONTAINER_DLL_remove, and GNUNET_free.
Referenced by consider_for_advertising(), dht_get_id_handler(), do_shutdown(), free_store_context(), GCH_get_mine(), GDS_NEIGHBOURS_handle_get(), GNUNET_HELLO_builder_from_block(), GNUNET_HELLO_builder_from_url(), got_hello(), handle_dht_local_hello_offer(), handle_hello(), handle_hello_for_client(), handle_hello_for_incoming(), hosts_directory_scan_callback(), peerinfo_cb(), run(), 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 391 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.
Referenced by check_hello(), consider_for_advertising(), dht_get_id_handler(), free_store_context(), got_hello(), handle_hello(), handle_hello_for_client(), handle_hello_for_incoming(), hosts_directory_scan_callback(), and peerinfo_cb().
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 414 of file hello-uri.c.
References end, BlockHeader::expiration_time, 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(), BlockHeader::pid, ret, BlockHeader::sig, 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 493 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(), pid, q, ret, uri, and verify_hello().
Referenced by handle_dht_local_hello_offer().
struct GNUNET_TIME_Absolute GNUNET_HELLO_builder_get_expiration_time | ( | const struct GNUNET_MessageHeader * | msg | ) |
Get the expiration time for this HELLO.
msg | The hello msg. |
Definition at line 414 of file hello-uri.c.
Referenced by announce_id(), consider_for_advertising(), consider_peer_destroy(), free_store_context(), GCP_set_hello(), got_hello(), hello_updated(), merge_uri(), and store_hello().
struct GNUNET_MQ_Envelope* GNUNET_HELLO_builder_to_env | ( | const struct GNUNET_HELLO_Builder * | builder, |
const struct GNUNET_CRYPTO_EddsaPrivateKey * | priv, | ||
struct GNUNET_TIME_Relative | expiration_time | ||
) |
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 631 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.
Referenced by run(), and store_pi().
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.
builder | builder to serialize |
priv | private key to use to sign the result |
Definition at line 666 of file hello-uri.c.
References builder, BlockHeader::expiration_time, DhtHelloMessage::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(), GCH_get_mine(), and got_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 717 of file hello-uri.c.
Referenced by check_dht_local_hello_offer(), and run().
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, | ||
struct GNUNET_TIME_Relative | expiration_time | ||
) |
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 717 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 717 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 add_to_builder(), GNUNET_HELLO_builder_from_block(), GNUNET_HELLO_builder_from_url(), store_pi(), 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 717 of file hello-uri.c.
Referenced by u_address_del().
const struct GNUNET_PeerIdentity* GNUNET_HELLO_builder_iterate | ( | const struct GNUNET_HELLO_Builder * | builder, |
GNUNET_HELLO_UriCallback | uc, | ||
void * | uc_cls | ||
) |
Iterate over URIs in a builder.
builder | builder to iterate over |
uc | callback invoked for each URI, can be NULL |
uc_cls | closure for addrgen |
Definition at line 909 of file hello-uri.c.
References builder, Address::next, uc, and Address::uri.
Referenced by consider_for_advertising(), GDS_NEIGHBOURS_handle_get(), handle_dht_local_hello_offer(), handle_hello_for_client(), handle_hello_for_incoming(), and peerinfo_cb().
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 909 of file hello-uri.c.
Referenced by announce_id(), and handle_dht_p2p_hello().
char* GNUNET_HELLO_address_to_prefix | ( | const char * | address | ) |
Given an address as a string, extract the prefix that identifies the communicator offering transmissions to that address.
address | a peer's address |
Definition at line 190 of file hello-ng.c.
References address, and GNUNET_strndup.
Referenced by GNUNET_TRANSPORT_TESTING_transport_communicator_open_queue(), store_pi(), and suggest_to_connect().
void GNUNET_HELLO_sign_address | ( | const char * | address, |
enum GNUNET_NetworkType | nt, | ||
struct GNUNET_TIME_Absolute | mono_time, | ||
const struct GNUNET_CRYPTO_EddsaPrivateKey * | private_key, | ||
void ** | result, | ||
size_t * | result_size | ||
) |
Build address record by signing raw information with private key.
address | text address to sign | |
nt | network type of address | |
mono_time | when was address valid | |
private_key | signing key to use | |
[out] | result | where to write address record (allocated) |
[out] | result_size | set to size of result |
address | text address at communicator to sign | |
nt | network type of address | |
mono_time | monotonic time at which address was valid | |
private_key | signing key to use | |
[out] | result | where to write address record (allocated) |
[out] | result_size | set to size of result |
Definition at line 66 of file hello-ng.c.
References GNUNET_TIME_Absolute::abs_value_us, SignedAddress::addr_hash, address, GNUNET_asprintf(), GNUNET_CRYPTO_eddsa_sign, GNUNET_CRYPTO_hash(), GNUNET_free, GNUNET_SIGNATURE_PURPOSE_TRANSPORT_ADDRESS, GNUNET_STRINGS_base64_encode(), GNUNET_TIME_absolute_hton(), SignedAddress::mono_time, nt, GNUNET_CRYPTO_EccSignaturePurpose::purpose, SignedAddress::purpose, result, and GNUNET_CRYPTO_EccSignaturePurpose::size.
Referenced by store_pi().