helper library for handling URI-based HELLOs More...
#include "platform.h"#include "gnunet_util_lib.h"#include "gnunet_signatures.h"#include "gnunet_hello_uri_lib.h"#include "gnunet_protocols.h"Go to the source code of this file.
Data Structures | |
| struct | PilsHelloSignaturePurpose |
| Message signed as part of a HELLO block/URL. More... | |
| struct | HelloUriMessage |
| Message used when gossiping HELLOs between peers. More... | |
| struct | BlockHeader |
| Start of a 'block'. More... | |
| struct | DhtHelloMessage |
| Message used when a DHT provides its HELLO to direct neighbours. More... | |
| struct | Address |
| Address of a peer. More... | |
| struct | GNUNET_HELLO_Builder |
| Context for building (or parsing) HELLO URIs. More... | |
| struct | AddressUriMergeResult |
| Struct to wrap data to do the merge of to hello uris. More... | |
| struct | GNUNET_HELLO_Parser |
| Context for parsing HELLOs. More... | |
Functions | |
| static void | hash_addresses (const struct Address *addr_start, struct GNUNET_HashCode *hash) |
| static enum GNUNET_GenericReturnValue | verify_hello (const struct GNUNET_HELLO_Parser *parser, struct GNUNET_TIME_Absolute et, const struct GNUNET_CRYPTO_EddsaSignature *sig) |
| Verify HELLO signature. | |
| static struct GNUNET_HELLO_Parser * | parser_new (const struct GNUNET_PeerIdentity *pid) |
| struct GNUNET_HELLO_Builder * | GNUNET_HELLO_builder_new () |
| Allocate builder. | |
| const struct GNUNET_PeerIdentity * | GNUNET_HELLO_parser_get_id (const struct GNUNET_HELLO_Parser *parser) |
| Get the PeerIdentity for this builder. | |
| struct GNUNET_HELLO_Builder * | GNUNET_HELLO_builder_from_parser (const struct GNUNET_HELLO_Parser *p, struct GNUNET_PeerIdentity *pid) |
| Allocate builder from parser. | |
| void | GNUNET_HELLO_parser_free (struct GNUNET_HELLO_Parser *parser) |
| Release resources of a builder. | |
| void | GNUNET_HELLO_builder_free (struct GNUNET_HELLO_Builder *builder) |
| Release resources of a builder. | |
| struct GNUNET_HELLO_Parser * | GNUNET_HELLO_parser_from_msg (const struct GNUNET_MessageHeader *msg) |
| Parse msg. | |
| static enum GNUNET_GenericReturnValue | check_address (const char *address) |
| static int | cmp_address (void *cls, struct Address *a, struct Address *b) |
| Alphanumeric sorting for addresses. | |
| static enum GNUNET_GenericReturnValue | parser_add_address (struct GNUNET_HELLO_Parser *parser, const char *address) |
| struct GNUNET_HELLO_Parser * | GNUNET_HELLO_parser_from_block (const void *block, size_t block_size) |
| Parse block. | |
| struct GNUNET_HELLO_Parser * | GNUNET_HELLO_parser_from_block_ (const void *block, size_t block_size, int noverify) |
| Parse block. | |
| struct GNUNET_TIME_Absolute | GNUNET_HELLO_get_expiration_time_from_msg (const struct GNUNET_MessageHeader *msg) |
| Get the expiration time for this HELLO. | |
| enum GNUNET_GenericReturnValue | GNUNET_HELLO_builder_add_address (struct GNUNET_HELLO_Builder *builder, const char *address) |
| Add individual address to the builder. | |
| struct GNUNET_HELLO_Parser * | GNUNET_HELLO_parser_from_url (const char *url) |
| Parse GNUnet HELLO url. | |
| char * | GNUNET_HELLO_parser_to_url (const struct GNUNET_HELLO_Parser *parser) |
| Generate GNUnet HELLO URI from a parser. | |
| enum GNUNET_GenericReturnValue | GNUNET_HELLO_parser_to_block (const struct GNUNET_HELLO_Parser *parser, void *block, size_t *block_size) |
| Generate DHT block from a parser. | |
| struct GNUNET_MQ_Envelope * | GNUNET_HELLO_parser_to_env (const struct GNUNET_HELLO_Parser *parser) |
| Generate envelope with GNUnet HELLO message (including peer ID) from a parser. | |
| enum GNUNET_GenericReturnValue | GNUNET_HELLO_builder_del_address (struct GNUNET_HELLO_Builder *builder, const char *address) |
| Remove individual address from the builder. | |
| void | GNUNET_HELLO_builder_iterate (const struct GNUNET_HELLO_Builder *builder, GNUNET_HELLO_UriCallback uc, void *uc_cls) |
| Iterate over URIs in a builder. | |
| const struct GNUNET_PeerIdentity * | GNUNET_HELLO_parser_iterate (const struct GNUNET_HELLO_Parser *parser, GNUNET_HELLO_UriCallback uc, void *uc_cls) |
| Iterate over URIs in a parser. | |
| 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. | |
| 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. | |
| enum GNUNET_GenericReturnValue | GNUNET_HELLO_build_url (const struct GNUNET_HELLO_Builder *builder, const struct GNUNET_PeerIdentity *pid, const struct GNUNET_CRYPTO_EddsaSignature *sig, struct GNUNET_TIME_Absolute expiration, char **result) |
| void | GNUNET_HELLO_builder_hash_addresses (const struct GNUNET_HELLO_Builder *builder, struct GNUNET_HashCode *hash) |
| Compute hash over addresses in builder. | |
| struct GNUNET_MQ_Envelope * | GNUNET_HELLO_builder_to_env (const struct GNUNET_HELLO_Builder *builder, const struct GNUNET_PeerIdentity *pid, const struct GNUNET_CRYPTO_EddsaSignature *hello_sig, struct GNUNET_TIME_Absolute expiration_time) |
| Generate envelope with GNUnet HELLO message (including peer ID) from a builder. | |
| struct GNUNET_MessageHeader * | GNUNET_HELLO_parser_to_dht_hello_msg (const struct GNUNET_HELLO_Parser *parser) |
| Generate DHT HELLO message from a parser. | |
| struct GNUNET_MessageHeader * | GNUNET_HELLO_builder_to_dht_hello_msg (const struct GNUNET_HELLO_Builder *builder, const struct GNUNET_PeerIdentity *pid, const struct GNUNET_CRYPTO_EddsaSignature *hello_sig, struct GNUNET_TIME_Absolute expiration_time) |
| Generate DHT HELLO message (without peer ID) from a builder. | |
| void | GNUNET_HELLO_builder_to_block (const struct GNUNET_HELLO_Builder *builder, const struct GNUNET_PeerIdentity *pid, const struct GNUNET_CRYPTO_EddsaSignature *sig, struct GNUNET_TIME_Absolute expiration_time, char *block) |
| Generate DHT block from a builder. | |
| enum GNUNET_GenericReturnValue | GNUNET_HELLO_builder_to_url2 (const struct GNUNET_HELLO_Builder *builder, const struct GNUNET_PeerIdentity *pid, const struct GNUNET_CRYPTO_EddsaSignature *sig, struct GNUNET_TIME_Absolute validity, char **result) |
| Generate GNUnet HELLO URI from a builder. | |
| enum GNUNET_GenericReturnValue | GNUNET_HELLO_builder_to_url (const struct GNUNET_HELLO_Builder *builder, const struct GNUNET_PeerIdentity *pid, const struct GNUNET_CRYPTO_EddsaSignature *sig, char **result) |
| Generate GNUnet HELLO URI from a builder. | |
| size_t | GNUNET_HELLO_get_builder_to_block_size (const struct GNUNET_HELLO_Builder *builder) |
| Get projected block size for builder. | |
| enum GNUNET_GenericReturnValue | GNUNET_HELLO_builder_address_list_cmp (const struct GNUNET_HELLO_Builder *abuilder, const struct GNUNET_HELLO_Builder *bbuilder) |
| Compare address lists of two builders. | |
helper library for handling URI-based HELLOs
Note:
Definition in file hello-uri.c.
|
static |
Definition at line 266 of file hello-uri.c.
References GNUNET_CRYPTO_hash_context_finish(), GNUNET_CRYPTO_hash_context_read(), GNUNET_CRYPTO_hash_context_start(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, and Address::next.
Referenced by GNUNET_HELLO_builder_hash_addresses(), and verify_hello().
|
static |
Verify HELLO signature.
| builder | the builder to use |
| et | expiration time to verify |
| sig | signature to verify |
Definition at line 303 of file hello-uri.c.
References GNUNET_CRYPTO_eddsa_verify, GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_NO, GNUNET_OK, GNUNET_SIGNATURE_PURPOSE_HELLO, GNUNET_SYSERR, GNUNET_TIME_absolute_hton(), GNUNET_TIME_absolute_is_past(), PilsHelloSignaturePurpose::h_addrs, hash_addresses(), PilsHelloSignaturePurpose::purpose, and GNUNET_CRYPTO_SignaturePurpose::size.
Referenced by GNUNET_HELLO_dht_msg_to_block(), GNUNET_HELLO_parser_from_block_(), and GNUNET_HELLO_parser_from_url().
|
static |
Definition at line 332 of file hello-uri.c.
References GNUNET_new, p, GNUNET_OS_Process::pid, and pid.
Referenced by GNUNET_HELLO_parser_from_block_(), and GNUNET_HELLO_parser_from_url().
|
static |
Definition at line 438 of file hello-uri.c.
References address, GNUNET_break_op, GNUNET_ERROR_TYPE_ERROR, GNUNET_log, GNUNET_OK, GNUNET_SYSERR, and p.
Referenced by GNUNET_HELLO_builder_add_address(), and parser_add_address().
Alphanumeric sorting for addresses.
| cls | NULL |
| a | first address |
| b | address to compare first address with |
Definition at line 477 of file hello-uri.c.
References Address::uri.
Referenced by GNUNET_HELLO_builder_add_address(), and parser_add_address().
|
static |
Definition at line 484 of file hello-uri.c.
References address, check_address(), cmp_address(), GNUNET_CONTAINER_DLL_insert_sorted, GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_malloc, GNUNET_NO, GNUNET_OK, Address::next, ret, Address::uri, and Address::uri_len.
Referenced by GNUNET_HELLO_parser_from_block_(), and GNUNET_HELLO_parser_from_url().