Gets network entry by address.
Standard C Library (libc.a)
#include<netdb.h> int getnetbyaddr_r(net, type, netent, net_data) register in_addr_t net; register int type; struct netent *netent; struct netent_data *net_data;
The getnetbyaddr_r subroutine retrieves information from the /etc/networks file using the Name parameter as a search key.
The getnetbyaddr_r subroutine internally calls the getnetbyaddr subroutine and stores the information in the structure data.
The getnetbyaddr subroutine overwrites the static data returned in subsequent calls. The getnetbyaddr_r subroutine does not.
Use the endnetent_r subroutine to close the /etc/networks file.
Net | Specifies the number of the network to be located. |
Type | Specifies the address family for the network. The only supported values are AF_INET, and AF_INET6. |
netent | Points to the netent structure. |
net_data | Points to the net_data structure. |
The function returns a 0 if successful and a -1 if unsuccessful.
/etc/networks | Contains official network names. |
endnetent_r Subroutine, getnetbyname_r Subroutine, getnetent_r Subroutine, and setnetent_r Subroutine.