1HESIOD(3) Library Functions Manual HESIOD(3)
2
3
4
6 hesiod_getservbyname, hesiod_free_servent - Hesiod functions for
7 retrieving service information
8
10 #include <hesiod.h>
11
12 struct servent *hesiod_getservbyname(void *context,
13 const char *name, const char *proto)
14 void hesiod_free_servent(void *context, struct servent *serv)
15
16 cc file.c -lhesiod
17
19 This family of functions allows you to retrieve service to port map‐
20 pings using Hesiod. To perform lookups, you need an initialized Hesiod
21 context; see hesiod(3) for details. Information is returned in the
22 same format as by getservbyname. It is the caller's responsibility to
23 call hesiod_free_servent with the returned service entry to free the
24 resources used by the service entry.
25
26 Hesiod queries for service information are made using the ``service''
27 Hesiod type, using the service name as the Hesiod name. The corre‐
28 sponding records should be space-separated lists of strings giving the
29 service name, protocol, port number (in decimal), and zero or more
30 aliases for the service. There may be multiple records per service
31 name; hesiod_getservbyname will pick the first one whose protocol
32 matches proto.
33
35 On failure, hesiod_getservbyname returns NULL and sets the global vari‐
36 able errno to indicate the error.
37
39 hesiod_getservbyname may fail for any of the reasons the routine hes‐
40 iod_resolve may fail.
41
43 hesiod(3)
44
45
46
47 30 November 1996 HESIOD(3)