HESIOD(3)
π HESIOD(3) π β the Hesiod name server interface library, but make it a group chat
okay bestie, so this is a Library Functions Manual page, section 3, and it's literally the whole Hesiod name server interface library. yes the whole thing. she's an icon, she's a legend, and she's about to tell you how to look stuff up.
β¨ NAME β¨
hesiod, hesiod_init, hesiod_resolve, hesiod_free_list, hesiod_to_bind, hesiod_free_string, hesiod_end β the Hesiod name server interface library. that's the whole squad, no cap.
π SYNOPSIS π
#include <hesiod.h>
int hesiod_init(void **context)
char **hesiod_resolve(void *context, const char *name,
const char *type)
void hesiod_free_list(void *context, char **list);
char *hesiod_to_bind(void *context, const char *name,
const char *type)
void hesiod_free_string(void *context, char *str);
char **hesiod_parse_result(void *context,
unsigned const char *result, int rlen)
void hesiod_end(void *context)
cc file.c -lhesiod
π¦ DESCRIPTION π¦
so like. this whole little family of functions lets you do lookups of Hesiod information, which is stored as text records in the Domain Name Service. yes, DNS is carrying extra baggage, she's versatile like that π
to do literally any of this, you gotta initialize a context first. a context is an opaque object β lowkey mysterious, main character energy β that stores info the library uses internally between calls. hesiod_init initializes a context, and it stores a pointer to that context in the location pointed to by the context argument. then when you're done, hesiod_end frees the resources used by a context. clean up after yourself bestie, it's giving self-care π«Ά
hesiod_resolve is the primary interface to the library. if it succeeds, it returns a list of one or more strings giving the records matching name and type. and the last element of the list is followed by a NULL pointer β that's your little end-of-list bow π. it is the caller's responsibility to call hesiod_free_list to free the resources used by the returned list. no one else is gonna do it for you, periodt.
hesiod_to_bind converts name and type into the DNS name used by hesiod_resolve. it is the caller's responsibility to free the returned string using hesiod_free_string.
hesiod_parse_result parses the result of a name server query into text records. and yup, it is the caller's responsibility to call hesiod_free_list to free the resources used by the returned list. the theme of today is: free your stuff π§
β RETURN VALUES β
if it goes well, hesiod_init returns 0. if not? it returns -1 and sets errno to indicate the error. dramatic but fair.
on failure, hesiod_resolve and hesiod_to_bind return NULL and set the global variable errno to indicate the error. that's your vibe check failing, bestie π
πΈ ENVIRONMENT πΈ
- if the environment variable
HES_DOMAINis set, it will override the domain in the Hesiod configuration file. - if the environment variable
HESIOD_CONFIGis set, it specifies the location of the Hesiod configuration file.
π SEE ALSO π
Hesiod - Project Athena Technical Plan -- Name Servicenamed(8)hesiod.conf(5)
go read those too, iykyk π
π ERRORS π
Hesiod calls may fail because of:
ENOMEMβ insufficient memory was available to carry out the requested operation. she's hungry, she needs RAM πENOEXECβhesiod_initfailed because the Hesiod configuration file was invalid.ECONNREFUSEDβhesiod_resolvefailed because no name server could be contacted to answer the query. nobody picked up the phone πEMSGSIZEβhesiod_resolveorhesiod_to_bindfailed because the query or response was too big to fit into the packet buffers. too much, too much πENOENTβhesiod_resolvefailed because the name server had no text records matchingnameandtype, orhesiod_to_bindfailed because thenameargument had a domain extension which could not be resolved with typerhs-extensionin the local Hesiod domain.EINVALβhesiod_to_bindfailed to convert the resulting domain name from UTF-8 to an internationalized domain name.
π AUTHOR π
- Steve Dyer, IBM/Project Athena
- Greg Hudson, MIT Team Athena
- Copyright 1987, 1988, 1995, 1996, 2000 by the Massachusetts Institute of Technology.
legends, fr fr π
π BUGS π
the strings corresponding to the errno values set by the Hesiod functions are not particularly indicative of what went wrong β especially for ENOEXEC and ENOENT. so like. the error messages are vague. you're gonna have to actually think about it. sorry bestie, that's just the truth of it π
and that's the whole page!! she's from 30 November 1996, she's filed under HESIOD(3), and she ate, no crumbs. mwah πβ¨ππ¦
π¦ where this page comes from
- debian bookworm: libhesiod-dev 3.2.1-4
- debian trixie: libhesiod-dev 3.2.1-5
- ubuntu jammy: libhesiod-dev 3.2.1-3.1build1
- ubuntu noble: libhesiod-dev 3.2.1-4build1
- ubuntu questing: libhesiod-dev 3.2.1-5
- ubuntu resolute: libhesiod-dev 3.2.1-5build1
- ubuntu stonking: libhesiod-dev 3.2.1-5build1
- Copyright 1988, 1996, 2000 by the Massachusetts Institute of Technology
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms