/* This file is part of PacketDotNet PacketDotNet is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. PacketDotNet is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with PacketDotNet. If not, see . */ /* * Copyright 2009 Chris Morgan */ namespace PacketDotNet { /// /// A struct containing length and position information about IPv6 Fields. /// public struct IPv6Fields { /// /// The IP Version, Traffic Class, and Flow Label field length. These must be in one /// field due to boundary crossings. /// public readonly static int VersionTrafficClassFlowLabelLength = 4; /// /// The payload length field length. /// public readonly static int PayloadLengthLength = 2; /// /// The next header field length, identifies protocol encapsulated by the packet /// public readonly static int NextHeaderLength = 1; /// /// The hop limit field length. /// public readonly static int HopLimitLength = 1; /// /// Address field length /// public readonly static int AddressLength = 16; /// /// The byte position of the field line in the IPv6 header. /// This is where the IP version, Traffic Class, and Flow Label fields are. /// public readonly static int VersionTrafficClassFlowLabelPosition = 0; /// /// The byte position of the payload length field. /// public readonly static int PayloadLengthPosition; /// /// The byte position of the next header field. (Replaces the ipv4 protocol field) /// public readonly static int NextHeaderPosition; /// /// The byte position of the hop limit field. /// public readonly static int HopLimitPosition; /// /// The byte position of the source address field. /// public readonly static int SourceAddressPosition; /// /// The byte position of the destination address field. /// public readonly static int DestinationAddressPosition; /// /// The byte length of the IPv6 Header /// public readonly static int HeaderLength; // == 40 /// /// Commutes the field positions. /// static IPv6Fields( ) { PayloadLengthPosition = VersionTrafficClassFlowLabelPosition + VersionTrafficClassFlowLabelLength; NextHeaderPosition = PayloadLengthPosition + PayloadLengthLength; HopLimitPosition = NextHeaderPosition + NextHeaderLength; SourceAddressPosition = HopLimitPosition + HopLimitLength; DestinationAddressPosition = SourceAddressPosition + AddressLength; HeaderLength = DestinationAddressPosition + AddressLength; } } }