in src/Proton/Codec/Decoders/Messaging/SourceTypeDecoder.cs [161:222]
private static Source ReadSource(Stream stream, IStreamDecoderState state, IListTypeDecoder listDecoder)
{
Source result = new();
_ = listDecoder.ReadSize(stream, state);
int count = listDecoder.ReadCount(stream, state);
// Don't decode anything if things already look wrong.
if (count < MinSourceListEntries)
{
throw new DecodeException("Not enough entries in Source list encoding: " + count);
}
if (count > MaxSourceListEntries)
{
throw new DecodeException("To many entries in Source list encoding: " + count);
}
for (int index = 0; index < count; ++index)
{
switch (index)
{
case 0:
result.Address = state.Decoder.ReadString(stream, state);
break;
case 1:
uint durability = state.Decoder.ReadUnsignedInteger(stream, state) ?? 0;
result.Durable = TerminusDurabilityExtension.Lookup(durability);
break;
case 2:
Symbol expiryPolicy = state.Decoder.ReadSymbol(stream, state);
result.ExpiryPolicy = TerminusExpiryPolicyExtension.Lookup(expiryPolicy);
break;
case 3:
result.Timeout = state.Decoder.ReadUnsignedInteger(stream, state) ?? 0;
break;
case 4:
result.Dynamic = state.Decoder.ReadBoolean(stream, state) ?? false;
break;
case 5:
result.DynamicNodeProperties = state.Decoder.ReadMap<Symbol, object>(stream, state);
break;
case 6:
result.DistributionMode = state.Decoder.ReadSymbol(stream, state);
break;
case 7:
result.Filter = state.Decoder.ReadMap<Symbol, object>(stream, state);
break;
case 8:
result.DefaultOutcome = state.Decoder.ReadObject<IOutcome>(stream, state);
break;
case 9:
result.Outcomes = state.Decoder.ReadMultiple<Symbol>(stream, state);
break;
case 10:
result.Capabilities = state.Decoder.ReadMultiple<Symbol>(stream, state);
break;
}
}
return result;
}