pr_gethostbyaddr.rst (1475B)
1 PR_GetHostByAddr 2 ================ 3 4 Looks up a host entry by its network address. 5 6 7 Syntax 8 ------ 9 10 .. code:: 11 12 #include <prnetdb.h> 13 14 PRStatus PR_GetHostByAddr( 15 const PRNetAddr *hostaddr, 16 char *buf, 17 PRIntn bufsize, 18 PRHostEnt *hostentry); 19 20 21 Parameters 22 ~~~~~~~~~~ 23 24 The function has the following parameters: 25 26 ``hostaddr`` 27 A pointer to the IP address of host in question. 28 ``buf`` 29 A pointer to a buffer, allocated by the caller, that is filled in 30 with host data on output. All of the pointers in the ``hostentry`` 31 structure point to data saved in this buffer. This buffer is 32 referenced by the runtime during a call to :ref:`PR_EnumerateHostEnt`. 33 ``bufsize`` 34 Number of bytes in the ``buf`` parameter. The buffer must be at least 35 :ref:`PR_NETDB_BUF_SIZE` bytes. 36 ``hostentry`` 37 This structure is allocated by the caller. On output, this structure 38 is filled in by the runtime if the function returns ``PR_SUCCESS``. 39 40 41 Returns 42 ~~~~~~~ 43 44 The function returns one of the following values: 45 46 - If successful, ``PR_SUCCESS``. 47 - If unsuccessful, ``PR_FAILURE``. You can retrieve the reason for the 48 failure by calling :ref:`PR_GetError`. 49 50 51 Description 52 ~~~~~~~~~~~ 53 54 :ref:`PR_GetHostByAddr` is used to perform reverse lookups of network 55 addresses. That is, given a valid network address (of type 56 :ref:`PRNetAddr`), :ref:`PR_GetHostByAddr` discovers the address' primary 57 name, any aliases, and any other network addresses for the same host.