99 if ((data_size <=
sizeof(vpn)) || (
'\0' != cdata[data_size - 1]))
105 (
unsigned int) ntohs (vpn.
proto),
107 (
const char *) &cdata[
sizeof(vpn)]);
124 data_size -
sizeof(box));
129 (
unsigned int) ntohs (box.
protocol),
130 (
unsigned int) ntohs (box.
service),
162 uint32_t record_type;
174 _ (
"Unable to parse zone key record `%s'\n"),
184 if (record_type != type)
187 _(
"Record type does not match parsed record type\n"));
194 *data_size = strlen (s);
199 *data_size = strlen (s);
209 at = strchr (cpy,
'@');
213 _ (
"Unable to parse GNS2DNS record `%s'\n"),
229 "Failed to serialize GNS2DNS record with value `%s': Not a DNS name.\n"),
236 off += strlen (at) + 1;
246 char s_peer[103 + 1];
247 char s_serv[253 + 1];
250 if (3 != sscanf (s,
"%u %103s %253s", &proto, s_peer, s_serv))
253 _ (
"Unable to parse VPN record string `%s'\n"),
268 vpn->
proto = htons ((uint16_t) proto);
269 strcpy ((
char *) &vpn[1], s_serv);
282 if (3 != sscanf (s,
"%u %u %u ", &protocol, &service, &record_type))
285 _ (
"Unable to parse BOX record string `%s'\n"),
289 rest = snprintf (NULL, 0,
"%u %u %u ", protocol, service, record_type);
298 box->
service = htons (service);
326 { NULL, UINT32_MAX } };
#define GNUNET_GNSRECORD_TYPE_PKEY
WARNING: This header is generated! In order to add GNS record types, you must register them in GANA...
GNUNET_GNSRECORD_TypenameToNumberFunction typename_to_number
Typename to number.
Payload of GNS VPN record.
GNUNET_GNSRECORD_ValueToStringFunction value_to_string
Conversion to string.
static struct GNUNET_SERVICE_Handle * service
Handle to our service instance.
uint16_t service
Service of the boxed record (aka port number), in NBO.
static struct @22 gns_name_map[]
Mapping of record type numbers to human-readable record type names.
#define GNUNET_GNSRECORD_TYPE_NICK
GNS nick names.
Record type used to box up SRV and TLSA records.
char * GNUNET_DNSPARSER_parse_name(const char *udp_payload, size_t udp_payload_length, size_t *off)
Parse name inside of a DNS query or record.
GNUNET_GNSRECORD_NumberToTypenameFunction number_to_typename
Number to typename.
#define GNUNET_GNSRECORD_TYPE_GNS2DNS
Delegation to DNS.
static uint8_t proto
Protocol to use.
char * GNUNET_IDENTITY_public_key_to_string(const struct GNUNET_IDENTITY_PublicKey *key)
Creates a (Base32) string representation of the public key.
GNUNET_GNSRECORD_StringToValueFunction string_to_value
Conversion to binary.
static size_t data_size
Number of bytes in data.
void * libgnunet_plugin_gnsrecord_gns_init(void *cls)
Entry point for the plugin.
ssize_t GNUNET_IDENTITY_key_get_length(const struct GNUNET_IDENTITY_PublicKey *key)
Get the compacted length of a GNUNET_IDENTITY_PublicKey.
void * cls
Closure for all of the callbacks.
#define GNUNET_GNSRECORD_TYPE_BOX
Boxed records (see TLSA/SRV handling in GNS)
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
const char * GNUNET_i2s_full(const struct GNUNET_PeerIdentity *pid)
Convert a peer identity to a string (for printing debug messages).
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
void * libgnunet_plugin_gnsrecord_gns_done(void *cls)
Exit point from the plugin.
#define GNUNET_GNSRECORD_TYPE_LEHO
legacy hostnames
static uint32_t gns_typename_to_number(void *cls, const char *gns_typename)
Convert a type name (i.e.
#define GNUNET_break_op(cond)
Use this for assertion violations caused by other peers (i.e.
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_eddsa_public_key_from_string(const char *enc, size_t enclen, struct GNUNET_CRYPTO_EddsaPublicKey *pub)
Convert a string representing a public key to a public key.
#define GNUNET_GNSRECORD_TYPE_VPN
VPN resolution.
static struct GNUNET_NAMESTORE_Handle * ns
Handle to the namestore.
uint16_t protocol
Protocol of the boxed record (6 = TCP, 17 = UDP, etc.).
int GNUNET_GNSRECORD_string_to_value(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.
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.
int int GNUNET_asprintf(char **buf, const char *format,...) __attribute__((format(printf
Like asprintf, just portable.
enum GNUNET_GenericReturnValue GNUNET_IDENTITY_public_key_from_string(const char *str, struct GNUNET_IDENTITY_PublicKey *key)
Parses a (Base32) string representation of the public key.
struct GNUNET_PeerIdentity peer
The peer to contact.
uint16_t proto
The protocol to use.
uint32_t record_type
GNS record type of the boxed record.
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.
#define GNUNET_strndup(a, length)
Wrapper around GNUNET_xstrndup_.
An identity key as per LSD0001.
static const char * gns_number_to_typename(void *cls, uint32_t type)
Convert a type number (i.e.
Each plugin is required to return a pointer to a struct of this type as the return value from its ent...
#define GNUNET_log(kind,...)
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model
#define GNUNET_GNSRECORD_TYPE_EDKEY
Record type for EDKEY zone delegations.
int GNUNET_DNSPARSER_builder_add_name(char *dst, size_t dst_len, size_t *off, const char *name)
Add a DNS name to the UDP packet at the given location, converting the name to IDNA notation as neces...
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.
void * cls
Closure for all of the callbacks.
uint32_t data
The data value.
char * GNUNET_GNSRECORD_value_to_string(uint32_t type, const void *data, size_t data_size)
Convert the 'value' of a record to a string.
#define GNUNET_malloc(size)
Wrapper around malloc.
#define GNUNET_free(ptr)
Wrapper around free.
struct GNUNET_CRYPTO_EddsaPublicKey public_key
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.