+ |
+
+
+
+ abbrev ( inet )
+ text
+
+ Creates an abbreviated display format as text.
+ (The result is the same as the inet output function
+ produces; it is abbreviated
only in comparison to the
+ result of an explicit cast to text, which for historical
+ reasons will never suppress the netmask part.)
+
+ abbrev(inet '10.1.0.0/32')
+ 10.1.0.0
+
+
+
+ |
+
+ abbrev ( cidr )
+ text
+
+ Creates an abbreviated display format as text.
+ (The abbreviation consists of dropping all-zero octets to the right
+ of the netmask; more examples are in
+ .)
+
+ abbrev(cidr '10.1.0.0/16')
+ 10.1/16
+
+
+
+ |
+
+
+
+ broadcast ( inet )
+ inet
+
+ Computes the broadcast address for the address's network.
+
+ broadcast(inet '192.168.1.5/24')
+ 192.168.1.255/24
+
+
+
+ |
+
+
+
+ family ( inet )
+ integer
+
+ Returns the address's family: 4 for IPv4,
+ 6 for IPv6.
+
+ family(inet '::1')
+ 6
+
+
+
+ |
+
+
+
+ host ( inet )
+ text
+
+ Returns the IP address as text, ignoring the netmask.
+
+ host(inet '192.168.1.0/24')
+ 192.168.1.0
+
+
+
+ |
+
+
+
+ hostmask ( inet )
+ inet
+
+ Computes the host mask for the address's network.
+
+ hostmask(inet '192.168.23.20/30')
+ 0.0.0.3
+
+
+
+ |
+
+
+
+ inet_merge ( inet, inet )
+ cidr
+
+ Computes the smallest network that includes both of the given networks.
+
+ inet_merge(inet '192.168.1.5/24', inet '192.168.2.5/24')
+ 192.168.0.0/22
+
+
+
+ |
+
+
+
+ inet_same_family ( inet, inet )
+ boolean
+
+ Tests whether the addresses belong to the same IP family.
+
+ inet_same_family(inet '192.168.1.5/24', inet '::1')
+ f
+
+
+
+ |
+
+
+
+ masklen ( inet )
+ integer
+
+ Returns the netmask length in bits.
+
+ masklen(inet '192.168.1.5/24')
+ 24
+
+
+
+ |
+
+
+
+ netmask ( inet )
+ inet
+
+ Computes the network mask for the address's network.
+
+ netmask(inet '192.168.1.5/24')
+ 255.255.255.0
+
+
+
+ |
+
+
+
+ network ( inet )
+ cidr
+
+ Returns the network part of the address, zeroing out
+ whatever is to the right of the netmask.
+ (This is equivalent to casting the value to cidr.)
+
+ network(inet '192.168.1.5/24')
+ 192.168.1.0/24
+
+
+
+ |
+
+
+
+ set_masklen ( inet, integer )
+ inet
+
+ Sets the netmask length for an inet value.
+ The address part does not change.
+
+ set_masklen(inet '192.168.1.5/24', 16)
+ 192.168.1.5/16
+
+
+
+ |
+
+ set_masklen ( cidr, integer )
+ cidr
+
+ Sets the netmask length for a cidr value.
+ Address bits to the right of the new netmask are set to zero.
+
+ set_masklen(cidr '192.168.1.0/24', 16)
+ 192.168.0.0/16
+
+
+
+ |
+
+
+
+ text ( inet )
+ text
+
+ Returns the unabbreviated IP address and netmask length as text.
+ (This has the same result as an explicit cast to text.)
+
+ text(inet '192.168.1.5')
+ 192.168.1.5/32
+
+
+