ipv4_network_int64¶
Description¶
Given an IPv4 address string in dotted-quad format, possibly with a slash-masksize trailing component, convert the address to an integer representing the address in big-endian (network) byte order, masked either to the slash-mashsize mask, or to the natural class A, B, C, or private network format.
Using this function you can decode CIDR network addresses, as well as classic “class” and “private” subnet addresses.
Masks formats, and derived masks, are:
Value |
Mask |
Explanation |
---|---|---|
8.8.4.4 |
255.0.0.0 |
Class A |
10.0.0.0 |
255.0.0.0 |
Private 10.x.y.z |
10.0.0.0/16 |
255.255.0.0 |
Mask /16 |
127.0.0.1 |
255.0.0.0 |
Class A |
127.0.0.1/24 |
255.255.255.0 |
Mask /24 |
128.1.2.3 |
255.255.0.0 |
Class B |
172.30.2.3 |
255.240.0.0 |
Private 172.{16-31}.x.y |
192.168.0.3 |
255.255.0.0 |
Private 192.168.x.y |
200.1.2.3 |
255.255.255.0 |
Class C |
Return type¶
int64
Domain¶
This is a scalar function (calculates a single output value for a single input row.)
Categories¶
Usage¶
ipv4_network_int64( ipv4 )
Argument |
Type |
Required |
Multiple |
Constant |
---|---|---|---|---|
ipv4 |
string |
Required |
Only one |
Variable |
Examples¶
make_col ipint:ipv4_network_int64(ipstr)
Assuming there’s a string input column with IP addresses, outputs the corresponding network addresses as integers in network byte order.
ipstr (input) |
ipint (output) |
---|---|
8.8.4.4 |
134217728 |
10.0.0.1 |
167772160 |
10.0.0.1/16 |
167772160 |
127.0.0.1 |
2130706432 |
127.0.0.1/24 |
2130706432 |
128.1.2.3 |
2147549184 |
172.30.2.3 |
2887647232 |
192.168.0.3 |
3232235520 |
200.1.2.3 |
3355509248 |
1.2.3.300 |
null |
1.2.3.4.5 |
null |
1.2.3 |
null |
localhost |
null |