HESIOD(3)

πŸ“¦
version 3.2.1 Β· 2 versions
  • 3.2.1 Β· debian bookworm, debian trixie, ubuntu jammy, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking (latest)
  • 3.2.1 Β· centos-stream 9
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– 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_DOMAIN is set, it will override the domain in the Hesiod configuration file.
  • if the environment variable HESIOD_CONFIG is set, it specifies the location of the Hesiod configuration file.

🌈 SEE ALSO 🌈

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_init failed because the Hesiod configuration file was invalid.
  • ECONNREFUSED β€” hesiod_resolve failed because no name server could be contacted to answer the query. nobody picked up the phone πŸ™ˆ
  • EMSGSIZE β€” hesiod_resolve or hesiod_to_bind failed because the query or response was too big to fit into the packet buffers. too much, too much πŸ’…
  • ENOENT β€” hesiod_resolve failed because the name server had no text records matching name and type, or hesiod_to_bind failed because the name argument had a domain extension which could not be resolved with type rhs-extension in the local Hesiod domain.
  • EINVAL β€” hesiod_to_bind failed 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