Sha256: aa360624bb2f8af4d74481787689cfa5a88bb8022e2d8368bf2972b57860f1cf
Contents?: true
Size: 1.4 KB
Versions: 4
Compression:
Stored size: 1.4 KB
Contents
# This file is part of PacketGen # See https://github.com/sdaubert/packetgen for more informations # Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net> # This program is published under MIT license. # frozen_string_literal: true module PacketGen module Header # IEEE 802.1Q VLAN tagging # # A VLAN tag consists of: # * a {#tci Tag Control Information} ({Types::Int16}), # * a {#ethertype} ({Types::Int16}), # * and a body (a {Types::String} or another Header class). # # == Create a Dot1q header # # Create a IP packet in VLAN #43 # pkt = PacketGen.gen('Eth').add('Dot1q', vid: 43).add('IP') # @author Sylvain Daubert class Dot1q < Base # @!attribute tci # @return [Integer] 16-bit Tag Control Information define_field :tci, Types::Int16 # @!attribute ethertype # @return [Integer] 16-bit EtherType define_field :ethertype, Types::Int16 # @!attribute body # @return [Types::String,Header::Base] define_field :body, Types::String # @!attribute pcp # @return [Integer] 3-bit Priority Code Point from {#tci} # @!attribute dei # @return [Boolean] Drop Eligible Indicator from {#tci} # @!attribute vid # @return [Integer] 12-bit VLAN ID from {#tci} define_bit_fields_on :tci, :pcp, 3, :dei, :vid, 12 end Eth.bind_header Dot1q, ethertype: 0x8100 end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
packetgen-2.6.0 | lib/packetgen/header/dot1q.rb |
packetgen-2.5.2 | lib/packetgen/header/dot1q.rb |
packetgen-2.5.1 | lib/packetgen/header/dot1q.rb |
packetgen-2.5.0 | lib/packetgen/header/dot1q.rb |