1HESIOD(3) Library Functions Manual HESIOD(3)
2
3
4
6 hesiod, hesiod_init, hesiod_resolve, hesiod_free_list, hesiod_to_bind,
7 hesiod_free_string, hesiod_end - Hesiod name server interface library
8
10 #include <hesiod.h>
11
12 int hesiod_init(void **context)
13 char **hesiod_resolve(void *context, const char *name,
14 const char *type)
15 void hesiod_free_list(void *context, char **list);
16 char *hesiod_to_bind(void *context, const char *name,
17 const char *type)
18 void hesiod_free_string(void *context, char *str);
19 char **hesiod_parse_result(void *context,
20 unsigned const char *result, int rlen)
21 void hesiod_end(void *context)
22
23 cc file.c -lhesiod
24
26 This family of functions allows you to perform lookups of Hesiod infor‐
27 mation, which is stored as text records in the Domain Name Service. To
28 perform lookups, you must first initialize a context, an opaque object
29 which stores information used internally by the library between calls.
30 hesiod_init initializes a context, storing a pointer to the context in
31 the location pointed to by the context argument. hesiod_end frees the
32 resources used by a context.
33
34 hesiod_resolve is the primary interface to the library. If successful,
35 it returns a list of one or more strings giving the records matching
36 name and type. The last element of the list is followed by a NULL
37 pointer. It is the caller's responsibility to call hesiod_free_list to
38 free the resources used by the returned list.
39
40 hesiod_to_bind converts name and type into the DNS name used by hes‐
41 iod_resolve. It is the caller's responsibility to free the returned
42 string using hesiod_free_string.
43
44 hesiod_parse_result parses the result of a name server query into text
45 records. It is the caller's responsibility to call hesiod_free_list to
46 free the resources used by the returned list.
47
49 If successful, hesiod_init returns 0; otherwise it returns -1 and sets
50 errno to indicate the error. On failure, hesiod_resolve and hes‐
51 iod_to_bind return NULL and set the global variable errno to indicate
52 the error.
53
55 If the environment variable HES_DOMAIN is set, it will override the
56 domain in the Hesiod configuration file. If the environment variable
57 HESIOD_CONFIG is set, it specifies the location of the Hesiod configu‐
58 ration file.
59
61 `Hesiod - Project Athena Technical Plan -- Name Service', named(8),
62 hesiod.conf(5)
63
65 Hesiod calls may fail because of:
66
67 ENOMEM Insufficient memory was available to carry out the requested
68 operation.
69
70 ENOEXEC
71 hesiod_init failed because the Hesiod configuration file was
72 invalid.
73
74 ECONNREFUSED
75 hesiod_resolve failed because no name server could be contacted
76 to answer the query.
77
78 EMSGSIZE
79 hesiod_resolve or hesiod_to_bind failed because the query or
80 response was too big to fit into the packet buffers.
81
82 ENOENT hesiod_resolve failed because the name server had no text
83 records matching name and type, or hesiod_to_bind failed because
84 the name argument had a domain extension which could not be
85 resolved with type ``rhs-extension'' in the local Hesiod domain.
86
88 Steve Dyer, IBM/Project Athena
89 Greg Hudson, MIT Team Athena
90 Copyright 1987, 1988, 1995, 1996, 2000 by the Massachusetts Institute
91 of Technology.
92
94 The strings corresponding to the errno values set by the Hesiod func‐
95 tions are not particularly indicative of what went wrong, especially
96 for ENOEXEC and ENOENT.
97
98
99
100 30 November 1996 HESIOD(3)