in src/Proton/Codec/Decoders/Messaging/TargetTypeDecoder.cs [149:198]
private static Target ReadTarget(Stream stream, IStreamDecoderState state, IListTypeDecoder listDecoder)
{
Target result = new();
_ = listDecoder.ReadSize(stream, state);
int count = listDecoder.ReadCount(stream, state);
// Don't decode anything if things already look wrong.
if (count < MinTargetListEntries)
{
throw new DecodeException("Not enough entries in Target list encoding: " + count);
}
if (count > MaxTargetListEntries)
{
throw new DecodeException("To many entries in Target 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.Capabilities = state.Decoder.ReadMultiple<Symbol>(stream, state);
break;
}
}
return result;
}