xref: /netbsd-src/external/bsd/libbind/dist/doc/getnameinfo.cat3 (revision 5bbd2a12505d72a8177929a37b5cee489d0a1cfd)
1*5bbd2a12SchristosGETNAMEINFO(3)         FreeBSD Library Functions Manual         GETNAMEINFO(3)
2b5677b36Schristos
3b5677b36SchristosNNAAMMEE
4*5bbd2a12Schristos     ggeettnnaammeeiinnffoo -- address-to-name translation in protocol-independent manner
5b5677b36Schristos
6b5677b36SchristosSSYYNNOOPPSSIISS
7b5677b36Schristos     ##iinncclluuddee <<ssyyss//ssoocckkeett..hh>>
8b5677b36Schristos     ##iinncclluuddee <<nneettddbb..hh>>
9b5677b36Schristos
10b5677b36Schristos     _i_n_t
11b5677b36Schristos     ggeettnnaammeeiinnffoo(_c_o_n_s_t _s_t_r_u_c_t _s_o_c_k_a_d_d_r _*_s_a, _s_o_c_k_l_e_n___t _s_a_l_e_n, _c_h_a_r _*_h_o_s_t,
12b5677b36Schristos         _s_i_z_e___t _h_o_s_t_l_e_n, _c_h_a_r _*_s_e_r_v, _s_i_z_e___t _s_e_r_v_l_e_n, _i_n_t _f_l_a_g_s);
13b5677b36Schristos
14b5677b36SchristosDDEESSCCRRIIPPTTIIOONN
15b5677b36Schristos     The ggeettnnaammeeiinnffoo() function is defined for protocol-independent address-
16b5677b36Schristos     to-nodename translation.  It performs functionality of gethostbyaddr(3)
17b5677b36Schristos     and getservbyport(3) in more sophisticated manner.
18b5677b36Schristos
19b5677b36Schristos     The _s_a arguement is a pointer to a generic socket address structure of
20b5677b36Schristos     size _s_a_l_e_n.  The arguements _h_o_s_t and _s_e_r_v are pointers to buffers to hold
21b5677b36Schristos     the return values.  Their sizes are specified by _h_o_s_t_l_e_n and _s_e_r_v_l_e_n
22b5677b36Schristos     repectively.  Either _h_o_s_t or _s_e_r_v may be NULL if the hostname  or service
23b5677b36Schristos     name is not required.
24b5677b36Schristos
25b5677b36Schristos     The _f_l_a_g_s arguement modifies the behaviour of ggeettnnaammeeiinnffoo() as follows:
26b5677b36Schristos
27b5677b36Schristos     If NI_NOFQDN is set only the unqualified hostname is returned for local
28b5677b36Schristos     fully qualified names.
29b5677b36Schristos
30b5677b36Schristos     If NI_NUMERICHOST is set then the numeric form of the hostname is
31b5677b36Schristos     returned.
32b5677b36Schristos
33b5677b36Schristos     If NI_NAMEREQD is set, then a error is returned if the hostname cannot be
34b5677b36Schristos     looked up.
35b5677b36Schristos
36b5677b36Schristos     If NI_NUMERICSERV is set then the service is returned in numeric form.
37b5677b36Schristos
38b5677b36Schristos     If NI_DGRAM is set then the service is UDP based rather than TCP based.
39b5677b36Schristos
40b5677b36SchristosSSEEEE AALLSSOO
41b5677b36Schristos     getaddrinfo(3), gethostbyaddr(3), getservbyport(3), hosts(5),
42b5677b36Schristos     services(5), hostname(7),
43b5677b36Schristos
44*5bbd2a12Schristos     R. Gilligan, S.  Thomson, J. Bound, and W. Stevens, ``Basic Socket Inter-
45*5bbd2a12Schristos     face Extensions for IPv6,'' RFC2133, April 1997.
46b5677b36Schristos
47b5677b36SchristosSSTTAANNDDAARRDDSS
48*5bbd2a12Schristos     The ggeettaaddddrriinnffoo() function is defined IEEE POSIX 1003.1g draft specifica-
49*5bbd2a12Schristos     tion, and documented in ``Basic Socket Interface Extensions for IPv6''
50b5677b36Schristos     (RFC2133).
51b5677b36Schristos
52*5bbd2a12Schristos                               January 11, 1999
53