GNUnet  0.19.5
gnunet_hello_lib.h File Reference

Helper library for handling HELLOs. More...

#include "gnunet_util_lib.h"
#include "gnunet_nt_lib.h"
Include dependency graph for gnunet_hello_lib.h:

Go to the source code of this file.

Data Structures

struct  GNUNET_HELLO_Address
 An address for communicating with a peer. More...
 
struct  GNUNET_HELLO_Message
 A HELLO message is used to exchange information about transports with other peers. More...
 

Macros

#define GNUNET_HELLO_URI_PREFIX   "gnunet://hello/"
 Prefix that every HELLO URI must start with. More...
 
#define GNUNET_FRIEND_HELLO_URI_PREFIX   "gnunet://friend-hello/"
 Prefix that every FRIEND HELLO URI must start with. More...
 
#define GNUNET_HELLO_URI_SEP   '+'
 Separator used in HELLO URI. More...
 
#define GNUNET_HELLO_address_free(addr)   GNUNET_free (addr)
 Free an address. More...
 

Typedefs

typedef ssize_t(* GNUNET_HELLO_GenerateAddressListCallback) (void *cls, size_t max, void *buf)
 Callback function used to fill a buffer of max bytes with a list of addresses in the format used by HELLOs. More...
 
typedef int(* GNUNET_HELLO_AddressIterator) (void *cls, const struct GNUNET_HELLO_Address *address, struct GNUNET_TIME_Absolute expiration)
 Iterator callback to go over all addresses. More...
 
typedef struct GNUNET_TRANSPORT_PluginFunctions *(* GNUNET_HELLO_TransportPluginsFind) (const char *name)
 Helper function to load/access transport plugins. More...
 

Enumerations

enum  GNUNET_HELLO_AddressInfo { GNUNET_HELLO_ADDRESS_INFO_NONE = 0 , GNUNET_HELLO_ADDRESS_INFO_INBOUND = 1 }
 Additional local information about an address. More...
 

Functions

struct GNUNET_HELLO_AddressGNUNET_HELLO_address_allocate (const struct GNUNET_PeerIdentity *peer, const char *transport_name, const void *address, size_t address_length, enum GNUNET_HELLO_AddressInfo local_info)
 Allocate an address struct. More...
 
struct GNUNET_HELLO_AddressGNUNET_HELLO_address_copy (const struct GNUNET_HELLO_Address *address)
 Copy an address struct. More...
 
int GNUNET_HELLO_address_cmp (const struct GNUNET_HELLO_Address *a1, const struct GNUNET_HELLO_Address *a2)
 Compare two addresses. More...
 
size_t GNUNET_HELLO_address_get_size (const struct GNUNET_HELLO_Address *address)
 Get the size of an address struct. More...
 
int GNUNET_HELLO_address_check_option (const struct GNUNET_HELLO_Address *address, enum GNUNET_HELLO_AddressInfo option)
 Check if an address has a local option set. More...
 
int GNUNET_HELLO_is_friend_only (const struct GNUNET_HELLO_Message *h)
 Return HELLO type. More...
 
size_t GNUNET_HELLO_add_address (const struct GNUNET_HELLO_Address *address, struct GNUNET_TIME_Absolute expiration, char *target, size_t max)
 Copy the given address information into the given buffer using the format of HELLOs. More...
 
struct GNUNET_HELLO_MessageGNUNET_HELLO_create (const struct GNUNET_CRYPTO_EddsaPublicKey *public_key, GNUNET_HELLO_GenerateAddressListCallback addrgen, void *addrgen_cls, int friend_only)
 Construct a HELLO message given the public key, expiration time and an iterator that spews the transport addresses. More...
 
uint16_t GNUNET_HELLO_size (const struct GNUNET_HELLO_Message *hello)
 Return the size of the given HELLO message. More...
 
struct GNUNET_HELLO_MessageGNUNET_HELLO_merge (const struct GNUNET_HELLO_Message *h1, const struct GNUNET_HELLO_Message *h2)
 Construct a HELLO message by merging the addresses in two existing HELLOs (which must be for the same peer). More...
 
struct GNUNET_TIME_Absolute GNUNET_HELLO_equals (const struct GNUNET_HELLO_Message *h1, const struct GNUNET_HELLO_Message *h2, struct GNUNET_TIME_Absolute now)
 Test if two HELLO messages contain the same addresses. More...
 
struct GNUNET_TIME_Absolute GNUNET_HELLO_get_last_expiration (const struct GNUNET_HELLO_Message *msg)
 When does the last address in the given HELLO expire? More...
 
struct GNUNET_HELLO_MessageGNUNET_HELLO_iterate_addresses (const struct GNUNET_HELLO_Message *msg, int return_modified, GNUNET_HELLO_AddressIterator it, void *it_cls)
 Iterate over all of the addresses in the HELLO. More...
 
void GNUNET_HELLO_iterate_new_addresses (const struct GNUNET_HELLO_Message *new_hello, const struct GNUNET_HELLO_Message *old_hello, struct GNUNET_TIME_Absolute expiration_limit, GNUNET_HELLO_AddressIterator it, void *it_cls)
 Iterate over addresses in new_hello that are NOT already present in old_hello. More...
 
int GNUNET_HELLO_get_id (const struct GNUNET_HELLO_Message *hello, struct GNUNET_PeerIdentity *peer)
 Get the peer identity from a HELLO message. More...
 
struct GNUNET_MessageHeaderGNUNET_HELLO_get_header (struct GNUNET_HELLO_Message *hello)
 Get the header from a HELLO message, used so other code can correctly send HELLO messages. More...
 
char * GNUNET_HELLO_compose_uri (const struct GNUNET_HELLO_Message *hello, GNUNET_HELLO_TransportPluginsFind plugins_find)
 Compose a hello URI string from a hello message. More...
 
int GNUNET_HELLO_parse_uri (const char *uri, struct GNUNET_CRYPTO_EddsaPublicKey *pubkey, struct GNUNET_HELLO_Message **hello, GNUNET_HELLO_TransportPluginsFind plugins_find)
 Parse a hello URI string to a hello message. 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...
 
char * GNUNET_HELLO_extract_address (const void *raw, size_t raw_size, const struct GNUNET_PeerIdentity *pid, enum GNUNET_NetworkType *nt, struct GNUNET_TIME_Absolute *mono_time)
 Check signature and extract address record. 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...
 

Detailed Description

Helper library for handling HELLOs.

Definition in file gnunet_hello_lib.h.