Class MakeIP2AS

java.lang.Object
  |
  +--MakeIP2AS

public class MakeIP2AS
extends java.lang.Object

MakeIP2AS.java Jim Gast, jgast@cs.wisc.edu MakeIP2AS takes command-line arguments. See: usage() This program constructs a tree for doing longest prefix match on IP addresses The output can be redirected to a file (typically IP2AS.txt). IP2AS file format: Each line consists of a canonical IPRange (always includes bitLength), and the ASnumber the range belongs to. 012.006.104.000/23 13625 This output line tells you that 12.6.104.0/23 is in AS13625 The input file is NOT expected to already be sorted by IPRange because BGP routing tables sometimes put /24 addresses ahead of the /23 that contains them! The output file contains leading zeroes so an alphabetic sort will give the same ordering as a numeric sort. The output file should be sorted to ensure all children come after their parents have already been put into the tree.


Field Summary
static java.text.DecimalFormat commas
           
static int debugLevel
          drives debugging output debugLevel = 5 traces actions in methods 4 logs method entry / exit 3 dumps structures 2 displays internal statistics 1 dumps final statistics
static int linesRead
           
static int rangesWritten
           
 
Constructor Summary
MakeIP2AS()
           
 
Method Summary
static void main(java.lang.String[] args)
          main method starts off with empty tables, builds a List of IPRanges and calculates the number of IP addresses that EXCLUSIVELY match that range.
static void readRoutingFile(java.io.InputStream sysIn)
          readRoutingFile reads lines of a BGP routing file until EOF.
static IPRange readRoutingLine(java.lang.String str)
          readRoutingLine finds all pairs of ASNumbers whether on best paths or worst.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

linesRead

public static int linesRead

rangesWritten

public static int rangesWritten

commas

public static java.text.DecimalFormat commas

debugLevel

public static int debugLevel
drives debugging output debugLevel = 5 traces actions in methods 4 logs method entry / exit 3 dumps structures 2 displays internal statistics 1 dumps final statistics

Constructor Detail

MakeIP2AS

public MakeIP2AS()
Method Detail

main

public static void main(java.lang.String[] args)
                 throws java.io.IOException
main method starts off with empty tables, builds a List of IPRanges and calculates the number of IP addresses that EXCLUSIVELY match that range. The IPCounts do not include ranges that are contained in other (more specific) routing entries.

Parameters:
args - options bgpRoutingTable
java.io.IOException

readRoutingFile

public static void readRoutingFile(java.io.InputStream sysIn)
readRoutingFile reads lines of a BGP routing file until EOF. The routing file is expected to have: # Lines that start with "#" are comments * Routings start with "*" For example, if the BGP input line is: 24.0.101.0/24 193.0.0.56 0 3333 1103 6453 1239 6172 ? The example shows that 24.0.101.0 is in ASN 6172.


readRoutingLine

public static IPRange readRoutingLine(java.lang.String str)
readRoutingLine finds all pairs of ASNumbers whether on best paths or worst. This routine parses the line and prints out one line for each adjacent pair of ASNumbers. By implication, there is a route that directly connects those Autonomous Systems in a single hop.