MIT Information Systems

Macintosh Development

[Home] [About Us] [People] [Information Systems]
[Kerberos for Macintosh] [Applications] [Miscellaneous Documentation]


Hesiod Library API

hesiod_init()

int hesiod_init (void **context);
Arguments: context is the address of a void* that will be passed to all of the other hesiod library functions. context is used to store internal state for this particular use of the hesiod library.
Returns: 0 on success, -1 on failure.
Description: Initializes the hesiod library.

hesiod_end()

void hesiod_end(void *context);
Arguments: context is the value passed to hesiod_init().
Returns: nothing.
Description: Shuts down the hesiod library. It releases all memory and other state created by hesiod_init(). Call this function when you are permantently done with the hesiod library.


hesiod_to_bind()

char *hesiod_to_bind (void *context, const char *name, const char *type);
Arguments: context is the value passed to hesiod_init(). name is a hesiod name. type is a hesiod type. Hesiod names and types are documented in the Hesiod Types List.
Returns: A DNS name. This must be freed by the user using free(). Description: This function converts name and type into the DNS name used by hesiod_resolve().

hesiod_resolve()

char **hesiod_resolve (void *context, const char *name, const char *type);
Arguments: context is the value passed to hesiod_init(). name is a hesiod name. type is a hesiod type. Hesiod names and types are documented in the Hesiod Types List.
Returns: an array of N null-terminated strings, with the N+1th element being NULL. On failure, it returns NULL. This list must be freed with hesiod_free_list().
Description: This function is the main interface to the hesiod library. It returns a list of matches to the hesiod lookup of name and type.

hesiod_free_list()

void hesiod_free_list (void *context, char **list);
Arguments: context is the value passed to hesiod_init(). list is the list to free.
Returns: nothing.
Description: Frees the list of strings returned by hesiod_resolve().


hesiod_getpwnam

struct passwd *hesiod_getpwnam(void *context, const char *name);
Arguments: context is the value passed to hesiod_init(). name is the username to look up.
Returns: A passwd containing user information for name. This must be freed with hesiod_free_passwd().
Description: Given a username, this returns user information, including uid, shell, homedir, and other information. This is similar to the unix system call getpwnam.

hesiod_getpwuid

struct passwd *hesiod_getpwuid(void *context, uid_t uid);
Arguments: context is the value passed to hesiod_init(). uid is the uid to look up.
Returns: A passwd containing user information for uid. This must be freed with hesiod_free_passwd().
Description: Given a uid, this returns user information, including username, shell, homedir, and other information. This is similar to the unix system call getpwuid.

hesiod_free_passwd

void hesiod_free_passwd(void *context, struct passwd *pw);
Arguments: context is the value passed to hesiod_init(). pw is a value returned by hesiod_getpwnam or hesiod_getpwuid.
Returns: nothing.
Description: This frees the memory used by pw.


hesiod_getservbyname

struct servent *hesiod_getservbyname(void *context, const char *name, const char *proto);
Arguments: context is the value passed to hesiod_init(). name is the name of the service. proto is the name of the protocol, such as "tcp".
Returns: A pointer to a struct servent containing inormation about the service. This should be freed with hesiod_free_servent() when you are done with it.
Description: Used to obtain information about a network service. Similar to the standard unix getservbyname() call.

hesiod_free_servent

void hesiod_free_servent(void *context, struct servent *serv);
Arguments: context is the value passed to hesiod_init(). serv is a value returned by hesiod_getservbyname().
Returns: nothing.
Description: Frees memory used by a struct servent returned by hesiod_getservbyname.


hesiod_getmailhost

struct hesiod_postoffice *hesiod_getmailhost(void *context, const char *user);
Arguments: context is the value passed to hesiod_init(). user is the username of the person you want information on.
Returns: A pointer to a struct hesiod_postoffice containing information about the user's maildrop. This must be freed with hesiod_free_postoffice.
Description: Gets information on how the user reads their mail.

hesiod_free_postoffice

void hesiod_free_postoffice(void *context, struct hesiod_postoffice *po);
Arguments: context is the value passed to hesiod_init(). po is a value returned by hesiod_getmailhost().
Returns: nothing.
Description: Frees memory used by a struct hesiod_postoffice returned by hesiod_getmailhost.


Questions or comments? Send mail to macdev@mit.edu
Last updated on $Date: 2003/11/19 20:49:34 $
Last modified by $Author: smcguire $