private static Open ReadOpen()

in src/Proton/Codec/Decoders/Transport/OpenTypeDecoder.cs [67:137]


      private static Open ReadOpen(IProtonBuffer buffer, IDecoderState state, IListTypeDecoder listDecoder)
      {
         Open result = new();

         _ = listDecoder.ReadSize(buffer, state);
         int count = listDecoder.ReadCount(buffer, state);

         if (count < MinOpenListEntries)
         {
            throw new DecodeException("The container-id field cannot be omitted from the Open");
         }

         if (count > MaxOpenListEntries)
         {
            throw new DecodeException("To many entries in Open list encoding: " + count);
         }

         for (int index = 0; index < count; ++index)
         {
            // Peek ahead and see if there is a null in the next slot, if so we don't call
            // the setter for that entry to ensure the returned type reflects the encoded
            // state in the modification entry.
            bool nullValue = buffer.GetByte(buffer.ReadOffset) == (byte)EncodingCodes.Null;
            if (nullValue)
            {
               if (index == 0)
               {
                  throw new DecodeException("The container-id field cannot be omitted from the Open");
               }

               buffer.ReadByte();
               continue;
            }

            switch (index)
            {
               case 0:
                  result.ContainerId = state.Decoder.ReadString(buffer, state);
                  break;
               case 1:
                  result.Hostname = state.Decoder.ReadString(buffer, state);
                  break;
               case 2:
                  result.MaxFrameSize = state.Decoder.ReadUnsignedInteger(buffer, state) ?? 0;
                  break;
               case 3:
                  result.ChannelMax = state.Decoder.ReadUnsignedShort(buffer, state) ?? 0;
                  break;
               case 4:
                  result.IdleTimeout = state.Decoder.ReadUnsignedInteger(buffer, state) ?? 0;
                  break;
               case 5:
                  result.OutgoingLocales = state.Decoder.ReadMultiple<Symbol>(buffer, state);
                  break;
               case 6:
                  result.IncomingLocales = state.Decoder.ReadMultiple<Symbol>(buffer, state);
                  break;
               case 7:
                  result.OfferedCapabilities = state.Decoder.ReadMultiple<Symbol>(buffer, state);
                  break;
               case 8:
                  result.DesiredCapabilities = state.Decoder.ReadMultiple<Symbol>(buffer, state);
                  break;
               case 9:
                  result.Properties = state.Decoder.ReadMap<Symbol, object>(buffer, state);
                  break;
            }
         }

         return result;
      }