/* 
 * netmask.h
 *
 * x-kernel v3.3
 *
 * Copyright (c) 1993,1991,1990,1996  Arizona Board of Regents
 *
 * $Revision: 1.2 $
 * $Date: 1996/01/29 20:25:55 $
 */

#ifndef netmask_h
#define netmask_h

/* Public interface to the 'netmask' module */

/* netMaskAdd -- add 'mask' to the table as the netmask for 'net' */
#ifdef __STDC__
int netMaskAdd(IPhost *net, IPhost *mask);
#else
int netMaskAdd();
#endif

/* 
 * netMaskInit -- initialize the netmask table.  Must be called before any
 * other netmask routines.
 */
#ifdef __STDC__
void netMaskInit(void);
#else
void netMaskInit();
#endif

/* 
 * netMaskFind -- Set 'mask' to the netmask for 'host'.  If an appropriate
 * netmask is not in the table, a default netmask based on the address class
 * is used.
 */
#ifdef __STDC__
void netMaskFind(IPhost *mask, IPhost *host);
#else
void netMaskFind();
#endif

/* 
 * netMaskDefault -- Set 'mask' to the default netmask for 'host'.
 * This differs from the result of netMaskFind only if subnets are being used.
 */
#ifdef __STDC__
void netMaskDefault(IPhost *mask, IPhost *host);
#else
void netMaskDefault();
#endif

/* 
 * netMaskSubnetsEqual -- returns non-zero if the two hosts are on the 
 * same subnet
 */
#ifdef __STDC__
int netMaskSubnetsEqual(IPhost *, IPhost *);
#else
int netMaskSubnetsEqual();
#endif

/* netMaskNetsEqual -- returns non-zero if the two hosts are on the same net */
#ifdef __STDC__
int netMaskNetsEqual(IPhost *, IPhost *);
#else
int netMaskNetsEqual();
#endif

/* 
 * netMaskIsBroadcast -- returns non-zero if the host is a broadcast address. 
 * address for its subnet.  A broadcast address is defined as:
 *
 *	1) having all ones or all zeroes in its host component 
 *	2) having all ones or all zeroes in the host component using the
 *	   default network mask for that address (this catches
 *	   'full network broadcast addresses' in the presence of subnets.)
 *  or	3) having ones in the entire address
 */
#ifdef __STDC__
int netMaskIsBroadcast(IPhost *);
#else
int netMaskIsBroadcast();
#endif

extern IPhost IP_LOCAL_BCAST;

#endif /* netmask_h */
