GNUnet 0.21.1
gnunet-service-gns.h File Reference

GNU Name System (main service) More...

Include dependency graph for gnunet-service-gns.h:
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_PublicKey *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_PublicKey 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 178 of file gnunet-service-gns.c.

180{
181 if ('\0' == *tld_str)
182 return GNUNET_NO;
183 for (struct GNS_TopLevelDomain *tld = tld_head;
184 NULL != tld;
185 tld = tld->next)
186 {
187 if (0 == strcasecmp (tld_str,
188 tld->tld))
189 {
190 *pkey = tld->pkey;
191 return GNUNET_YES;
192 }
193 }
194 if (GNUNET_OK ==
196 pkey))
197 return GNUNET_YES; /* TLD string *was* the public key */
198 return GNUNET_NO;
199}
static char * pkey
Public key of the zone to look in, in ASCII.
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_PublicKey *pkey)
Convert an absolute domain name to the respective public key.
@ GNUNET_OK
@ GNUNET_YES
@ GNUNET_NO
Representation of a TLD, mapping the respective TLD string (e.g.
struct GNS_TopLevelDomain * next
Kept in a DLL, as there are unlikely enough of these to warrant a hash map.

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

Referenced by handle_dns_request().

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 210 of file gnunet-service-gns.c.

211{
212 const char *tld;
213
214 tld = strrchr (name,
215 (unsigned char) '.');
216 if (NULL == tld)
217 tld = name;
218 else
219 tld++; /* skip the '.' */
220 return tld;
221}
static char * name
Name (label) of the records to list.

References name, and GNS_TopLevelDomain::tld.

Referenced by handle_dns_request(), handle_gns_redirect_result(), and recursive_gns2dns_resolution().

Here is the caller graph for this function: