summary refs log tree commit diff
path: root/hesiod/hesiod.h
blob: 9c3d323811dacbf9656d094cd321425913e5ffc0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/* $Id$ */

/*
 * Copyright (c) 1996 by Internet Software Consortium.
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
 * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
 * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
 * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
 * SOFTWARE.
 */

#ifndef HESIOD__INCLUDED
#define HESIOD__INCLUDED

#include <sys/types.h>
#include <pwd.h>
#include <netdb.h>

/* Application-visible define to signal that we have the new interfaces. */
#define HESIOD_INTERFACES

struct hesiod_postoffice {
  char *hesiod_po_type;
  char *hesiod_po_host;
  char *hesiod_po_name;
};

int hesiod_init(void **context);
void hesiod_end(void *context);
char *hesiod_to_bind(void *context, const char *name, const char *type);
char **hesiod_resolve(void *context, const char *name, const char *type);
void hesiod_free_list(void *context, char **list);
struct passwd *hesiod_getpwnam(void *context, const char *name);
struct passwd *hesiod_getpwuid(void *context, uid_t uid);
void hesiod_free_passwd(void *context, struct passwd *pw);
struct servent *hesiod_getservbyname(void *context, const char *name,
				     const char *proto);
void hesiod_free_servent(void *context, struct servent *serv);
struct hesiod_postoffice *hesiod_getmailhost(void *context, const char *user);
void hesiod_free_postoffice(void *context, struct hesiod_postoffice *po);

/* Compatibility stuff. */

#define HES_ER_UNINIT	-1	/* uninitialized */
#define HES_ER_OK	0	/* no error */
#define HES_ER_NOTFOUND	1	/* Hesiod name not found by server */
#define HES_ER_CONFIG	2	/* local problem (no config file?) */
#define HES_ER_NET	3	/* network problem */

struct hes_postoffice {
  char *po_type;
  char *po_host;
  char *po_name;
};

int hes_init(void);
char *hes_to_bind(const char *name, const char *type);
char **hes_resolve(const char *name, const char *type);
int hes_error(void);
struct passwd *hes_getpwnam(const char *name);
struct passwd *hes_getpwuid(uid_t uid);
struct servent *hes_getservbyname(const char *name, const char *proto);
struct hes_postoffice *hes_getmailhost(const char *name);

#endif