pike.git / lib / modules / NetUtils.pmod

version» Context lines:

pike.git/lib/modules/NetUtils.pmod:884:   //! Normalize the IP specified in @[a]. This normalizes IPv6   //! addresses and converts ::FFFF:<ipv4> and ::<ipv4> to "normal" IPV4   //! addresses.   //!   //! Will return 0 if @[a] is not a valid address.   string normalize_address( string a )   {    if( !a ) return 0;       array(string) seg = a/" "; -  int ip = NetUtils.string_to_ip( seg[0] ); +  int ip = string_to_ip( seg[0] );       if( ip == -1 )    return 0;    -  seg[0] = NetUtils.ip_to_string(ip); +  seg[0] = ip_to_string(ip);    return seg * " ";   }      //! Return an @[IpRangeLookup] instance useful for finding out the   //! address category of a ip. Basically like @[get_network_type]   //! without the "local" category.   IpRangeLookup special_networks()   {    if( !_special_networks )    {
pike.git/lib/modules/NetUtils.pmod:1049:   array(string) _sort_addresses(array(string) addresses,    array(NetworkType) exclude_types,    bool separate_v6,    array(NetworkType) connectable_types )   {    //1: group according to network type.    mapping(string:array(string)) tmp = ([]);    array(string) res = ({});       foreach( addresses, string ip ) -  tmp[NetUtils.get_network_type(ip,true)] += ({ ip }); +  tmp[get_network_type(ip,true)] += ({ ip });       //2: Delete ignored types    if( exclude_types )    {    m_delete(tmp, exclude_types[*] );    if( !separate_v6 )    m_delete(tmp, (exclude_types[*]+"v6")[*] );    }       //3: Sort