/* 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 { /// /// Defines the lengths and positions of the udp fields within /// a udp packet /// public struct UdpFields { /// Length of a UDP port in bytes. public readonly static int PortLength = 2; /// Length of the header length field in bytes. public readonly static int HeaderLengthLength = 2; /// Length of the checksum field in bytes. public readonly static int ChecksumLength = 2; /// Position of the source port. public readonly static int SourcePortPosition = 0; /// Position of the destination port. public readonly static int DestinationPortPosition; /// Position of the header length. public readonly static int HeaderLengthPosition; /// Position of the header checksum length. public readonly static int ChecksumPosition; /// Length of a UDP header in bytes. public readonly static int HeaderLength; // == 8 static UdpFields() { DestinationPortPosition = PortLength; HeaderLengthPosition = DestinationPortPosition + PortLength; ChecksumPosition = HeaderLengthPosition + HeaderLengthLength; HeaderLength = ChecksumPosition + ChecksumLength; } } }