gnsrecord plugin to provide the API for fundamental GNS records This includes the VPN record because GNS resolution is expected to understand VPN records and (if needed) map the result to A/AAAA. More...
#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_gnsrecord_lib.h"
#include "gnunet_gnsrecord_plugin.h"
#include <inttypes.h>
Go to the source code of this file.
Functions | |
static char * | gns_value_to_string (void *cls, uint32_t type, const void *data, size_t data_size) |
Convert the 'value' of a record to a string. More... | |
static int | gns_string_to_value (void *cls, uint32_t type, const char *s, void **data, size_t *data_size) |
Convert human-readable version of a 'value' of a record to the binary representation. More... | |
static uint32_t | gns_typename_to_number (void *cls, const char *gns_typename) |
Convert a type name (e.g. More... | |
static const char * | gns_number_to_typename (void *cls, uint32_t type) |
Convert a type number to the corresponding type string (e.g. More... | |
static enum GNUNET_GenericReturnValue | gns_is_critical (void *cls, uint32_t type) |
void * | libgnunet_plugin_gnsrecord_gns_init (void *cls) |
Entry point for the plugin. More... | |
void * | libgnunet_plugin_gnsrecord_gns_done (void *cls) |
Exit point from the plugin. More... | |
Variables | |
struct { | |
const char * name | |
uint32_t number | |
} | gns_name_map [] |
Mapping of record type numbers to human-readable record type names. More... | |
gnsrecord plugin to provide the API for fundamental GNS records This includes the VPN record because GNS resolution is expected to understand VPN records and (if needed) map the result to A/AAAA.
Definition in file plugin_gnsrecord_gns.c.
|
static |
Convert the 'value' of a record to a string.
cls | closure, unused |
type | type of the record |
data | value in binary encoding |
data_size | number of bytes in data |
Definition at line 46 of file plugin_gnsrecord_gns.c.
References _, data, data_size, GNUNET_asprintf(), GNUNET_break_op, GNUNET_CRYPTO_public_key_to_string(), GNUNET_DNSPARSER_parse_name(), GNUNET_free, GNUNET_GNSRECORD_identity_from_data(), GNUNET_GNSRECORD_TYPE_BOX, GNUNET_GNSRECORD_TYPE_EDKEY, GNUNET_GNSRECORD_TYPE_GNS2DNS, GNUNET_GNSRECORD_TYPE_LEHO, GNUNET_GNSRECORD_TYPE_NICK, GNUNET_GNSRECORD_TYPE_PKEY, GNUNET_GNSRECORD_TYPE_REDIRECT, GNUNET_GNSRECORD_TYPE_SBOX, GNUNET_GNSRECORD_TYPE_TOMBSTONE, GNUNET_GNSRECORD_TYPE_VPN, GNUNET_GNSRECORD_value_to_string(), GNUNET_i2s_full(), GNUNET_memcpy, GNUNET_OK, GNUNET_strdup, GNUNET_strndup, ns, GNUNET_TUN_GnsVpnRecord::peer, pk, prefix, GNUNET_TUN_GnsVpnRecord::proto, GNUNET_GNSRECORD_BoxRecord::protocol, GNUNET_GNSRECORD_BoxRecord::record_type, GNUNET_GNSRECORD_SBoxRecord::record_type, GNUNET_GNSRECORD_BoxRecord::service, and type.
Referenced by libgnunet_plugin_gnsrecord_gns_init().
|
static |
Convert human-readable version of a 'value' of a record to the binary representation.
cls | closure, unused |
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 187 of file plugin_gnsrecord_gns.c.
References _, data, data_size, GNUNET_CRYPTO_eddsa_public_key_from_string(), GNUNET_CRYPTO_public_key_from_string(), GNUNET_CRYPTO_public_key_get_length(), GNUNET_DNSPARSER_builder_add_name(), GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_GNSRECORD_data_from_identity(), GNUNET_GNSRECORD_string_to_value(), GNUNET_GNSRECORD_TYPE_BOX, GNUNET_GNSRECORD_TYPE_EDKEY, GNUNET_GNSRECORD_TYPE_GNS2DNS, GNUNET_GNSRECORD_TYPE_LEHO, GNUNET_GNSRECORD_TYPE_NICK, GNUNET_GNSRECORD_TYPE_PKEY, GNUNET_GNSRECORD_TYPE_REDIRECT, GNUNET_GNSRECORD_TYPE_SBOX, GNUNET_GNSRECORD_TYPE_TOMBSTONE, GNUNET_GNSRECORD_TYPE_VPN, GNUNET_log, GNUNET_malloc, GNUNET_memcpy, GNUNET_OK, GNUNET_strdup, GNUNET_SYSERR, p, GNUNET_TUN_GnsVpnRecord::peer, pk, prefix, proto, GNUNET_TUN_GnsVpnRecord::proto, GNUNET_GNSRECORD_BoxRecord::protocol, GNUNET_PeerIdentity::public_key, GNUNET_GNSRECORD_BoxRecord::record_type, GNUNET_GNSRECORD_SBoxRecord::record_type, GNUNET_GNSRECORD_BoxRecord::service, service, and type.
Referenced by libgnunet_plugin_gnsrecord_gns_init().
|
static |
Convert a type name (e.g.
"AAAA") to the corresponding number.
cls | closure, unused |
gns_typename | name to convert |
Definition at line 442 of file plugin_gnsrecord_gns.c.
References gns_name_map, and name.
Referenced by libgnunet_plugin_gnsrecord_gns_init().
|
static |
Convert a type number to the corresponding type string (e.g.
1 to "A")
cls | closure, unused |
type | number of a type to convert |
Definition at line 463 of file plugin_gnsrecord_gns.c.
References gns_name_map, name, number, and type.
Referenced by libgnunet_plugin_gnsrecord_gns_init().
|
static |
Definition at line 477 of file plugin_gnsrecord_gns.c.
References GNUNET_GNSRECORD_TYPE_EDKEY, GNUNET_GNSRECORD_TYPE_GNS2DNS, GNUNET_GNSRECORD_TYPE_PKEY, GNUNET_GNSRECORD_TYPE_REDIRECT, GNUNET_NO, GNUNET_YES, and type.
Referenced by libgnunet_plugin_gnsrecord_gns_init().
void * libgnunet_plugin_gnsrecord_gns_init | ( | void * | cls | ) |
Entry point for the plugin.
cls | NULL |
Definition at line 496 of file plugin_gnsrecord_gns.c.
References gns_is_critical(), gns_number_to_typename(), gns_string_to_value(), gns_typename_to_number(), gns_value_to_string(), GNUNET_new, GNUNET_GNSRECORD_PluginFunctions::is_critical, GNUNET_GNSRECORD_PluginFunctions::number_to_typename, GNUNET_GNSRECORD_PluginFunctions::string_to_value, GNUNET_GNSRECORD_PluginFunctions::typename_to_number, and GNUNET_GNSRECORD_PluginFunctions::value_to_string.
void * libgnunet_plugin_gnsrecord_gns_done | ( | void * | cls | ) |
Exit point from the plugin.
cls | the return value from libgnunet_plugin_block_test_init() |
Definition at line 519 of file plugin_gnsrecord_gns.c.
References GNUNET_GNSRECORD_PluginFunctions::cls, and GNUNET_free.
const char* name |
Definition at line 415 of file plugin_gnsrecord_gns.c.
Referenced by gns_number_to_typename(), and gns_typename_to_number().
uint32_t number |
Definition at line 416 of file plugin_gnsrecord_gns.c.
Referenced by gns_number_to_typename().
struct { ... } gns_name_map[] |
Mapping of record type numbers to human-readable record type names.
Referenced by gns_number_to_typename(), and gns_typename_to_number().