38#define LOG(kind, ...) GNUNET_log_from (kind, "gns-tld-api", __VA_ARGS__)
111 tld = strrchr (
name, (
unsigned char)
'.');
130 if ((NULL == tld) || (strlen (
name) == strlen (tld)))
137 name[strlen (
name) - strlen (tld) - 1] =
'\0';
218 if (NULL == strchr (ltr->
name, (
unsigned char)
'.'))
266 "`%s' seems to be a valid zone key\n", tld);
273 for (
const char *domain =
name; NULL != domain;
274 domain = strchr (domain, (
unsigned char)
'.'))
276 if (
'.' == domain[0])
292 _ (
"Expected a base32-encoded public zone key\n"));
308 "`%s' should be a valid ego\n", ltr->
name);
314 if (NULL == ltr->
id_co)
335 if (NULL != ltr->
id_co)
struct GNUNET_GETOPT_CommandLineOption options[]
IPC messages between GNS API and GNS service.
shared data structures of libgnunetgns
static void lookup_with_public_key(struct GNUNET_GNS_LookupWithTldRequest *ltr, const struct GNUNET_CRYPTO_PublicKey *pkey)
Perform the actual resolution, starting with the zone identified by the given public key.
static const char * get_tld(const char *name)
Obtain the TLD of the given name.
static void identity_zone_cb(void *cls, const struct GNUNET_CRYPTO_PrivateKey *priv, const char *ego_name)
Method called to with the ego we are to use for the lookup, when the ego is determined by a name.
static void process_lookup_result(void *cls, uint32_t rd_count, const struct GNUNET_GNSRECORD_Data *rd)
Function called with the result of a GNS lookup.
static void eat_tld(char *name, const char *tld)
Eat the "TLD" (last bit) of the given name.
static int ret
Final status code.
static char * pkey
Public key of the zone to look in, in ASCII.
static char * name
Name (label) of the records to list.
static unsigned int rd_count
Number of records for currently parsed set.
static struct GNUNET_GNSRECORD_Data rd[50]
The record data under a single label.
static uint32_t type
Type string converted to DNS type value.
static struct GNUNET_VPN_Handle * handle
Handle to vpn service.
commonly used definitions; globals in this file are exempt from the rule that the module name ("commo...
Identity service; implements identity management for GNUnet.
Constants for network protocols.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_string(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, char **value)
Get a configuration value that should be a string.
struct GNUNET_GNS_LookupRequest * GNUNET_GNS_lookup(struct GNUNET_GNS_Handle *handle, const char *name, const struct GNUNET_CRYPTO_PublicKey *zone, uint32_t type, enum GNUNET_GNS_LocalOptions options, GNUNET_GNS_LookupResultProcessor proc, void *proc_cls)
Perform an asynchronous lookup operation on the GNS.
void(* GNUNET_GNS_LookupResultProcessor2)(void *cls, int gns_tld, uint32_t rd_count, const struct GNUNET_GNSRECORD_Data *rd)
Iterator called on obtained result for a GNS lookup where "not GNS" is a valid answer.
enum GNUNET_GenericReturnValue GNUNET_GNS_parse_ztld(const char *name, struct GNUNET_CRYPTO_PublicKey *ztld_key)
Try to parse the zTLD into a public key.
struct GNUNET_GNS_LookupWithTldRequest * GNUNET_GNS_lookup_with_tld(struct GNUNET_GNS_Handle *handle, const char *name, uint32_t type, enum GNUNET_GNS_LocalOptions options, GNUNET_GNS_LookupResultProcessor2 proc, void *proc_cls)
Perform an asynchronous lookup operation on the GNS, determining the zone using the TLD of the given ...
void * GNUNET_GNS_lookup_with_tld_cancel(struct GNUNET_GNS_LookupWithTldRequest *ltr)
Cancel pending lookup request.
void * GNUNET_GNS_lookup_cancel(struct GNUNET_GNS_LookupRequest *lr)
Cancel pending lookup request.
GNUNET_GNS_LocalOptions
Options for the GNS lookup.
@ GNUNET_GNS_LO_NO_DHT
Never look in the DHT, keep request to local cache.
@ GNUNET_GNS_LO_LOCAL_MASTER
For the rightmost label, only look in the cache (it is our local namestore), for the others,...
#define GNUNET_GNS_EMPTY_LABEL_AT
String we use to indicate an empty label (top-level entry in the zone).
struct GNUNET_IDENTITY_EgoSuffixLookup * GNUNET_IDENTITY_ego_lookup_by_suffix(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *suffix, GNUNET_IDENTITY_EgoSuffixCallback cb, void *cb_cls)
Obtain the ego with the maximum suffix match between the ego's name and the given domain name suffix.
void GNUNET_IDENTITY_ego_lookup_by_suffix_cancel(struct GNUNET_IDENTITY_EgoSuffixLookup *el)
Abort ego suffix lookup attempt.
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_key_get_public(const struct GNUNET_CRYPTO_PrivateKey *privkey, struct GNUNET_CRYPTO_PublicKey *key)
Retrieves the public key representation of a private key.
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_assert(cond)
Use this for fatal errors that cannot be handled.
void GNUNET_log_config_invalid(enum GNUNET_ErrorType kind, const char *section, const char *option, const char *required)
Log error message about invalid configuration option value.
@ GNUNET_ERROR_TYPE_ERROR
@ GNUNET_ERROR_TYPE_DEBUG
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_new(type)
Allocate a struct or union of the given type.
#define GNUNET_free(ptr)
Wrapper around free.
A private key for an identity as per LSD0001.
An identity key as per LSD0001.
Connection to the GNS service.
const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration to use.
Handle to a lookup request.
Handle to a lookup request.
enum GNUNET_GNS_LocalOptions options
Lookup options.
GNUNET_GNS_LookupResultProcessor2 lookup_proc
processor to call on lookup result
uint32_t type
Desired result record type.
char * name
Domain name we are resolving.
void * lookup_proc_cls
lookup_proc closure
struct GNUNET_GNS_LookupRequest * lr
Underlying GNS lookup.
char * longest_match
Name of the longest matching ego found so far.
struct GNUNET_GNS_Handle * gns_handle
handle to gns
struct GNUNET_IDENTITY_EgoSuffixLookup * id_co
Lookup an ego with the identity service.
struct GNUNET_IDENTITY_Ego * longest_match_ego
Ego corresponding to longest_match.
const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we use.