Returns the network id of the given Internet address.
#include <sys/socket.h> #include <sys/socketvar.h> #include <netinet/in.h> #include <arpa/inet.h> int inet_netof (InternetAddr) struct in_addr InternetAddr;
The inet_netof subroutine returns the network number from the specified Internet address number typed as unsigned long value. The inet_netof subroutine masks off the network number and the host number from the Internet address based on the Internet address class.
Note: The application assumes responsibility for verifying that the network number and the host number for the Internet address conforms to a class A or B or C Internet address. The inet_netof subroutine processes any other number as a class C address.
InternetAddr | |
Specifies the Internet address to separate. |
Upon successful completion, the inet_netof subroutine returns a network number from the specified long value representing the Internet address. If the application gives a class A Internet address, the inet_lnoaf subroutine returns the logical product of the Internet address and 0xFF000000. If the application gives a class B Internet address, the inet_lnoaf subroutine returns the logical product of the Internet address and 0xFFFF0000. If the application does not give a class A or B Internet address, the inet_lnoaf subroutine returns the logical product of the Internet address and 0xFFFFFF00.
The inet_netof subroutine is part of Base Operating System (BOS) Runtime.
All applications containing the inet_netof subroutine must be compiled with _BSD set to a specific value. Acceptable values are 43 and 44. In addition, all socket applications must include the BSD libbsd.a library.
/etc/hosts | |
Contains host names. | |
/etc/networks | |
Contains network names. |
The endhostent subroutine, endnetent subroutine, gethostbyaddr subroutine, gethostbyname subroutine, getnetbyaddr subroutine, getnetbyname subroutine, getnetent subroutine, inet_addr subroutine, inet_lnaof subroutine, inet_makeaddr subroutine, inet_network subroutine, inet_ntoa subroutine, sethostent subroutine, setnetent subroutine.
Sockets Overview and Understanding Network Address Translation in AIX Version 4.3 Communications Programming Concepts.