Construct a host mask for an IPV4 or IPV6 network.

HOSTMASK(address, integer)
HOSTMASK(address, integer)

where address is an IPV4 or IPV6 address or expression, and integer is the subnet mask. The integer values must be in the range of 0 to 32 for IPV4 and 0 to 128 for IPV6.

To specify a constant value for the address argument, use the IPV4 or IPV6 keyword.

For example:
premdb=# select hostip, hostmask(hostip,24) from myhosts;
   hostip    | hostmask 
-------------+----------  |  | | |
(4 rows)

premdb=# select hostip, ipv4_hostmask(hostip,32) from myhosts;
   hostip    | ipv4_hostmask 
-------------+---------------  |  | | |
(4 rows)
premdb=# select hostmask(ipv6 '2001:0db8:85a3:0000:0000:8a2e:0370:7334',24) from sys.const;
(1 row)