Manipulate GNS record data. More...
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_ReverseRecord |
Record type used internally to keep track of reverse mappings into a namespace. 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... | |
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_RELATIVE_EXPIRATION = 1 << (15 - 1) , GNUNET_GNSRECORD_RF_PRIVATE = 1 << (15 - 0) , 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_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 | |
struct GNUNET_JSON_Specification | GNUNET_GNSRECORD_JSON_spec_gnsrecord (struct GNUNET_GNSRECORD_Data **rd, unsigned int *rd_count, char **name) |
JSON Specification for GNS Records. More... | |
json_t * | GNUNET_GNSRECORD_JSON_from_gnsrecord (const char *rname, const struct GNUNET_GNSRECORD_Data *rd, unsigned int rd_count) |
Convert GNS record to JSON. More... | |
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_IDENTITY_PublicKey *z) |
Convert a zone to a string (for printing debug messages). More... | |
const char * | GNUNET_GNSRECORD_pkey_to_zkey (const struct GNUNET_IDENTITY_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_IDENTITY_PublicKey *pkey) |
Convert an absolute domain name to the respective public key. More... | |
void | GNUNET_GNSRECORD_query_from_private_key (const struct GNUNET_IDENTITY_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_IDENTITY_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_IDENTITY_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_IDENTITY_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_IDENTITY_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_IDENTITY_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_IDENTITY_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_IDENTITY_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_IDENTITY_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_IDENTITY_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... | |
Manipulate GNS record data.
#define GNUNET_GNS_EMPTY_LABEL_AT "@" |
String we use to indicate an empty label (top-level entry in the zone).
DNS uses "@", so do we.
Definition at line 55 of file gnunet_gnsrecord_lib.h.
#define GNUNET_GNSRECORD_MAX_BLOCK_SIZE (63 * 1024) |
Maximum size of a value that can be stored in a GNS block.
Definition at line 60 of file gnunet_gnsrecord_lib.h.
#define GNUNET_GNSRECORD_TYPE_ANY 0 |
Record type indicating any record/'*'.
Definition at line 66 of file gnunet_gnsrecord_lib.h.
#define GNUNET_GNSRECORD_RF_RCMP_FLAGS (GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION) |
Include the record types generated from GANA.
When comparing flags for record equality for removal, which flags should must match (in addition to the type, name, expiration value and data of the record)? All flags that are not listed here will be ignored for this purpose. (for example, we don't expect that users will remember to pass the '–private' option when removing a record from the namestore, hence we don't require this particular option to match upon removal). See also GNUNET_GNSRECORD_records_cmp.
Definition at line 84 of file gnunet_gnsrecord_lib.h.
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.
cls | closure |
rd_count | number of entries in rd array |
rd | array of records with data to store |
Definition at line 360 of file gnunet_gnsrecord_lib.h.
Flags that can be set for a record.
The numbers in the registry correspond to the bit index as specified in LSD0001 Chapter "Resource Records". Each enum member represents the 16-bit integer value of the flags field if only that particular flag was set. The value can be used to efficiently compare the bitmask setting for the record flag in C. WARNING: The values are in host byte order! In order to correctly check against the flags field a record, the respective fields must also be converted to HBO (or the enum value to NBO).
Enumerator | |
---|---|
GNUNET_GNSRECORD_RF_NONE | Entry for no flags / cleared flags. |
GNUNET_GNSRECORD_RF_CRITICAL | This record is critical. If it cannot be processed (for example because the record type is unknown) resolution MUST fail |
GNUNET_GNSRECORD_RF_SHADOW | This record should not be used unless all (other) records in the set with an absolute expiration time have expired. |
GNUNET_GNSRECORD_RF_SUPPLEMENTAL | This is a supplemental record. |
GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION | This expiration time of the record is a relative time (not an absolute time). Used in GNUnet implementation. |
GNUNET_GNSRECORD_RF_PRIVATE | This is a private record of this peer and it should thus not be published. |
GNUNET_GNSRECORD_RF_NONE | Entry for no flags / cleared flags. |
GNUNET_GNSRECORD_RF_CRITICAL | This record is critical. If it cannot be processed (for example because the record type is unknown) resolution MUST fail |
GNUNET_GNSRECORD_RF_SHADOW | This record should not be used unless all (other) records in the set with an absolute expiration time have expired. |
GNUNET_GNSRECORD_RF_SUPPLEMENTAL | This is a supplemental record. |
GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION | This expiration time of the record is a relative time (not an absolute time). Used in GNUnet implementation. |
GNUNET_GNSRECORD_RF_PRIVATE | This is a private record of this peer and it should thus not be published. |
Definition at line 99 of file gnunet_gnsrecord_lib.h.
Filter for GNUNET_GNSRECORD_normalize_record_set().
Definition at line 142 of file gnunet_gnsrecord_lib.h.
struct GNUNET_JSON_Specification GNUNET_GNSRECORD_JSON_spec_gnsrecord | ( | struct GNUNET_GNSRECORD_Data ** | rd, |
unsigned int * | rd_count, | ||
char ** | name | ||
) |
JSON Specification for GNS Records.
gnsrecord_object | struct of GNUNET_GNSRECORD_Data to fill |
Definition at line 258 of file json_gnsrecord.c.
Referenced by bulk_tx_start(), and namestore_add_or_update().
json_t* GNUNET_GNSRECORD_JSON_from_gnsrecord | ( | const char * | rname, |
const struct GNUNET_GNSRECORD_Data * | rd, | ||
unsigned int | rd_count | ||
) |
Convert GNS record to JSON.
rname | name of record |
rd | record data |
Definition at line 302 of file json_gnsrecord.c.
References data, data_size, GNUNET_break, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_GNSRECORD_number_to_typename(), GNUNET_GNSRECORD_RF_PRIVATE, GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION, GNUNET_GNSRECORD_RF_SHADOW, GNUNET_GNSRECORD_RF_SUPPLEMENTAL, GNUNET_GNSRECORD_value_to_string(), GNUNET_JSON_GNSRECORD_ABSOLUTE_EXPIRATION_TIME, GNUNET_JSON_GNSRECORD_FLAG_PRIVATE, GNUNET_JSON_GNSRECORD_FLAG_RELATIVE, GNUNET_JSON_GNSRECORD_FLAG_SUPPLEMENTAL, GNUNET_JSON_GNSRECORD_RELATIVE_EXPIRATION_TIME, GNUNET_JSON_GNSRECORD_TYPE, GNUNET_JSON_GNSRECORD_VALUE, GNUNET_log, rd, rd_count, record(), and records.
Referenced by handle_gns_response(), namestore_list_iteration(), and ns_get_lookup_cb().
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.
type | type of the record |
data | value in binary encoding |
data_size | number of bytes in data |
Convert the binary value data of a record of type type to a human-readable string.
type | type of the record |
data | value in binary encoding |
data_size | number of bytes in data |
Definition at line 155 of file gnsrecord.c.
References TestcasePlugin::api, data, data_size, gns_plugins, init(), num_plugins, plugin, ret, and type.
Referenced by check_pkey(), del_monitor(), display_record(), display_records_from_block(), gns_value_to_string(), GNUNET_GNSRECORD_JSON_from_gnsrecord(), GNUNET_GNSRECORD_records_deserialize(), GNUNET_GNSRECORD_records_get_size(), GNUNET_GNSRECORD_records_serialize(), process_lookup_result(), and start_phone().
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.
type | type of the record |
s | human-readable string |
data | set to value in binary encoding (will be allocated) |
data_size | set to number of bytes in data |
Definition at line 177 of file gnsrecord.c.
References TestcasePlugin::api, data, data_size, gns_plugins, GNUNET_OK, GNUNET_SYSERR, init(), num_plugins, plugin, and type.
Referenced by gns_string_to_value(), parse(), parse_record(), parse_recordline(), run(), run_with_zone_pkey(), and store_cb().
uint32_t GNUNET_GNSRECORD_typename_to_number | ( | const char * | dns_typename | ) |
Convert a type name (e.g.
"AAAA") to the corresponding number.
dns_typename | name to convert |
Definition at line 200 of file gnsrecord.c.
References TestcasePlugin::api, gns_plugins, GNUNET_GNSRECORD_TYPE_ANY, init(), num_plugins, plugin, and ret.
Referenced by del_monitor(), DID_create(), display_record(), get_gns_cont(), namestore_get(), parse(), parse_record(), parse_recordline(), run(), and run_with_zone_pkey().
const char* GNUNET_GNSRECORD_number_to_typename | ( | uint32_t | type | ) |
Convert a type number to the corresponding type string (e.g.
1 to "A")
type | number of a type to convert |
Definition at line 227 of file gnsrecord.c.
Referenced by display_record(), display_records_from_block(), GNUNET_GNSRECORD_JSON_from_gnsrecord(), parse_recordline(), process_lookup_result(), and run_with_zone_pkey().
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.
rd_count | number of records in the rd array |
rd | array of GNUNET_GNSRECORD_Data with rd_count elements |
Efficiently round up to the next power of 2 for padding https://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2
Definition at line 78 of file gnsrecord_serialization.c.
References data, data_size, GNUNET_GNSRECORD_Data::data_size, GNUNET_break, GNUNET_break_op, GNUNET_free, GNUNET_GNSRECORD_TYPE_EDKEY, GNUNET_GNSRECORD_TYPE_PKEY, GNUNET_GNSRECORD_value_to_string(), rd, rd_count, NetworkRecord::record_type, GNUNET_GNSRECORD_Data::record_type, and ret.
Referenced by block_create_ecdsa(), block_create_eddsa(), check_zone_to_name(), consistency_iter(), GNUNET_NAMESTORE_records_store2(), lookup_it(), result_processor(), run_edkey(), run_pkey(), rvk_ticket_update(), send_lookup_response(), send_lookup_response_with_filter(), and store_and_free_entries().
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.
rd_count | number of records in the rd array |
rd | array of GNUNET_GNSRECORD_Data with rd_count elements |
dest_size | size of the destination array dst |
dest | where to write the result |
Definition at line 136 of file gnsrecord_serialization.c.
References data, data_size, NetworkRecord::data_size, GNUNET_GNSRECORD_Data::data_size, warningfilter::dest, NetworkRecord::expiration_time, NetworkRecord::flags, GNUNET_break, GNUNET_break_op, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_GNSRECORD_value_to_string(), GNUNET_htonll(), GNUNET_memcpy, LOG, rd, rd_count, and NetworkRecord::record_type.
Referenced by check_zone_to_name(), consistency_iter(), GNUNET_NAMESTORE_records_store2(), lookup_it(), result_processor(), run_edkey(), run_pkey(), rvk_ticket_update(), send_lookup_response(), send_lookup_response_with_filter(), and store_and_free_entries().
unsigned int GNUNET_GNSRECORD_records_deserialize_get_size | ( | size_t | len, |
const char * | src | ||
) |
Definition at line 199 of file gnsrecord_serialization.c.
References NetworkRecord::data_size, GNUNET_break_op, GNUNET_memcmp, GNUNET_memcpy, len, and rd_count.
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.
len | size of the serialized record data |
src | the serialized record data |
rd_count | number of records in the dest array |
dest | where to put the data |
len | size of the serialized record data |
src | the serialized record data |
rd_count | number of records parsed |
dest | where to put the data |
Definition at line 244 of file gnsrecord_serialization.c.
References data, data_size, NetworkRecord::data_size, warningfilter::dest, NetworkRecord::expiration_time, NetworkRecord::flags, GNUNET_break_op, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_GNSRECORD_value_to_string(), GNUNET_memcpy, GNUNET_ntohll(), GNUNET_OK, GNUNET_SYSERR, len, LOG, rd_count, and NetworkRecord::record_type.
Referenced by check_rd(), check_result(), continue_store_activity(), database_setup(), handle_lookup_result(), handle_record_result(), handle_result(), handle_zone_to_name_response(), lookup_records(), process_tickets(), update_tickets(), and vpn_allocation_cb().
int GNUNET_GNSRECORD_is_expired | ( | const struct GNUNET_GNSRECORD_Data * | rd | ) |
Test if a given record is expired.
rd | record to test |
Definition at line 209 of file gnsrecord_misc.c.
References GNUNET_TIME_Absolute::abs_value_us, GNUNET_GNSRECORD_Data::expiration_time, GNUNET_GNSRECORD_Data::flags, GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION, GNUNET_NO, GNUNET_TIME_absolute_get_remaining(), GNUNET_YES, and rd.
char* GNUNET_GNSRECORD_string_normalize | ( | const char * | src | ) |
Normalize a UTF-8 string to a GNS name.
src | source string |
Definition at line 40 of file gnsrecord_misc.c.
Referenced by continue_store_activity(), GNUNET_GNSRECORD_query_from_private_key(), handle_record_lookup(), run_edkey(), and run_pkey().
const char* GNUNET_GNSRECORD_z2s | ( | const struct GNUNET_IDENTITY_PublicKey * | z | ) |
Convert a zone to a string (for printing debug messages).
This is one of the very few calls in the entire API that is NOT reentrant!
z | public key of a zone |
Definition at line 65 of file gnsrecord_misc.c.
Referenced by get_nick_record(), handle_gns_resolution_result(), handle_namecache_block_response(), handle_revocation_result(), namestore_flat_zone_to_name(), recursive_gns_resolution_namecache(), and recursive_gns_resolution_revocation().
const char* GNUNET_GNSRECORD_pkey_to_zkey | ( | const struct GNUNET_IDENTITY_PublicKey * | pkey | ) |
Convert public key to the respective absolute domain name in the ".zkey" pTLD.
This is one of the very few calls in the entire API that is NOT reentrant!
pkey | a public key with a point on the eliptic curve |
This is one of the very few calls in the entire API that is NOT reentrant!
pkey | a public key with a point on the eliptic curve |
Definition at line 232 of file gnsrecord_misc.c.
References GNUNET_free, GNUNET_IDENTITY_public_key_to_string(), GNUNET_snprintf(), pkey, and ret.
Referenced by caller_event_handler(), do_accept(), do_call(), do_resume(), do_status(), handle_phone_hangup(), phone_event_handler(), and translate_dot_plus().
int GNUNET_GNSRECORD_zkey_to_pkey | ( | const char * | zkey, |
struct GNUNET_IDENTITY_PublicKey * | pkey | ||
) |
Convert an absolute domain name to the respective public key.
zkey | string "X" where X is the public key in an encoding suitable for DNS labels. |
pkey | set to a public key on the eliptic curve |
zkey | string encoding the coordinates of the public key in an encoding suitable for DNS labels. |
pkey | set to a public key on the eliptic curve |
Definition at line 257 of file gnsrecord_misc.c.
Referenced by GNS_find_tld(), handle_gns_redirect_result(), and recursive_gns2dns_resolution().
void GNUNET_GNSRECORD_query_from_private_key | ( | const struct GNUNET_IDENTITY_PrivateKey * | zone, |
const char * | label, | ||
struct GNUNET_HashCode * | query | ||
) |
Calculate the DHT query for a given label in a given zone.
zone | private key of the zone |
label | label of the record |
query | hash to use for the query |
Definition at line 1024 of file gnsrecord_crypto.c.
References GNUNET_assert, GNUNET_free, GNUNET_GNSRECORD_query_from_public_key(), GNUNET_GNSRECORD_string_normalize(), GNUNET_GNSRECORD_TYPE_EDKEY, GNUNET_GNSRECORD_TYPE_PKEY, GNUNET_IDENTITY_key_get_public(), pub, and zone.
Referenced by initiate_put_from_pipe_trigger().
void GNUNET_GNSRECORD_query_from_public_key | ( | const struct GNUNET_IDENTITY_PublicKey * | pub, |
const char * | label, | ||
struct GNUNET_HashCode * | query | ||
) |
Calculate the DHT query for a given label in a given zone.
FIXME: We may want to plugin-ize this at some point.
pub | public key of the zone |
label | label of the record |
query | hash to use for the query |
Definition at line 1052 of file gnsrecord_crypto.c.
Referenced by GNUNET_GNSRECORD_query_from_private_key(), handle_namecache_block_response(), recursive_gns_resolution_namecache(), run(), run_edkey(), and run_pkey().
ssize_t GNUNET_GNSRECORD_block_calculate_size | ( | const struct GNUNET_IDENTITY_PrivateKey * | key, |
const struct GNUNET_GNSRECORD_Data * | rd, | ||
unsigned int | rd_count | ||
) |
Get size of buffer for block creation.
key | the zone key |
rd | record data |
rd_count | number of records |
Definition at line 512 of file gnsrecord_crypto.c.
enum GNUNET_GenericReturnValue GNUNET_GNSRECORD_block_sign | ( | const struct GNUNET_IDENTITY_PrivateKey * | key, |
const char * | label, | ||
struct GNUNET_GNSRECORD_Block * | block | ||
) |
Sign a block create with GNUNET_GNSRECORD_block_create_unsigned.
key | the private key |
label | the label of the block |
block | the unsigned block |
Definition at line 186 of file gnsrecord_crypto.c.
Referenced by sign_worker().
enum GNUNET_GenericReturnValue GNUNET_GNSRECORD_block_create | ( | const struct GNUNET_IDENTITY_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.
key | the private key |
expire | block expiration |
label | the name for the records |
rd | record data |
rd_count | number of records in rd |
result | the block buffer. Will be allocated. |
Definition at line 512 of file gnsrecord_crypto.c.
Referenced by run_edkey(), and run_pkey().
enum GNUNET_GenericReturnValue GNUNET_GNSRECORD_block_create_unsigned | ( | const struct GNUNET_IDENTITY_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().
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).
key | the private key |
expire | block expiration |
label | the name for the records |
rd | record data |
rd_count | number of records in rd |
result | the block buffer. Will be allocated. |
Definition at line 512 of file gnsrecord_crypto.c.
Referenced by dispatch_job(), and dispatch_job_monitor().
enum GNUNET_GenericReturnValue GNUNET_GNSRECORD_block_create2 | ( | const struct GNUNET_IDENTITY_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).
key | the private key |
expire | block expiration |
label | the name for the records |
rd | record data |
rd_count | number of records in rd |
result | the block buffer. Will be allocated. |
Definition at line 512 of file gnsrecord_crypto.c.
enum GNUNET_GenericReturnValue GNUNET_GNSRECORD_block_verify | ( | const struct GNUNET_GNSRECORD_Block * | block | ) |
Check if a signature is valid.
This API is used by the GNS Block to validate signatures received from the network.
block | block to verify |
Definition at line 512 of file gnsrecord_crypto.c.
Referenced by handle_lookup_block_response().
enum GNUNET_GenericReturnValue GNUNET_GNSRECORD_block_decrypt | ( | const struct GNUNET_GNSRECORD_Block * | block, |
const struct GNUNET_IDENTITY_PublicKey * | zone_key, | ||
const char * | label, | ||
GNUNET_GNSRECORD_RecordCallback | proc, | ||
void * | proc_cls | ||
) |
Decrypt block.
block | block to decrypt |
zone_key | public key of the zone |
label | the name for the records |
proc | function to call with the result |
proc_cls | closure for proc |
Definition at line 512 of file gnsrecord_crypto.c.
Referenced by handle_block(), handle_dht_response(), and handle_namecache_block_response().
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.
a | a record |
b | another record |
Compares if two records are equal.
absolute expiration time).
a | record |
b | record |
Definition at line 65 of file gnsrecord_misc.c.
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.
The block expiration time is the expiration time of the record with smallest expiration time.
rd_count | number of records given in rd |
rd | array of records |
min | minimum expiration time |
Definition at line 65 of file gnsrecord_misc.c.
References buf, end, GNUNET_break, and GNUNET_STRINGS_data_to_string().
Referenced by run_edkey(), and run_pkey().
size_t GNUNET_GNSRECORD_block_get_size | ( | const struct GNUNET_GNSRECORD_Block * | block | ) |
Returns the length of this block in bytes.
Block length strongly depends on the zone type.
block | the block. |
Definition at line 331 of file gnsrecord_misc.c.
Referenced by dispatch_job(), dispatch_job_monitor(), GNUNET_NAMECACHE_block_cache(), handle_dht_response(), handle_lookup_block_it(), namecache_cache_block(), namecache_sqlite_cache_block(), and store_and_free_entries().
struct GNUNET_TIME_Absolute GNUNET_GNSRECORD_block_get_expiration | ( | const struct GNUNET_GNSRECORD_Block * | block | ) |
Returns the expiration of a block.
block | the block. |
Definition at line 331 of file gnsrecord_misc.c.
References GNUNET_GNSRECORD_Block::size.
Referenced by expire_blocks(), handle_dht_response(), handle_lookup_block_it(), handle_namecache_block_response(), and namecache_sqlite_cache_block().
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.
block | the block. |
query | where to write the query hash. |
Definition at line 331 of file gnsrecord_misc.c.
Referenced by namecache_cache_block(), and namecache_sqlite_cache_block().
enum GNUNET_GenericReturnValue GNUNET_GNSRECORD_identity_from_data | ( | const char * | data, |
size_t | data_size, | ||
uint32_t | type, | ||
struct GNUNET_IDENTITY_PublicKey * | key | ||
) |
Build a #GNUNET_GNSRECORD_PublicKey from zone delegation resource record data.
data | the record data- |
data_size | the data size. |
type | the record type |
key | the identity key to store the data in (must be allocated). |
Definition at line 257 of file gnsrecord_misc.c.
Referenced by check_pkey(), gns_value_to_string(), handle_gns_resolution_result(), and recursive_pkey_resolution().
enum GNUNET_GenericReturnValue GNUNET_GNSRECORD_data_from_identity | ( | const struct GNUNET_IDENTITY_PublicKey * | key, |
char ** | data, | ||
size_t * | data_size, | ||
uint32_t * | type | ||
) |
Create record data and size from an identity key.
key | the identity key to use. |
data | the record data (will be allocated) |
data_size | the allocated data size. |
type | the resulting record type |
Definition at line 257 of file gnsrecord_misc.c.
References GNUNET_IDENTITY_public_key_from_string(), GNUNET_OK, GNUNET_SYSERR, and pkey.
Referenced by gns_string_to_value(), and register_do_cb().
enum GNUNET_GenericReturnValue GNUNET_GNSRECORD_is_zonekey_type | ( | uint32_t | type | ) |
Check if this type is one of the supported GNS zone types.
type | the type to check |
Definition at line 257 of file gnsrecord_misc.c.
Referenced by zone_to_name().
enum GNUNET_GenericReturnValue GNUNET_GNSRECORD_is_critical | ( | uint32_t | type | ) |
Check if this type is a critical record.
type | the type to check |
Definition at line 227 of file gnsrecord.c.
References TestcasePlugin::api, gns_plugins, GNUNET_GNSRECORD_TYPE_ANY, init(), num_plugins, plugin, ret, and type.
Referenced by handle_gns_resolution_result().
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.
Purge expired records. Returns a "clean" record set. Also returns the minimum expiration time this block should be published under. Also checks rules with respect to labels (e.g. no delegations under the empty label)
label | the label under which this set (supposed to be) stored. |
rd | input records |
rd_count | size of the rd and rd_public arrays |
rd_public | where to write the converted records |
rd_count_public | number of records written to rd_public |
min_expiry | the minimum expiration of this set |
filter | the record set filter, see GNUNET_GNSRECORD_Filter. |
emsg | the error message if something went wrong |
Check for delegation and redirect consistency. Note that we check for consistency BEFORE we filter for private records ON PURPOSE. We also want consistent record sets in our local zone(s). The only exception is the tombstone (above) which we ignore for the consistency check(s). FIXME: What about shadow records? Should we ignore them?
Definition at line 331 of file gnsrecord_misc.c.
Referenced by dispatch_job(), dispatch_job_monitor(), get_existing_rd_exp(), lookup_it(), and send_lookup_response_with_filter().
enum GNUNET_GenericReturnValue GNUNET_GNSRECORD_label_check | ( | const char * | label, |
char ** | emsg | ||
) |
Check label for invalid characters.
label | the label to check |
emsg | an error message (NULL if label is valid). Will be allocated. |
Definition at line 40 of file gnsrecord_misc.c.
References GNUNET_STRINGS_utf8_normalize().