Class IGRP
In: lib/l4/igrp.rb  (CVS)
Parent: RacketPart

$Id: igrp.rb 14 2008-03-02 05:42:30Z warchild $

Copyright (c) 2008, Jon Hart All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

    * Redistributions of source code must retain the above copyright
      notice, this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above copyright
      notice, this list of conditions and the following disclaimer in the
      documentation and/or other materials provided with the distribution.
    * Neither the name of the <organization> nor the
      names of its contributors may be used to endorse or promote products
      derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY Jon Hart ``AS IS’’ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Jon Hart BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Internet Gateway Routing Protocol: IGRP

www.cisco.com/warp/public/103/5.html

Every routing entry has the following fields:

  uchar number[3];       /* 3 significant octets of IP address */
  uchar delay[3];        /* delay, in tens of microseconds */
  uchar bandwidth[3];    /* bandwidth, in units of 1 Kbit/sec */
  uchar mtu[2];          /* MTU, in octets */
  uchar reliability;     /* percent packets successfully tx/rx */
  uchar load;            /* percent of channel occupied */
  uchar hopcount;        /* hop count */

Methods

Constants

IGRP_UPDATE = 1
IGRP_REQUEST = 2

Attributes

asystem    Autonomous system number
checksum    Checksum (IP)
edition    Serial number which is incremented whenever the routing table is updated.
nexterior    Number of exterior routes contained in this update message
ninterior    Number of interior routes contained in this update message
nsystem    Number of system routes contained in this update message
opcode    Type of the IGRP message contained in this packet.
payload    Payload. Generally unused.
version    Version of the IGRP message contained in this packet. Defaults to 1. Anything else is currently invalid

Public Class methods

[Source]

# File lib/l4/igrp.rb, line 65
  def initialize(*args)
    @interior_routes = []
    @system_routes = []
    @exterior_routes = []
    super
  end

Public Instance methods

Add an exterior route to this IGRP packet

[Source]

# File lib/l4/igrp.rb, line 85
  def add_exterior(ip, delay, bw, mtu, rel, load, hop)
    @exterior_routes << add_entry(ip, delay, bw, mtu, rel, load, hop)
    self.nexterior += 1
  end

Add an interior route to this IGRP packet

[Source]

# File lib/l4/igrp.rb, line 79
  def add_interior(ip, delay, bw, mtu, rel, load, hop)
    @interior_routes << add_entry(ip, delay, bw, mtu, rel, load, hop)
    self.ninterior += 1
  end

Add a system route to this IGRP packet

[Source]

# File lib/l4/igrp.rb, line 73
  def add_system(ip, delay, bw, mtu, rel, load, hop)
    @system_routes << add_entry(ip, delay, bw, mtu, rel, load, hop)
    self.nsystem += 1
  end

Compute and set the checksum of this IGRP packet

[Source]

# File lib/l4/igrp.rb, line 91
  def checksum! 
    self.checksum = compute_checksum
  end

Is the checksum correct?

[Source]

# File lib/l4/igrp.rb, line 96
  def checksum?
    self.checksum == compute_checksum
  end

Fix everything up in preparation for sending.

[Source]

# File lib/l4/igrp.rb, line 101
  def fix!
    [@interior_routes, @system_routes, @exterior_routes].flatten.each do |r|
      self.payload += r
    end
    checksum!
  end

[Validate]