inet_netof Subroutine

Purpose

Returns the network id of the given Internet address.

Library

Standard C Library (libc.a)

Syntax

#include <sys/socket.h>
#include <sys/socketvar.h>
#include <netinet/in.h>
#include <arpa/inet.h>

int inet_netof ( InternetAddr)
struct in_addr InternetAddr;

Description

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.

All applications containing the inet_netof subroutine must be compiled with the _BSD macro set to a specific value. Acceptable values are 43 and 44. In addition, all socket applications must include the BSD libbsd.a library.

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.

Parameters

Item Description
 InternetAddr Specifies the Internet address to separate.

Return Values

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.

Files

Item Description
 /etc/hosts Contains host names.
 /etc/networks Contains network names.