GNUnet 0.21.1
gnunet_gnsrecord_lib.h File Reference

API that can be used to manipulate GNS record data. More...

#include "gnunet_common.h"
#include "gnunet_identity_service.h"
#include "gnu_name_system_record_types.h"
Include dependency graph for gnunet_gnsrecord_lib.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  GNUNET_GNSRECORD_Data
 A GNS record. More...
 
struct  GNUNET_GNSRECORD_PlaceData
 Data stored in a PLACE record. More...
 
struct  GNUNET_GNSRECORD_EcdsaBlock
 Information we have in an encrypted block with record data (i.e. More...
 
struct  GNUNET_GNSRECORD_EddsaBlock
 Information we have in an encrypted block with record data (i.e. More...
 
struct  GNUNET_GNSRECORD_Block
 
struct  GNUNET_GNSRECORD_BoxRecord
 Record type used to box up SRV and TLSA records. More...
 
struct  GNUNET_GNSRECORD_SBoxRecord
 Record type used to box up SMIMEA records. More...
 
struct  GNUNET_GNSRECORD_ReverseRecord
 Record type used internally to keep track of reverse mappings into a namespace. More...
 
struct  GNUNET_GNSRECORD_PowP
 Struct for a proof of work as part of the revocation. More...
 
struct  GNUNET_GNSRECORD_SignaturePurposePS
 The signature object we use for the PoW. More...
 

Macros

#define GNUNET_GNS_EMPTY_LABEL_AT   "@"
 String we use to indicate an empty label (top-level entry in the zone). More...
 
#define GNUNET_GNSRECORD_MAX_BLOCK_SIZE   (63 * 1024)
 Maximum size of a value that can be stored in a GNS block. More...
 
#define GNUNET_GNSRECORD_TYPE_ANY   0
 Record type indicating any record/'*'. More...
 
#define GNUNET_GNSRECORD_RF_RCMP_FLAGS   (GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION)
 Include the record types generated from GANA. More...
 
#define GNUNET_MAX_POW_SIZE
 Maximum length of a revocation. More...
 
#define POW_COUNT   32
 The proof-of-work narrowing factor. More...
 

Typedefs

typedef void(* GNUNET_GNSRECORD_RecordCallback) (void *cls, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd)
 Process a records that were decrypted from a block. More...
 

Enumerations

enum  GNUNET_GNSRECORD_Flags {
  GNUNET_GNSRECORD_RF_NONE = 0 , GNUNET_GNSRECORD_RF_CRITICAL = 1 << (15 - 15) , GNUNET_GNSRECORD_RF_SHADOW = 1 << (15 - 14) , GNUNET_GNSRECORD_RF_SUPPLEMENTAL = 1 << (15 - 13) ,
  GNUNET_GNSRECORD_RF_MAINTENANCE = 1 << (15 - 2) , GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION = 1 << (15 - 1) , GNUNET_GNSRECORD_RF_PRIVATE = 1 << (15 - 0)
}
 Flags that can be set for a record. More...
 
enum  GNUNET_GNSRECORD_Filter { GNUNET_GNSRECORD_FILTER_NONE = 0 , GNUNET_GNSRECORD_FILTER_INCLUDE_MAINTENANCE = 1 , GNUNET_GNSRECORD_FILTER_OMIT_PRIVATE = 2 }
 Filter for GNUNET_GNSRECORD_normalize_record_set(). More...
 

Functions

char * GNUNET_GNSRECORD_value_to_string (uint32_t type, const void *data, size_t data_size)
 Convert the binary value data of a record of type type to a human-readable string. More...
 
int GNUNET_GNSRECORD_string_to_value (uint32_t type, const char *s, void **data, size_t *data_size)
 Convert human-readable version of the value s of a record of type type to the respective binary representation. More...
 
uint32_t GNUNET_GNSRECORD_typename_to_number (const char *dns_typename)
 Convert a type name (e.g. More...
 
const char * GNUNET_GNSRECORD_number_to_typename (uint32_t type)
 Convert a type number to the corresponding type string (e.g. More...
 
ssize_t GNUNET_GNSRECORD_records_get_size (unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd)
 Calculate how many bytes we will need to serialize the given records. More...
 
ssize_t GNUNET_GNSRECORD_records_serialize (unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd, size_t dest_size, char *dest)
 Serialize the given records to the given destination buffer. More...
 
unsigned int GNUNET_GNSRECORD_records_deserialize_get_size (size_t len, const char *src)
 
int GNUNET_GNSRECORD_records_deserialize (size_t len, const char *src, unsigned int rd_count, struct GNUNET_GNSRECORD_Data *dest)
 Deserialize the given records to the given destination. More...
 
int GNUNET_GNSRECORD_is_expired (const struct GNUNET_GNSRECORD_Data *rd)
 Test if a given record is expired. More...
 
char * GNUNET_GNSRECORD_string_normalize (const char *src)
 Normalize a UTF-8 string to a GNS name. More...
 
const char * GNUNET_GNSRECORD_z2s (const struct GNUNET_CRYPTO_PublicKey *z)
 Convert a zone to a string (for printing debug messages). More...
 
const char * GNUNET_GNSRECORD_pkey_to_zkey (const struct GNUNET_CRYPTO_PublicKey *pkey)
 Convert public key to the respective absolute domain name in the ".zkey" pTLD. More...
 
int GNUNET_GNSRECORD_zkey_to_pkey (const char *zkey, struct GNUNET_CRYPTO_PublicKey *pkey)
 Convert an absolute domain name to the respective public key. More...
 
void GNUNET_GNSRECORD_query_from_private_key (const struct GNUNET_CRYPTO_PrivateKey *zone, const char *label, struct GNUNET_HashCode *query)
 Calculate the DHT query for a given label in a given zone. More...
 
void GNUNET_GNSRECORD_query_from_public_key (const struct GNUNET_CRYPTO_PublicKey *pub, const char *label, struct GNUNET_HashCode *query)
 Calculate the DHT query for a given label in a given zone. More...
 
ssize_t GNUNET_GNSRECORD_block_calculate_size (const struct GNUNET_CRYPTO_PrivateKey *key, const struct GNUNET_GNSRECORD_Data *rd, unsigned int rd_count)
 Get size of buffer for block creation. More...
 
enum GNUNET_GenericReturnValue GNUNET_GNSRECORD_block_sign (const struct GNUNET_CRYPTO_PrivateKey *key, const char *label, struct GNUNET_GNSRECORD_Block *block)
 Sign a block create with GNUNET_GNSRECORD_block_create_unsigned. More...
 
enum GNUNET_GenericReturnValue GNUNET_GNSRECORD_block_create (const struct GNUNET_CRYPTO_PrivateKey *key, struct GNUNET_TIME_Absolute expire, const char *label, const struct GNUNET_GNSRECORD_Data *rd, unsigned int rd_count, struct GNUNET_GNSRECORD_Block **block)
 Sign name and records. More...
 
enum GNUNET_GenericReturnValue GNUNET_GNSRECORD_block_create_unsigned (const struct GNUNET_CRYPTO_PrivateKey *key, struct GNUNET_TIME_Absolute expire, const char *label, const struct GNUNET_GNSRECORD_Data *rd, unsigned int rd_count, struct GNUNET_GNSRECORD_Block **result)
 Create name and records but do not sign! Sign later with GNUNET_GNSRECORD_block_sign(). More...
 
enum GNUNET_GenericReturnValue GNUNET_GNSRECORD_block_create2 (const struct GNUNET_CRYPTO_PrivateKey *key, struct GNUNET_TIME_Absolute expire, const char *label, const struct GNUNET_GNSRECORD_Data *rd, unsigned int rd_count, struct GNUNET_GNSRECORD_Block **result)
 Sign name and records, cache derived public key (also keeps the private key in static memory, so do not use this function if keeping the private key in the process'es RAM is a major issue). More...
 
enum GNUNET_GenericReturnValue GNUNET_GNSRECORD_block_verify (const struct GNUNET_GNSRECORD_Block *block)
 Check if a signature is valid. More...
 
enum GNUNET_GenericReturnValue GNUNET_GNSRECORD_block_decrypt (const struct GNUNET_GNSRECORD_Block *block, const struct GNUNET_CRYPTO_PublicKey *zone_key, const char *label, GNUNET_GNSRECORD_RecordCallback proc, void *proc_cls)
 Decrypt block. More...
 
enum GNUNET_GenericReturnValue GNUNET_GNSRECORD_records_cmp (const struct GNUNET_GNSRECORD_Data *a, const struct GNUNET_GNSRECORD_Data *b)
 Compares if two records are equal. More...
 
struct GNUNET_TIME_Absolute GNUNET_GNSRECORD_record_get_expiration_time (unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd, struct GNUNET_TIME_Absolute min)
 Returns the expiration time of the given block of records. More...
 
size_t GNUNET_GNSRECORD_block_get_size (const struct GNUNET_GNSRECORD_Block *block)
 Returns the length of this block in bytes. More...
 
struct GNUNET_TIME_Absolute GNUNET_GNSRECORD_block_get_expiration (const struct GNUNET_GNSRECORD_Block *block)
 Returns the expiration of a block. More...
 
enum GNUNET_GenericReturnValue GNUNET_GNSRECORD_query_from_block (const struct GNUNET_GNSRECORD_Block *block, struct GNUNET_HashCode *query)
 Builds the query hash from a block. More...
 
enum GNUNET_GenericReturnValue GNUNET_GNSRECORD_identity_from_data (const char *data, size_t data_size, uint32_t type, struct GNUNET_CRYPTO_PublicKey *key)
 Build a #GNUNET_GNSRECORD_PublicKey from zone delegation resource record data. More...
 
enum GNUNET_GenericReturnValue GNUNET_GNSRECORD_data_from_identity (const struct GNUNET_CRYPTO_PublicKey *key, char **data, size_t *data_size, uint32_t *type)
 Create record data and size from an identity key. More...
 
enum GNUNET_GenericReturnValue GNUNET_GNSRECORD_is_zonekey_type (uint32_t type)
 Check if this type is one of the supported GNS zone types. More...
 
enum GNUNET_GenericReturnValue GNUNET_GNSRECORD_is_critical (uint32_t type)
 Check if this type is a critical record. More...
 
enum GNUNET_GenericReturnValue GNUNET_GNSRECORD_normalize_record_set (const char *label, const struct GNUNET_GNSRECORD_Data *rd, unsigned int rd_count, struct GNUNET_GNSRECORD_Data *rd_public, unsigned int *rd_count_public, struct GNUNET_TIME_Absolute *min_expiry, enum GNUNET_GNSRECORD_Filter filter, char **emsg)
 Normalize namestore records: Check for consistency and expirations. More...
 
enum GNUNET_GenericReturnValue GNUNET_GNSRECORD_label_check (const char *label, char **emsg)
 Check label for invalid characters. More...
 
enum GNUNET_GenericReturnValue GNUNET_GNSRECORD_check_pow (const struct GNUNET_GNSRECORD_PowP *pow, unsigned int matching_bits, struct GNUNET_TIME_Relative epoch_duration)
 Check if the given proof-of-work is valid. More...
 
void GNUNET_GNSRECORD_pow_init (const struct GNUNET_CRYPTO_PrivateKey *key, struct GNUNET_GNSRECORD_PowP *pow)
 Initializes a fresh PoW computation. More...
 
struct GNUNET_GNSRECORD_PowCalculationHandleGNUNET_GNSRECORD_pow_start (struct GNUNET_GNSRECORD_PowP *pow, int epochs, unsigned int difficulty)
 Starts a proof-of-work calculation given the pow object as well as target epochs and difficulty. More...
 
enum GNUNET_GenericReturnValue GNUNET_GNSRECORD_pow_round (struct GNUNET_GNSRECORD_PowCalculationHandle *pc)
 Calculate a single round in the key revocation PoW. More...
 
size_t GNUNET_GNSRECORD_proof_get_size (const struct GNUNET_GNSRECORD_PowP *pow)
 
void GNUNET_GNSRECORD_pow_stop (struct GNUNET_GNSRECORD_PowCalculationHandle *pc)
 Stop a PoW calculation. More...
 

Detailed Description

API that can be used to manipulate GNS record data.

Definition in file gnunet_gnsrecord_lib.h.