GNUnet  0.16.x
Macros | Functions
gnsrecord_misc.c File Reference

MISC functions related to GNS records. More...

#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_constants.h"
#include "gnunet_signatures.h"
#include "gnunet_arm_service.h"
#include "gnunet_gnsrecord_lib.h"
#include "gnunet_dnsparser_lib.h"
#include "gnunet_tun_lib.h"
Include dependency graph for gnsrecord_misc.c:

Go to the source code of this file.

Macros

#define LOG(kind, ...)   GNUNET_log_from (kind, "gnsrecord", __VA_ARGS__)
 

Functions

char * GNUNET_GNSRECORD_string_normalize (const char *src)
 Normalize a UTF-8 string to a GNS name. More...
 
enum GNUNET_GenericReturnValue GNUNET_GNSRECORD_label_check (const char *label, char **emsg)
 Check label for invalid characters. More...
 
const char * GNUNET_GNSRECORD_z2s (const struct GNUNET_IDENTITY_PublicKey *z)
 Convert a zone key to a string (for printing debug messages). More...
 
int GNUNET_GNSRECORD_records_cmp (const struct GNUNET_GNSRECORD_Data *a, const struct GNUNET_GNSRECORD_Data *b)
 Compares if two records are equal (ignoring flags such as authority, private and pending, but not relative vs. 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...
 
int GNUNET_GNSRECORD_is_expired (const struct GNUNET_GNSRECORD_Data *rd)
 Test if a given record is expired. 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...
 
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...
 
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_record_to_identity_key (const struct GNUNET_GNSRECORD_Data *rd, struct GNUNET_IDENTITY_PublicKey *key)
 
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 *expiry, int include_private, char **emsg)
 Normalize namestore records: Check for consistency and expirations. More...
 
enum GNUNET_GenericReturnValue GNUNET_GNSRECORD_convert_records_for_export (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 *expiry, char **emsg)
 Convert namestore records from the internal format to that suitable for publication (removes private records). More...
 

Detailed Description

MISC functions related to GNS records.

Author
Martin Schanzenbach
Matthias Wachs
Christian Grothoff

Definition in file gnsrecord_misc.c.

Macro Definition Documentation

◆ LOG

#define LOG (   kind,
  ... 
)    GNUNET_log_from (kind, "gnsrecord", __VA_ARGS__)

Definition at line 38 of file gnsrecord_misc.c.

Function Documentation

◆ GNUNET_GNSRECORD_record_to_identity_key()

enum GNUNET_GenericReturnValue GNUNET_GNSRECORD_record_to_identity_key ( const struct GNUNET_GNSRECORD_Data rd,
struct GNUNET_IDENTITY_PublicKey key 
)

Definition at line 338 of file gnsrecord_misc.c.

390 {
392  "Got record of type %u\n",
393  rd->record_type);
394  switch (rd->record_type)
395  {
397  key->type = htonl (rd->record_type);
398  memcpy (&key->ecdsa_key, rd->data, sizeof (key->ecdsa_key));
399  return GNUNET_OK;
401  key->type = htonl (rd->record_type);
402  memcpy (&key->eddsa_key, rd->data, sizeof (key->eddsa_key));
403  return GNUNET_OK;
404  default:
405  return GNUNET_SYSERR;
406  }
407  return GNUNET_SYSERR;
408 
409 
410 }
#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
Record type for EDKEY zone delegations.
struct GNUNET_HashCode key
The key used in the DHT.
#define GNUNET_log(kind,...)
@ GNUNET_OK
Definition: gnunet_common.h:95
@ GNUNET_SYSERR
Definition: gnunet_common.h:93
@ GNUNET_ERROR_TYPE_DEBUG
uint32_t record_type
Type of the GNS/DNS record.
const void * data
Binary value stored in the DNS record.