104 (
unsigned int) ntohs (vpn.
proto),
106 (
const char *) &cdata[
sizeof(vpn)]);
128 (
unsigned int) ntohs (box.
protocol),
129 (
unsigned int) ntohs (box.
service),
167 "This is a memento of an older block for internal maintenance."));
194 uint32_t record_type;
206 _ (
"Unable to parse zone key record `%s'\n"),
217 if (record_type !=
type)
220 _ (
"Record type does not match parsed record type\n"));
239 at = strchr (cpy,
'@');
243 _ (
"Unable to parse GNS2DNS record `%s'\n"),
260 "Failed to serialize GNS2DNS record with value `%s': Not a DNS name.\n"),
267 off += strlen (at) + 1;
277 char s_peer[103 + 1];
278 char s_serv[253 + 1];
281 if (3 != sscanf (s,
"%u %103s %253s", &
proto, s_peer, s_serv))
284 _ (
"Unable to parse VPN record string `%s'\n"),
300 strcpy ((
char *) &vpn[1], s_serv);
316 _ (
"Unable to parse BOX record string `%s'\n"),
340 char *underscore_prefix;
347 if (2 != sscanf (s,
"%s %u ",
prefix, &rrtype))
350 _ (
"Unable to parse SBOX record string `%s'\n"),
355 underscore_prefix = strrchr (
prefix,
'.');
356 if (underscore_prefix == NULL)
358 underscore_prefix =
prefix;
364 if (
'_' != underscore_prefix[0])
368 "Unable to parse SBOX record string `%s', the rightmost label `%s' does not start with an underscore\n"),
369 prefix, underscore_prefix);
373 rest = snprintf (NULL, 0,
"%s %u ",
prefix, rrtype);
382 prefix_size = strlen (
prefix) + 1;
443 const char *gns_typename)
static int prefix
If printing the value of PREFIX has been requested.
static char * data
The data to insert into the dht.
struct GNUNET_CRYPTO_PrivateKey pk
Private key from command line option, or NULL.
static struct GNUNET_NAMECACHE_Handle * ns
Handle to the namecache.
static uint32_t type
Type string converted to DNS type value.
static size_t data_size
Number of bytes in data.
static uint8_t proto
Protocol to use.
static struct GNUNET_SERVICE_Handle * service
Handle to our service instance.
static struct GNUNET_OS_Process * p
Helper process we started.
API that can be used to manipulate GNS record data.
Plugin API for GNS record types.
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...
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.
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 repre...
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.
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.
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.
ssize_t GNUNET_CRYPTO_public_key_get_length(const struct GNUNET_CRYPTO_PublicKey *key)
Get the compacted length of a GNUNET_CRYPTO_PublicKey.
#define GNUNET_log(kind,...)
char * GNUNET_CRYPTO_public_key_to_string(const struct GNUNET_CRYPTO_PublicKey *key)
Creates a (Base32) string representation of the public key.
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_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
GNUNET_GenericReturnValue
Named constants for return values.
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_public_key_from_string(const char *str, struct GNUNET_CRYPTO_PublicKey *key)
Parses a (Base32) string representation of the public key.
#define GNUNET_break_op(cond)
Use this for assertion violations caused by other peers (i.e.
const char * GNUNET_i2s_full(const struct GNUNET_PeerIdentity *pid)
Convert a peer identity to a string (for printing debug messages).
@ GNUNET_ERROR_TYPE_ERROR
int int GNUNET_asprintf(char **buf, const char *format,...) __attribute__((format(printf
Like asprintf, just portable.
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
#define GNUNET_strndup(a, length)
Wrapper around GNUNET_xstrndup_.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_malloc(size)
Wrapper around malloc.
#define GNUNET_free(ptr)
Wrapper around free.
void * libgnunet_plugin_gnsrecord_gns_init(void *cls)
Entry point for the plugin.
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.
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.
static const char * gns_number_to_typename(void *cls, uint32_t type)
Convert a type number to the corresponding type string (e.g.
static struct @37 gns_name_map[]
Mapping of record type numbers to human-readable record type names.
static uint32_t gns_typename_to_number(void *cls, const char *gns_typename)
Convert a type name (e.g.
void * libgnunet_plugin_gnsrecord_gns_done(void *cls)
Exit point from the plugin.
static enum GNUNET_GenericReturnValue gns_is_critical(void *cls, uint32_t type)
#define GNUNET_GNSRECORD_TYPE_BOX
Box record.
#define GNUNET_GNSRECORD_TYPE_NICK
GNS zone nickname.
#define GNUNET_GNSRECORD_TYPE_TOMBSTONE
Record type to indicate a previously delete record (PRIVATE only)
#define GNUNET_GNSRECORD_TYPE_GNS2DNS
Delegation to DNS.
#define GNUNET_GNSRECORD_TYPE_REDIRECT
Redirection record.
#define GNUNET_GNSRECORD_TYPE_VPN
VPN resolution.
#define GNUNET_GNSRECORD_TYPE_LEHO
GNS legacy hostname.
#define GNUNET_GNSRECORD_TYPE_SBOX
SBox record.
#define GNUNET_GNSRECORD_TYPE_PKEY
WARNING: This header is generated! In order to add GNS record types, you must register them in GANA,...
#define GNUNET_GNSRECORD_TYPE_EDKEY
GNS zone delegation (EDKEY)
An identity key as per LSD0001.
Record type used to box up SRV and TLSA records.
uint32_t record_type
GNS record type of the boxed record.
uint16_t service
Service of the boxed record (aka port number), in NBO.
uint16_t protocol
Protocol of the boxed record (6 = TCP, 17 = UDP, etc.).
Each plugin is required to return a pointer to a struct of this type as the return value from its ent...
GNUNET_GNSRECORD_IsCriticalFunction is_critical
Is critical.
GNUNET_GNSRECORD_TypenameToNumberFunction typename_to_number
Typename to number.
GNUNET_GNSRECORD_NumberToTypenameFunction number_to_typename
Number to typename.
GNUNET_GNSRECORD_ValueToStringFunction value_to_string
Conversion to string.
void * cls
Closure for all of the callbacks.
GNUNET_GNSRECORD_StringToValueFunction string_to_value
Conversion to binary.
Record type used to box up SMIMEA records.
uint32_t record_type
GNS record type of the boxed record.
struct GNUNET_CRYPTO_EddsaPublicKey public_key
Payload of GNS VPN record.
struct GNUNET_PeerIdentity peer
The peer to contact.
uint16_t proto
The protocol to use.