|
| 1 | +// Licensed to the .NET Foundation under one or more agreements. |
| 2 | +// The .NET Foundation licenses this file to you under the MIT license. |
| 3 | + |
| 4 | +using System; |
| 5 | + |
| 6 | +namespace Microsoft.Quic; |
| 7 | + |
| 8 | +internal partial struct QUIC_SETTINGS : System.IEquatable<QUIC_SETTINGS> |
| 9 | +{ |
| 10 | + // Because QUIC_SETTINGS may contain gaps due to layout/alignment of individual |
| 11 | + // fields, we implement IEquatable<QUIC_SETTINGS> manually. If a new field is added, |
| 12 | + // then there is a unit test which should fail. |
| 13 | + |
| 14 | + public readonly bool Equals(QUIC_SETTINGS other) |
| 15 | + { |
| 16 | + return Anonymous1.IsSetFlags == other.Anonymous1.IsSetFlags |
| 17 | + && MaxBytesPerKey == other.MaxBytesPerKey |
| 18 | + && HandshakeIdleTimeoutMs == other.HandshakeIdleTimeoutMs |
| 19 | + && IdleTimeoutMs == other.IdleTimeoutMs |
| 20 | + && MtuDiscoverySearchCompleteTimeoutUs == other.MtuDiscoverySearchCompleteTimeoutUs |
| 21 | + && TlsClientMaxSendBuffer == other.TlsClientMaxSendBuffer |
| 22 | + && TlsServerMaxSendBuffer == other.TlsServerMaxSendBuffer |
| 23 | + && StreamRecvWindowDefault == other.StreamRecvWindowDefault |
| 24 | + && StreamRecvBufferDefault == other.StreamRecvBufferDefault |
| 25 | + && ConnFlowControlWindow == other.ConnFlowControlWindow |
| 26 | + && MaxWorkerQueueDelayUs == other.MaxWorkerQueueDelayUs |
| 27 | + && MaxStatelessOperations == other.MaxStatelessOperations |
| 28 | + && InitialWindowPackets == other.InitialWindowPackets |
| 29 | + && SendIdleTimeoutMs == other.SendIdleTimeoutMs |
| 30 | + && InitialRttMs == other.InitialRttMs |
| 31 | + && MaxAckDelayMs == other.MaxAckDelayMs |
| 32 | + && DisconnectTimeoutMs == other.DisconnectTimeoutMs |
| 33 | + && KeepAliveIntervalMs == other.KeepAliveIntervalMs |
| 34 | + && CongestionControlAlgorithm == other.CongestionControlAlgorithm |
| 35 | + && PeerBidiStreamCount == other.PeerBidiStreamCount |
| 36 | + && PeerUnidiStreamCount == other.PeerUnidiStreamCount |
| 37 | + && MaxBindingStatelessOperations == other.MaxBindingStatelessOperations |
| 38 | + && StatelessOperationExpirationMs == other.StatelessOperationExpirationMs |
| 39 | + && MinimumMtu == other.MinimumMtu |
| 40 | + && MaximumMtu == other.MaximumMtu |
| 41 | + && _bitfield == other._bitfield |
| 42 | + && MaxOperationsPerDrain == other.MaxOperationsPerDrain |
| 43 | + && MtuDiscoveryMissingProbeCount == other.MtuDiscoveryMissingProbeCount |
| 44 | + && DestCidUpdateIdleTimeoutMs == other.DestCidUpdateIdleTimeoutMs |
| 45 | + && Anonymous2.Flags == other.Anonymous2.Flags |
| 46 | + && StreamRecvWindowBidiLocalDefault == other.StreamRecvWindowBidiLocalDefault |
| 47 | + && StreamRecvWindowBidiRemoteDefault == other.StreamRecvWindowBidiRemoteDefault |
| 48 | + && StreamRecvWindowUnidiDefault == other.StreamRecvWindowUnidiDefault; |
| 49 | + } |
| 50 | + |
| 51 | + public override readonly int GetHashCode() |
| 52 | + { |
| 53 | + HashCode hash = default; |
| 54 | + hash.Add(Anonymous1.IsSetFlags); |
| 55 | + hash.Add(MaxBytesPerKey); |
| 56 | + hash.Add(HandshakeIdleTimeoutMs); |
| 57 | + hash.Add(IdleTimeoutMs); |
| 58 | + hash.Add(MtuDiscoverySearchCompleteTimeoutUs); |
| 59 | + hash.Add(TlsClientMaxSendBuffer); |
| 60 | + hash.Add(TlsServerMaxSendBuffer); |
| 61 | + hash.Add(StreamRecvWindowDefault); |
| 62 | + hash.Add(StreamRecvBufferDefault); |
| 63 | + hash.Add(ConnFlowControlWindow); |
| 64 | + hash.Add(MaxWorkerQueueDelayUs); |
| 65 | + hash.Add(MaxStatelessOperations); |
| 66 | + hash.Add(InitialWindowPackets); |
| 67 | + hash.Add(SendIdleTimeoutMs); |
| 68 | + hash.Add(InitialRttMs); |
| 69 | + hash.Add(MaxAckDelayMs); |
| 70 | + hash.Add(DisconnectTimeoutMs); |
| 71 | + hash.Add(KeepAliveIntervalMs); |
| 72 | + hash.Add(CongestionControlAlgorithm); |
| 73 | + hash.Add(PeerBidiStreamCount); |
| 74 | + hash.Add(PeerUnidiStreamCount); |
| 75 | + hash.Add(MaxBindingStatelessOperations); |
| 76 | + hash.Add(StatelessOperationExpirationMs); |
| 77 | + hash.Add(MinimumMtu); |
| 78 | + hash.Add(MaximumMtu); |
| 79 | + hash.Add(_bitfield); |
| 80 | + hash.Add(MaxOperationsPerDrain); |
| 81 | + hash.Add(MtuDiscoveryMissingProbeCount); |
| 82 | + hash.Add(DestCidUpdateIdleTimeoutMs); |
| 83 | + hash.Add(Anonymous2.Flags); |
| 84 | + hash.Add(StreamRecvWindowBidiLocalDefault); |
| 85 | + hash.Add(StreamRecvWindowBidiRemoteDefault); |
| 86 | + hash.Add(StreamRecvWindowUnidiDefault); |
| 87 | + return hash.ToHashCode(); |
| 88 | + } |
| 89 | + |
| 90 | + public override readonly bool Equals(object? obj) |
| 91 | + { |
| 92 | + return obj is QUIC_SETTINGS other && Equals(other); |
| 93 | + } |
| 94 | +} |
0 commit comments