prhostent.rst (1865B)
1 PRHostEnt 2 ========= 3 4 A structure that defines a list of network addresses. This structure is 5 output from :ref:`PR_GetHostByName` and :ref:`PR_GetHostByAddr` and passed to 6 :ref:`PR_EnumerateHostEnt`. Clients should avoid directly accessing any of 7 the structure's fields. 8 9 10 Syntax 11 ------ 12 13 .. code:: 14 15 #include <prnetdb.h> 16 17 typedef struct PRHostEnt { 18 char *h_name; 19 char **h_aliases; 20 #if defined(_WIN32) 21 PRInt16 h_addrtype; 22 PRInt16 h_length; 23 #else 24 PRInt32 h_addrtype; 25 PRInt32 h_length; 26 #endif 27 char **h_addr_list; 28 } PRHostEnt; 29 30 31 Fields 32 ~~~~~~ 33 34 The structure has the following fields: 35 36 ``h_name`` 37 Pointer to the official name of host. 38 ``h_aliases`` 39 Pointer to a pointer to list of aliases. The list is terminated with 40 a ``NULL`` entry. 41 ``h_addrtype`` 42 Host address type. For valid NSPR usage, this field must have a value 43 indicating either an IPv4 or an IPv6 address. 44 ``h_length`` 45 Length of internal representation of the address in bytes. All of the 46 addresses in the list are of the same type and therefore of the same 47 length. 48 ``h_addr_list`` 49 Pointer to a pointer to a list of addresses from name server (in 50 network byte order). The list is terminated with a ``NULL`` entry. 51 52 53 Description 54 ----------- 55 56 This structure is used by many of the network address functions. All 57 addresses are passed in host order and returned in network order 58 (suitable for use in system calls). 59 60 Use the network address functions to manipulate the :ref:`PRHostEnt` 61 structure. To make the transition to IP version 6 easier, it's best to 62 treat :ref:`PRHostEnt` as an opaque structure. 63 64 Note 65 ---- 66 67 ``WINSOCK.H`` defines ``h_addrtype`` and ``h_length`` as a 16-bit field, 68 whereas other platforms treat it as a 32-bit field. The ``#ifdef`` in 69 the structure allows direct assignment of the :ref:`PRHostEnt` structure.