[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]

Technical Reference: Communications, Volume 2


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.

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


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.

Implementation Specifics

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.

Files


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

Related Information

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 5L Version 5.1 Communications Programming Concepts.


[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]