Class BGPReader

java.lang.Object
  |
  +--BGPReader

public class BGPReader
extends java.lang.Object

BGPReader.java Jim Gast, jgast@cs.wisc.edu.

This program extracts all Best Paths from a BGP table (or all of the paths, if you choose not to use bestOnly)

A BGPReader reads lines of a BGP routing file until EOF. The BGP routing file is expected to have:

The only tricky part is that the destination IP address is not repeated if it is the same as the prior line.

Example:

  24.0.101.0/24    193.0.0.56                             0 3333 1103 6453 1239 6172 ?
                   134.55.24.6                            0 293 1800 1239 6172 ?
>                  144.228.240.93          35             0 1239 6172 ?
  The example shows 3 routes to 24.0.101.0/24.  The third is the "best route".
 


Field Summary
static boolean ALL_PATHS
           
static boolean BEST_ONLY
           
static java.lang.String DEFAULT_FILE
           
 
Constructor Summary
BGPReader()
           
BGPReader(boolean bestOnly)
           
BGPReader(java.lang.String fileName)
           
BGPReader(java.lang.String fileName, boolean bestOnly)
           
 
Method Summary
 void close()
           
static int discoverBitLength(java.lang.String str)
          determine the number of bits in the subnet mask for a given IP address
 java.lang.String discoverDest(java.lang.String str)
           
 java.lang.String getDest()
           
 java.lang.String getFileName()
           
static void main(java.lang.String[] args)
          main method is used for testing the class
 java.lang.String readBGPLine()
           
 boolean ready()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_FILE

public static final java.lang.String DEFAULT_FILE
See Also:
Constant Field Values

BEST_ONLY

public static final boolean BEST_ONLY
See Also:
Constant Field Values

ALL_PATHS

public static final boolean ALL_PATHS
See Also:
Constant Field Values
Constructor Detail

BGPReader

public BGPReader(java.lang.String fileName,
                 boolean bestOnly)

BGPReader

public BGPReader(boolean bestOnly)

BGPReader

public BGPReader(java.lang.String fileName)

BGPReader

public BGPReader()
Method Detail

readBGPLine

public java.lang.String readBGPLine()
                             throws java.io.IOException
java.io.IOException

getDest

public java.lang.String getDest()

ready

public boolean ready()

close

public void close()

getFileName

public java.lang.String getFileName()

discoverDest

public java.lang.String discoverDest(java.lang.String str)

discoverBitLength

public static int discoverBitLength(java.lang.String str)
determine the number of bits in the subnet mask for a given IP address


main

public static void main(java.lang.String[] args)
                 throws java.io.IOException
main method is used for testing the class

java.io.IOException