class PacketGen::Header::GRE
Generic Routing Encapsulation (RFC 2784 and 2890)
1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |C| |K|S| Reserved0 | Ver | Protocol Type | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Checksum (optional) | Reserved1 (Optional) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Key (optional) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Sequence Number (Optional) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
@author Sylvain Daubert @since 2.1.0
Constants
Public Class Methods
new(options={})
click to toggle source
Calls superclass method
PacketGen::Header::Base::new
# File lib/packetgen/header/gre.rb, line 64 def initialize(options={}) opts = { r: false, reserved0: 0, version: 0 }.merge(options) super(opts) end
Public Instance Methods
calc_checksum()
click to toggle source
Compute checksum and set checksum
field @return [Integer]
# File lib/packetgen/header/gre.rb, line 71 def calc_checksum sum = IP.sum16(self) self.checksum = IP.reduce_checksum(sum) end