Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

hesiod.conf(5)

bindsetup(8)

hesiod(3)

Name

hes_init, hes_to_bind, hes_error, hes_resolve - routines for using Hesiod

Syntax

#include <hesiod.h>

hes_init()

char *hes_to_bind(HesiodName, HesiodNameType)
char *HesiodName, *HesiodNameType;

hes_error()

har **hes_resolve(HesiodName, HesiodNameType)
char *HesiodName, *HesiodNameType;

Description

The hes_init() routine opens and reads the Hesiod configuration file, /etc/hesiod.conf to extract the left hand side and right hand side of the Hesiod name.

The hes_to_bind() routine takes as arguments a HesiodName and HesiodNameType and returns a fully qualified name to be handed to BIND.

The two most useful routines to the applications programmer are hes_error() and hes_resolve(). The hes_error() routine has no arguments and returns an integer which corresponds to a set of errors which can be found in hesiod.h file.

#define HES_ER_UNINIT           −1
#define HES_ER_OK                0
#define HES_ER_NOTFOUND          1
#define HES_ER_CONFIG            2
#define HES_ER_NET               3

The hes_resolve() routine resolves given names via the Hesiod name server.  It takes as arguments a name to be resolved, the HesiodName, and a type corresponding to the name, the HesiodNameType, and returns a pointer to an array of strings which contains all data that matched the query, one match per array slot.  The array is null terminated.

If applications require the data to be maintained throughout multiple calls to hes_resolve(), the data should be copied since another call to hes_resolve() will overwrite any previously-returned data.  A null is returned if the data cannot be found.

Examples

The following example shows the use of the Hesiod routines to obtain a Hesiod name from a Hesiod database:

#include <hesiod.h>
char *HesiodName, *HesiodNameType;
char **hp;
hp = hes_resolve(HesiodName, HesiodNameType);
if (hp == NULL) {
error = hes_error();
switch(error) {
.
.
.
}
}
else
process(hp);

Files

/etc/hesiod.conf
/usr/include/hesiod.h

See Also

hesiod.conf(5), bindsetup(8)
Guide to the BIND/Hesiod Service

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026