#!/usr/bin/env awk
#
# Tests whether an IPv4 address lies between low and high (included)
#
# Dependencies:
#   - None
#
# Examples:
#   - tawk 'ipinrange($SrcIP4, "192.168.1.0", "192.168.1.255")' file.txt

@include "ip2num"

function ipinrange(ip, low, high,        _ipnum) {
    _ipnum = ip2num(ip)
    return _ipnum >= ip2num(low) && _ipnum <= ip2num(high)
}
