GNUnet  0.10.x
Functions
gnunet-service-gns.h File Reference

GNU Name System (main service) More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int GNS_find_tld (const char *tld_str, struct GNUNET_CRYPTO_EcdsaPublicKey *pkey)
 Find GNS zone belonging to TLD tld. More...
 
const char * GNS_get_tld (const char *name)
 Obtain the TLD of the given name. More...
 

Detailed Description

GNU Name System (main service)

Author
Martin Schanzenbach
Christian Grothoff

Definition in file gnunet-service-gns.h.

Function Documentation

◆ GNS_find_tld()

int GNS_find_tld ( const char *  tld_str,
struct GNUNET_CRYPTO_EcdsaPublicKey pkey 
)

Find GNS zone belonging to TLD tld.

Parameters
tld_strtop-level domain to look up
[out]pkeypublic key to set
Returns
GNUNET_YES if tld was found GNUNET_NO if not

Definition at line 183 of file gnunet-service-gns.c.

References GNUNET_GNSRECORD_zkey_to_pkey(), GNUNET_NO, GNUNET_OK, GNUNET_YES, and GNS_TopLevelDomain::tld.

Referenced by handle_dns_request().

185 {
186  if ('\0' == *tld_str)
187  return GNUNET_NO;
188  for (struct GNS_TopLevelDomain *tld = tld_head;
189  NULL != tld;
190  tld = tld->next)
191  {
192  if (0 == strcasecmp (tld_str,
193  tld->tld))
194  {
195  *pkey = tld->pkey;
196  return GNUNET_YES;
197  }
198  }
199  if (GNUNET_OK ==
200  GNUNET_GNSRECORD_zkey_to_pkey (tld_str + 1,
201  pkey))
202  return GNUNET_YES; /* TLD string *was* the public key */
203  return GNUNET_NO;
204 }
static struct GNS_TopLevelDomain * tld_head
Head of DLL of TLDs we map to GNS zones.
int GNUNET_GNSRECORD_zkey_to_pkey(const char *zkey, struct GNUNET_CRYPTO_EcdsaPublicKey *pkey)
Convert an absolute domain name to the respective public key.
#define GNUNET_NO
Definition: gnunet_common.h:81
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:78
Representation of a TLD, mapping the respective TLD string (i.e.
char * tld
Top-level domain as a string, including leading ".".
#define GNUNET_YES
Definition: gnunet_common.h:80
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNS_get_tld()

const char* GNS_get_tld ( const char *  name)

Obtain the TLD of the given name.

Parameters
namea name
Returns
the part of name after the last ".", or name if name does not contain a "."

Definition at line 215 of file gnunet-service-gns.c.

References name, and GNS_TopLevelDomain::tld.

Referenced by handle_dns_request(), and recursive_gns2dns_resolution().

216 {
217  const char *tld;
218 
219  tld = strrchr (name,
220  (unsigned char) '.');
221  if (NULL == tld)
222  tld = name;
223  else
224  tld++; /* skip the '.' */
225  return tld;
226 }
const char * name
char * tld
Top-level domain as a string, including leading ".".
Here is the caller graph for this function: