예제 #1
0
 private ushort CalculateTransportChecksum()
 {
     return(IpV4Datagram.CalculateTransportChecksum(this.Buffer, this.StartOffset, this.HeaderLength, (ushort)this.Transport.Length, this.Transport.ChecksumOffset, this.Transport.IsChecksumOptional, this.Destination));
 }
예제 #2
0
        internal static void WriteTransportChecksum(byte[] buffer, int offset, int headerLength, ushort transportLength, int transportChecksumOffset, bool isChecksumOptional, ushort?checksum, IpV4Address destination)
        {
            ushort?nullable = checksum;
            ushort num      = !(nullable.HasValue ? new int?((int)nullable.GetValueOrDefault()) : new int?()).HasValue ? IpV4Datagram.CalculateTransportChecksum(buffer, offset, headerLength, transportLength, transportChecksumOffset, isChecksumOptional, destination) : checksum.Value;

            ByteArrayExtensions.Write(buffer, offset + headerLength + transportChecksumOffset, num, Endianity.Big);
        }