![]() |
GNUnet
0.11.x
|
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_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_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_TYPE_PKEY GNUNET_IDENTITY_TYPE_ECDSA |
Record type for GNS zone transfer ("PKEY"). More... | |
#define | GNUNET_GNSRECORD_TYPE_NICK 65537 |
Record type for GNS nick names ("NICK"). More... | |
#define | GNUNET_GNSRECORD_TYPE_LEHO 65538 |
Record type for GNS legacy hostnames ("LEHO"). More... | |
#define | GNUNET_GNSRECORD_TYPE_VPN 65539 |
Record type for VPN resolution. More... | |
#define | GNUNET_GNSRECORD_TYPE_GNS2DNS 65540 |
Record type for delegation to DNS. More... | |
#define | GNUNET_GNSRECORD_TYPE_BOX 65541 |
Record type for a boxed record (see TLSA/SRV handling in GNS). More... | |
#define | GNUNET_GNSRECORD_TYPE_PLACE 65542 |
Record type for a social place. More... | |
#define | GNUNET_GNSRECORD_TYPE_PHONE 65543 |
Record type for a phone (of CONVERSATION). More... | |
#define | GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE 65544 |
Record type for identity attributes (of RECLAIM). More... | |
#define | GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET 65545 |
Record type for local ticket references. More... | |
#define | GNUNET_GNSRECORD_TYPE_DELEGATE 65548 |
65546 reserved More... | |
#define | GNUNET_GNSRECORD_TYPE_ATTRIBUTE 65549 |
Record type for reverse lookups. More... | |
#define | GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF 65550 |
Record type for reclaim records. More... | |
#define | GNUNET_GNSRECORD_TYPE_RECLAIM_MASTER 65551 |
Record type for RECLAIM master. More... | |
#define | GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_CLIENT 65552 |
Record type for reclaim OIDC clients. More... | |
#define | GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_REDIRECT 65553 |
Record type for reclaim OIDC redirect URIs. More... | |
#define | GNUNET_GNSRECORD_TYPE_RECLAIM_CREDENTIAL 65554 |
Record type for an attribute attestation. More... | |
#define | GNUNET_GNSRECORD_TYPE_RECLAIM_PRESENTATION 65555 |
Record type for a presentation of a credential (used in a ticket record set) More... | |
#define | GNUNET_GNSRECORD_TYPE_EDKEY GNUNET_IDENTITY_TYPE_EDDSA |
Record type for EDKEY delegations. 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_PRIVATE = 2, GNUNET_GNSRECORD_RF_SUPPLEMENTAL = 4, GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION = 8, GNUNET_GNSRECORD_RF_SHADOW_RECORD } |
Flags that can be set for a record. 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 (i.e. More... | |
const char * | GNUNET_GNSRECORD_number_to_typename (uint32_t type) |
Convert a type number (i.e. 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... | |
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_to_lowercase (const char *src) |
Convert a UTF-8 string to UTF-8 lowercase. 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... | |
struct GNUNET_GNSRECORD_Block * | 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) |
Sign name and records. More... | |
struct GNUNET_GNSRECORD_Block * | 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) |
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... | |
int | GNUNET_GNSRECORD_block_verify (const struct GNUNET_GNSRECORD_Block *block) |
Check if a signature is valid. More... | |
int | 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... | |
int | 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) |
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... | |
Manipulate GNS record data.
#define GNUNET_GNSRECORD_MAX_BLOCK_SIZE (63 * 1024) |
Maximum size of a value that can be stored in a GNS block.
Definition at line 49 of file gnunet_gnsrecord_lib.h.
Referenced by block_create_ecdsa().
#define GNUNET_GNSRECORD_TYPE_ANY 0 |
Record type indicating any record/'*'.
Definition at line 55 of file gnunet_gnsrecord_lib.h.
Referenced by del_monitor(), display_record(), get_gns_cont(), GNUNET_GNSRECORD_number_to_typename(), GNUNET_GNSRECORD_typename_to_number(), lookup_authz_cb(), namestore_get(), namestore_list_iteration(), ns_get_lookup_cb(), process_lookup_result(), process_queue(), recursive_gns2dns_resolution(), and run().
#define GNUNET_GNSRECORD_TYPE_PKEY GNUNET_IDENTITY_TYPE_ECDSA |
Record type for GNS zone transfer ("PKEY").
Definition at line 60 of file gnunet_gnsrecord_lib.h.
Referenced by block_create_ecdsa(), get_existing_record(), gns_string_to_value(), gns_value_to_string(), GNUNET_GNSRECORD_block_create(), GNUNET_GNSRECORD_block_get_expiration(), GNUNET_GNSRECORD_block_get_size(), GNUNET_GNSRECORD_block_verify(), GNUNET_GNSRECORD_is_zonekey_type(), GNUNET_GNSRECORD_query_from_block(), GNUNET_GNSRECORD_query_from_private_key(), GNUNET_GNSRECORD_query_from_public_key(), GNUNET_GNSRECORD_record_to_identity_key(), GNUNET_GNSRECORD_records_get_size(), handle_gns_resolution_result(), iterate_cb(), and run().
#define GNUNET_GNSRECORD_TYPE_NICK 65537 |
Record type for GNS nick names ("NICK").
Definition at line 65 of file gnunet_gnsrecord_lib.h.
Referenced by display_record(), gns_string_to_value(), gns_value_to_string(), handle_record_store(), lookup_nick_it(), and run_with_zone_pkey().
#define GNUNET_GNSRECORD_TYPE_LEHO 65538 |
Record type for GNS legacy hostnames ("LEHO").
Definition at line 70 of file gnunet_gnsrecord_lib.h.
Referenced by dns_result_parser(), gns_string_to_value(), gns_value_to_string(), handle_gns_result(), and transmit_lookup_dns_result().
#define GNUNET_GNSRECORD_TYPE_VPN 65539 |
Record type for VPN resolution.
Definition at line 75 of file gnunet_gnsrecord_lib.h.
Referenced by gns_string_to_value(), gns_value_to_string(), handle_gns_resolution_result(), handle_gns_result(), and vpn_allocation_cb().
#define GNUNET_GNSRECORD_TYPE_GNS2DNS 65540 |
Record type for delegation to DNS.
Definition at line 80 of file gnunet_gnsrecord_lib.h.
Referenced by check_for_glue(), get_existing_record(), gns_string_to_value(), gns_value_to_string(), handle_gns_resolution_result(), process_queue(), process_record(), and recursive_gns2dns_resolution().
#define GNUNET_GNSRECORD_TYPE_BOX 65541 |
Record type for a boxed record (see TLSA/SRV handling in GNS).
Definition at line 85 of file gnunet_gnsrecord_lib.h.
Referenced by gns_string_to_value(), gns_value_to_string(), handle_gns_resolution_result(), and handle_gns_result().
#define GNUNET_GNSRECORD_TYPE_PLACE 65542 |
Record type for a social place.
Definition at line 90 of file gnunet_gnsrecord_lib.h.
#define GNUNET_GNSRECORD_TYPE_PHONE 65543 |
Record type for a phone (of CONVERSATION).
Definition at line 95 of file gnunet_gnsrecord_lib.h.
Referenced by conversation_string_to_value(), conversation_value_to_string(), GNUNET_CONVERSATION_call_start(), GNUNET_CONVERSATION_phone_get_record(), and handle_gns_response().
#define GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE 65544 |
Record type for identity attributes (of RECLAIM).
Definition at line 100 of file gnunet_gnsrecord_lib.h.
Referenced by attr_iter_cb(), attr_store_task(), consistency_iter(), process_parallel_lookup_result(), rvk_move_attr_cb(), string_to_value(), and value_to_string().
#define GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET 65545 |
Record type for local ticket references.
Definition at line 105 of file gnunet_gnsrecord_lib.h.
Referenced by collect_tickets_cb(), consistency_iter(), filter_tickets_cb(), issue_ticket(), string_to_value(), update_tickets(), and value_to_string().
#define GNUNET_GNSRECORD_TYPE_DELEGATE 65548 |
65546 reserved
65547 deleted, free to use Record type for policies
Definition at line 118 of file gnunet_gnsrecord_lib.h.
Referenced by abd_string_to_value(), abd_value_to_string(), delegation_chain_fw_resolution_start(), forward_resolution(), handle_delegate_collection_cb(), run(), and store_cb().
#define GNUNET_GNSRECORD_TYPE_ATTRIBUTE 65549 |
Record type for reverse lookups.
Definition at line 123 of file gnunet_gnsrecord_lib.h.
Referenced by abd_string_to_value(), abd_value_to_string(), backward_resolution(), delegation_chain_bw_resolution_start(), and run().
#define GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF 65550 |
Record type for reclaim records.
Definition at line 128 of file gnunet_gnsrecord_lib.h.
Referenced by filter_tickets_cb(), issue_ticket(), lookup_authz_cb(), process_tickets(), RECLAIM_TICKETS_consume(), revoke_attrs_cb(), rvk_ticket_update(), string_to_value(), update_tickets(), and value_to_string().
#define GNUNET_GNSRECORD_TYPE_RECLAIM_MASTER 65551 |
Record type for RECLAIM master.
Definition at line 133 of file gnunet_gnsrecord_lib.h.
Referenced by string_to_value(), and value_to_string().
#define GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_CLIENT 65552 |
Record type for reclaim OIDC clients.
Definition at line 138 of file gnunet_gnsrecord_lib.h.
Referenced by string_to_value(), and value_to_string().
#define GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_REDIRECT 65553 |
Record type for reclaim OIDC redirect URIs.
Definition at line 143 of file gnunet_gnsrecord_lib.h.
Referenced by client_redirect(), lookup_redirect_uri_result(), string_to_value(), and value_to_string().
#define GNUNET_GNSRECORD_TYPE_RECLAIM_CREDENTIAL 65554 |
Record type for an attribute attestation.
Definition at line 148 of file gnunet_gnsrecord_lib.h.
Referenced by consistency_iter(), cred_add_cb(), cred_iter_cb(), filter_tickets_cb(), rvk_move_attr_cb(), string_to_value(), and value_to_string().
#define GNUNET_GNSRECORD_TYPE_RECLAIM_PRESENTATION 65555 |
Record type for a presentation of a credential (used in a ticket record set)
Definition at line 154 of file gnunet_gnsrecord_lib.h.
Referenced by filter_tickets_cb(), issue_ticket(), lookup_authz_cb(), string_to_value(), update_tickets(), and value_to_string().
#define GNUNET_GNSRECORD_TYPE_EDKEY GNUNET_IDENTITY_TYPE_EDDSA |
Record type for EDKEY delegations.
Definition at line 159 of file gnunet_gnsrecord_lib.h.
Referenced by get_existing_record(), gns_string_to_value(), gns_value_to_string(), GNUNET_GNSRECORD_is_zonekey_type(), handle_gns_resolution_result(), and iterate_cb().
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 375 of file gnunet_gnsrecord_lib.h.
Flags that can be set for a record.
Definition at line 165 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 262 of file json_gnsrecord.c.
References clean_gnsrecordobject(), GNUNET_new, GnsRecordInfo::name, parse_gnsrecordobject(), GNUNET_JSON_Specification::parser, GnsRecordInfo::rd, GnsRecordInfo::rd_count, and ret.
Referenced by 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 291 of file json_gnsrecord.c.
References GNUNET_TIME_Absolute::abs_value_us, data, data_size, GNUNET_GNSRECORD_Data::expiration_time, 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_RECORD, GNUNET_GNSRECORD_RF_SUPPLEMENTAL, GNUNET_GNSRECORD_value_to_string(), GNUNET_log, GNUNET_NO, GNUNET_STRINGS_absolute_time_to_string(), GNUNET_STRINGS_relative_time_to_string(), GnsRecordInfo::rd_count, record(), records, and GNUNET_TIME_Relative::rel_value_us.
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 159 of file gnsrecord.c.
References Plugin::api, GNUNET_BLOCK_PluginFunctions::cls, init(), num_plugins, plugin, and ret.
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(), iterate_cb(), 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 |
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 191 of file gnsrecord.c.
References Plugin::api, GNUNET_BLOCK_PluginFunctions::cls, GNUNET_OK, GNUNET_SYSERR, init(), num_plugins, and plugin.
Referenced by gns_string_to_value(), multirecord_process(), parse_record(), run(), run_with_zone_pkey(), and store_cb().
uint32_t GNUNET_GNSRECORD_typename_to_number | ( | const char * | dns_typename | ) |
Convert a type name (i.e.
"AAAA") to the corresponding number.
dns_typename | name to convert |
Definition at line 220 of file gnsrecord.c.
References Plugin::api, GNUNET_BLOCK_PluginFunctions::cls, GNUNET_GNSRECORD_TYPE_ANY, init(), num_plugins, plugin, and ret.
Referenced by del_monitor(), display_record(), get_gns_cont(), multirecord_process(), namestore_get(), parse_record(), run(), and run_with_zone_pkey().
const char* GNUNET_GNSRECORD_number_to_typename | ( | uint32_t | type | ) |
Convert a type number (i.e.
1) to the corresponding type string (i.e. "A")
type | number of a type to convert |
Definition at line 247 of file gnsrecord.c.
References Plugin::api, GNUNET_BLOCK_PluginFunctions::cls, GNUNET_GNSRECORD_TYPE_ANY, init(), num_plugins, plugin, and ret.
Referenced by display_record(), display_records_from_block(), GNUNET_GNSRECORD_JSON_from_gnsrecord(), multirecord_process(), 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 |
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 88 of file gnsrecord_serialization.c.
References data, NetworkRecord::data_size, GNUNET_GNSRECORD_Data::data_size, GNUNET_break, GNUNET_break_op, GNUNET_free, GNUNET_GNSRECORD_TYPE_PKEY, GNUNET_GNSRECORD_value_to_string(), NetworkRecord::record_type, GNUNET_GNSRECORD_Data::record_type, and ret.
Referenced by block_create_ecdsa(), consistency_iter(), GNUNET_NAMESTORE_records_store(), handle_gns_resolution_result(), handle_zone_to_name_it(), lookup_it(), namestore_postgres_store_records(), namestore_sqlite_store_records(), run(), rvk_ticket_update(), send_lookup_response(), 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 |
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 |
dest | where to write the result |
Definition at line 154 of file gnsrecord_serialization.c.
References data, NetworkRecord::data_size, GNUNET_GNSRECORD_Data::data_size, 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, and NetworkRecord::record_type.
Referenced by block_create_ecdsa(), consistency_iter(), GNUNET_NAMESTORE_records_store(), handle_gns_resolution_result(), handle_zone_to_name_it(), lookup_it(), namestore_postgres_store_records(), namestore_sqlite_store_records(), run(), rvk_ticket_update(), send_lookup_response(), and store_and_free_entries().
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 in the rd array |
dest | where to put the data |
Definition at line 227 of file gnsrecord_serialization.c.
References data, GNUNET_GNSRECORD_Data::data, NetworkRecord::data_size, GNUNET_GNSRECORD_Data::data_size, NetworkRecord::expiration_time, GNUNET_GNSRECORD_Data::expiration_time, NetworkRecord::flags, GNUNET_GNSRECORD_Data::flags, GNUNET_break_op, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_GNSRECORD_value_to_string(), GNUNET_memcpy, GNUNET_ntohll(), GNUNET_OK, GNUNET_SYSERR, LOG, NetworkRecord::record_type, and GNUNET_GNSRECORD_Data::record_type.
Referenced by block_decrypt_ecdsa(), check_rd(), check_result(), continue_store_activity(), database_setup(), get_records_and_call_iterator(), handle_lookup_result(), handle_record_result(), handle_record_store(), handle_result(), handle_zone_to_name_response(), parse_result_call_iterator(), 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 216 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(), and GNUNET_YES.
char* GNUNET_GNSRECORD_string_to_lowercase | ( | const char * | src | ) |
Convert a UTF-8 string to UTF-8 lowercase.
src | source string |
Definition at line 46 of file gnsrecord_misc.c.
References GNUNET_strdup, GNUNET_STRINGS_utf8_tolower(), and res.
Referenced by handle_record_lookup(), and handle_record_store().
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 |
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 | the zone key |
Definition at line 65 of file gnsrecord_misc.c.
References buf, end, GNUNET_break, and GNUNET_STRINGS_data_to_string().
Referenced by get_nick_record(), handle_gns_resolution_result(), handle_namecache_block_response(), handle_revocation_result(), namestore_flat_zone_to_name(), namestore_sqlite_zone_to_name(), recursive_gns_resolution_namecache(), recursive_gns_resolution_revocation(), and refresh_block().
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 239 of file gnsrecord_misc.c.
References GNUNET_free, GNUNET_IDENTITY_public_key_to_string(), GNUNET_snprintf(), 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 264 of file gnsrecord_misc.c.
References GNUNET_IDENTITY_public_key_from_string(), GNUNET_OK, and GNUNET_SYSERR.
Referenced by GNS_find_tld(), handle_gns_cname_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 549 of file gnsrecord_crypto.c.
References GNUNET_assert, GNUNET_GNSRECORD_query_from_public_key(), GNUNET_GNSRECORD_TYPE_PKEY, GNUNET_IDENTITY_key_get_public(), and GNUNET_IDENTITY_PrivateKey::type.
Referenced by perform_dht_put().
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.
pub | public key of the zone |
label | label of the record |
query | hash to use for the query |
Definition at line 579 of file gnsrecord_crypto.c.
References GNUNET_IDENTITY_PublicKey::ecdsa_key, GNUNET_assert, GNUNET_CRYPTO_ecdsa_public_key_derive(), GNUNET_CRYPTO_hash(), GNUNET_GNSRECORD_TYPE_PKEY, and GNUNET_IDENTITY_PublicKey::type.
Referenced by GNUNET_GNSRECORD_query_from_private_key(), handle_namecache_block_response(), recursive_gns_resolution_namecache(), and run().
struct GNUNET_GNSRECORD_Block* 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 | ||
) |
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 |
key | the private key |
expire | block expiration |
label | the name for the records |
rd | record data |
rd_count | number of records |
Definition at line 259 of file gnsrecord_crypto.c.
References block_create_ecdsa(), GNUNET_IDENTITY_PrivateKey::ecdsa_key, GNUNET_assert, GNUNET_CRYPTO_ecdsa_key_get_public(), GNUNET_GNSRECORD_TYPE_PKEY, and GNUNET_IDENTITY_PrivateKey::type.
Referenced by perform_dht_put(), refresh_block(), and run().
struct GNUNET_GNSRECORD_Block* GNUNET_GNSRECORD_block_create2 | ( | const struct GNUNET_IDENTITY_PrivateKey * | pkey, |
struct GNUNET_TIME_Absolute | expire, | ||
const char * | label, | ||
const struct GNUNET_GNSRECORD_Data * | rd, | ||
unsigned int | rd_count | ||
) |
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 |
key | the private key |
expire | block expiration |
label | the name for the records |
rd | record data |
rd_count | number of records |
Definition at line 315 of file gnsrecord_crypto.c.
References block_create_ecdsa(), CSIZE, GNUNET_IDENTITY_PrivateKey::ecdsa_key, GNUNET_CRYPTO_ecdsa_key_get_public(), GNUNET_IDENTITY_TYPE_ECDSA, KeyCacheLine::key, line, KeyCacheLine::pkey, and GNUNET_IDENTITY_PrivateKey::type.
Referenced by perform_dht_put(), and refresh_block().
int 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 360 of file gnsrecord_crypto.c.
References GNUNET_GNSRECORD_EcdsaBlock::derived_key, GNUNET_GNSRECORD_Block::ecdsa_block, GNUNET_break, GNUNET_CRYPTO_ecdsa_verify_(), GNUNET_GNSRECORD_TYPE_PKEY, GNUNET_NO, GNUNET_SIGNATURE_PURPOSE_GNS_RECORD_SIGN, KeyCacheLine::key, GNUNET_GNSRECORD_EcdsaBlock::purpose, GNUNET_GNSRECORD_EcdsaBlock::signature, and GNUNET_GNSRECORD_Block::type.
Referenced by block_plugin_gns_evaluate(), and handle_lookup_block_response().
int 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 |
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 520 of file gnsrecord_crypto.c.
References block_decrypt_ecdsa(), GNUNET_GNSRECORD_Block::ecdsa_block, GNUNET_IDENTITY_PublicKey::ecdsa_key, GNUNET_IDENTITY_TYPE_ECDSA, GNUNET_NO, KeyCacheLine::key, and GNUNET_IDENTITY_PublicKey::type.
Referenced by handle_block(), handle_dht_response(), and handle_namecache_block_response().
int 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 94 of file gnsrecord_misc.c.
References GNUNET_GNSRECORD_Data::data, GNUNET_GNSRECORD_Data::data_size, GNUNET_GNSRECORD_Data::expiration_time, GNUNET_GNSRECORD_Data::flags, GNUNET_ERROR_TYPE_DEBUG, GNUNET_GNSRECORD_RF_RCMP_FLAGS, GNUNET_NO, GNUNET_YES, LOG, and GNUNET_GNSRECORD_Data::record_type.
struct GNUNET_TIME_Absolute GNUNET_GNSRECORD_record_get_expiration_time | ( | unsigned int | rd_count, |
const struct GNUNET_GNSRECORD_Data * | rd | ||
) |
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 |
Definition at line 153 of file gnsrecord_misc.c.
References GNUNET_TIME_Absolute::abs_value_us, expire(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION, GNUNET_GNSRECORD_RF_SHADOW_RECORD, GNUNET_STRINGS_absolute_time_to_string(), GNUNET_TIME_absolute_max(), GNUNET_TIME_absolute_min(), GNUNET_TIME_relative_to_absolute(), GNUNET_TIME_UNIT_FOREVER_ABS, GNUNET_TIME_UNIT_ZERO_ABS, LOG, and GNUNET_TIME_Relative::rel_value_us.
Referenced by perform_dht_put(), and refresh_block().
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 326 of file gnsrecord_misc.c.
References GNUNET_GNSRECORD_Block::ecdsa_block, GNUNET_GNSRECORD_TYPE_PKEY, GNUNET_GNSRECORD_EcdsaBlock::purpose, GNUNET_CRYPTO_EccSignaturePurpose::size, and GNUNET_GNSRECORD_Block::type.
Referenced by block_plugin_gns_evaluate(), GNUNET_NAMECACHE_block_cache(), handle_dht_response(), handle_lookup_block_it(), namecache_cache_block(), namecache_postgres_cache_block(), namecache_sqlite_cache_block(), perform_dht_put(), 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 344 of file gnsrecord_misc.c.
References GNUNET_GNSRECORD_TYPE_PKEY, GNUNET_TIME_absolute_get_zero_(), and GNUNET_TIME_absolute_ntoh().
Referenced by expire_blocks(), handle_dht_response(), handle_lookup_block_it(), handle_namecache_block_response(), namecache_postgres_cache_block(), 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 361 of file gnsrecord_misc.c.
References GNUNET_GNSRECORD_EcdsaBlock::derived_key, GNUNET_GNSRECORD_Block::ecdsa_block, GNUNET_CRYPTO_hash(), GNUNET_GNSRECORD_TYPE_PKEY, GNUNET_OK, GNUNET_SYSERR, and GNUNET_GNSRECORD_Block::type.
Referenced by block_plugin_gns_evaluate(), block_plugin_gns_get_key(), namecache_cache_block(), namecache_postgres_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 276 of file gnsrecord_misc.c.
References GNUNET_GNSRECORD_is_zonekey_type(), GNUNET_IDENTITY_read_key_from_buffer(), GNUNET_NO, GNUNET_OK, and GNUNET_SYSERR.
Referenced by check_pkey(), gns_value_to_string(), handle_gns_resolution_result(), namestore_postgres_store_records(), namestore_sqlite_store_records(), 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 293 of file gnsrecord_misc.c.
References GNUNET_IDENTITY_key_get_length(), GNUNET_IDENTITY_write_key_to_buffer(), GNUNET_malloc, GNUNET_OK, GNUNET_SYSERR, and GNUNET_IDENTITY_PublicKey::type.
Referenced by gns_string_to_value(), and zone_to_name_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 312 of file gnsrecord_misc.c.
References GNUNET_GNSRECORD_TYPE_EDKEY, GNUNET_GNSRECORD_TYPE_PKEY, GNUNET_NO, and GNUNET_YES.
Referenced by GNUNET_GNSRECORD_identity_from_data(), namestore_postgres_store_records(), namestore_sqlite_store_records(), and zone_to_name().