Header

Namespace: Avro
We found 10 examples in language CSharp for this search. You will see 48 fragments of code.

    private static int checkColonSeparated (string header)
    {
      var idx = header.IndexOf (':');
      if (idx == -1)
        throw new ArgumentException ("No colon could be found.", "header");

      return idx;
    }

    #endregion

    #region Internal Methods

    internal static string Convert (HttpRequestHeader header)
    {
      return convert (header.ToString ());
    }

    internal static string Convert (HttpResponseHeader header)
    {
      return convert (header.ToString ());
    }

    internal void InternalSet (string header, bool response)
    {
      var pos = checkColonSeparated (header);
      InternalSet (header.Substring (0, pos), header.Substring (pos + 1), response);
    }

            public static HeaderData Load(string header) {
                string[] content = V_Animation.SplitString(header, "#HEADER#");
                HeaderData headerData;
                headerData.saveByteLength = int.Parse(content[0]);
                headerData.animationVersion = content[1];
                headerData.date = content[2];
                headerData.headerDataVersion = content[3];
                return headerData;
            }
        private static HeaderData Load_Header(string header) {
            HeaderData headerData = HeaderData.Load(header);
            return headerData;
        }


        protected override bool CompareField(XElement field, Datagram datagram)
        {
            IpV6Datagram ipV6Datagram = (IpV6Datagram)datagram;
            SkipAuthenticationHeaders(ipV6Datagram);
            int optionsIndex = 0;
            switch (field.Name())
            {
                case "ipv6.version":
                    field.AssertShowDecimal(ipV6Datagram.Version);
                    foreach (XElement subfield in field.Fields())
                    {
                        switch (subfield.Name())
                        {
                            case "ip.version":
                                subfield.AssertShowDecimal(ipV6Datagram.Version);
                                break;

                            default:
                                throw new InvalidOperationException(string.Format("Invalid ipv6 version subfield {0}", subfield.Name()));
                        }
                    }
                    break;

                case "ipv6.class":
                    field.AssertShowDecimal(ipV6Datagram.TrafficClass);
                    break;

                case "ipv6.flow":
                    field.AssertShowDecimal(ipV6Datagram.FlowLabel);
                    field.AssertNoFields();
                    break;

                case "ipv6.plen":
                    field.AssertShowDecimal(ipV6Datagram.PayloadLength);
                    field.AssertNoFields();
                    break;

                case "ipv6.nxt":
                    field.AssertShowDecimal((byte)ipV6Datagram.NextHeader);
                    field.AssertNoFields();
                    break;

                case "ipv6.hlim":
                    field.AssertShowDecimal(ipV6Datagram.HopLimit);
                    field.AssertNoFields();
                    break;

                case "ipv6.src":
                case "ipv6.src_host":
                    field.AssertShow(ipV6Datagram.Source.GetWiresharkString());
                    field.AssertNoFields();
                    break;

                case "ipv6.src_6to4_gw_ipv4":
                case "ipv6.src_6to4_sla_id":
                case "ipv6.6to4_gw_ipv4":
                case "ipv6.6to4_sla_id":
                    field.AssertNoFields();
                    break;

                case "ipv6.dst":
                case "ipv6.dst_host":
                    field.AssertShow(ipV6Datagram.CurrentDestination.GetWiresharkString());
                    field.AssertNoFields();
                    break;

                case "ipv6.addr":
                case "ipv6.host":
                    Assert.IsTrue(field.Show() == ipV6Datagram.Source.GetWiresharkString() ||
                                  field.Show() == ipV6Datagram.CurrentDestination.GetWiresharkString());
                    field.AssertNoFields();
                    break;

                case "ipv6.hop_opt":
                    if (_currentExtensionHeaderIndex >= ipV6Datagram.ExtensionHeaders.Headers.Count)
                    {
                        Assert.IsFalse(ipV6Datagram.ExtensionHeaders.IsValid);
                        int maxLength = ipV6Datagram.Length - IpV6Datagram.HeaderLength - ipV6Datagram.ExtensionHeaders.BytesLength;
                        if (field.Fields().Any(subfield => subfield.Name() == "ipv6.opt.length"))
                        {
                            int length = int.Parse(field.Fields().First(subfield => subfield.Name() == "ipv6.opt.length").Show());
                            MoreAssert.IsBigger(maxLength, length);
                        }
                        else 
                        {
                            Assert.AreEqual(6, maxLength);
                        }
                    }
                    else
                    {
                        IpV6ExtensionHeaderHopByHopOptions hopByHopOptions =
                            (IpV6ExtensionHeaderHopByHopOptions)ipV6Datagram.ExtensionHeaders[_currentExtensionHeaderIndex];
                        IncrementCurrentExtensionHeaderIndex(ipV6Datagram);
                        CompareOptions(field, ref optionsIndex, ipV6Datagram, hopByHopOptions);
                    }
                    break;

                case "ipv6.routing_hdr":
                    if (!ipV6Datagram.IsValid)
                        return false;
                    IpV6ExtensionHeaderRouting routing = (IpV6ExtensionHeaderRouting)ipV6Datagram.ExtensionHeaders[_currentExtensionHeaderIndex];
                        IpV6ExtensionHeaderRoutingProtocolLowPowerAndLossyNetworks routingProtocolLowPowerAndLossyNetworks =
                            routing as IpV6ExtensionHeaderRoutingProtocolLowPowerAndLossyNetworks;
                    int routingProtocolLowPowerAndLossyNetworksAddressIndex = 0;
                    IncrementCurrentExtensionHeaderIndex(ipV6Datagram);
                    int sourceRouteAddressIndex = 0;
                    foreach (var headerField in field.Fields())
                    {
                        switch (headerField.Name())
                        {
                            case "":
                                headerField.AssertNoFields();
                                ValidateExtensionHeaderUnnamedField(routing, headerField);
                                break;

                            case "ipv6.routing_hdr.type":
                                headerField.AssertNoFields();
                                headerField.AssertShowDecimal((byte)routing.RoutingType);
                                break;

                            case "ipv6.routing_hdr.left":
                                headerField.AssertNoFields();
                                headerField.AssertShowDecimal(routing.SegmentsLeft);
                                break;

                            case "ipv6.mipv6_home_address":
                                headerField.AssertNoFields();
                                IpV6ExtensionHeaderRoutingHomeAddress routingHomeAddress = (IpV6ExtensionHeaderRoutingHomeAddress)routing;
                                headerField.AssertShow(routingHomeAddress.HomeAddress.ToString("x"));
                                break;

                            case "ipv6.routing_hdr.addr":
                                headerField.AssertNoFields();
                                IpV6ExtensionHeaderRoutingSourceRoute routingSourceRoute = (IpV6ExtensionHeaderRoutingSourceRoute)routing;
                                headerField.AssertShow(routingSourceRoute.Addresses[sourceRouteAddressIndex++].ToString("x"));
                                break;

                            case "ipv6.routing_hdr.rpl.cmprI":
                                headerField.AssertNoFields();
                                headerField.AssertShowDecimal(routingProtocolLowPowerAndLossyNetworks.CommonPrefixLengthForNonLastAddresses);
                                break;

                            case "ipv6.routing_hdr.rpl.cmprE":
                                headerField.AssertNoFields();
                                headerField.AssertShowDecimal(routingProtocolLowPowerAndLossyNetworks.CommonPrefixLengthForLastAddress);
                                break;

                            case "ipv6.routing_hdr.rpl.pad":
                                headerField.AssertNoFields();
                                headerField.AssertShowDecimal(routingProtocolLowPowerAndLossyNetworks.PadSize);
                                break;

                            case "ipv6.routing_hdr.rpl.reserved":
                                headerField.AssertNoFields();
                                headerField.AssertShowDecimal(0);
                                break;

                            case "ipv6.routing_hdr.rpl.segments":
                                if (headerField.Fields().Any())
                                {
                                    headerField.AssertNumFields(1);
                                    headerField.Fields().First().AssertName("_ws.expert");
                                }
                                // TODO: Remove this condition when https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=11803 is fixed.
                                if (routingProtocolLowPowerAndLossyNetworks.Addresses.Count > 0)
                                {
                                    headerField.AssertShowDecimal(routingProtocolLowPowerAndLossyNetworks.Addresses.Count);
                                }
                                break;

                            case "ipv6.routing_hdr.rpl.address":
                                headerField.AssertNoFields();
                                // TODO: Remove this condition when https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=11803 is fixed.
                                if (routingProtocolLowPowerAndLossyNetworks.Addresses.Count > 0)
                                {
                                    IpV6Address actualAddress =
                                        new IpV6Address(UInt128.Parse(headerField.Value(), NumberStyles.HexNumber, CultureInfo.InvariantCulture));
                                    Assert.AreEqual(routingProtocolLowPowerAndLossyNetworks.Addresses[routingProtocolLowPowerAndLossyNetworksAddressIndex],
                                                    actualAddress);
                                }
                                break;

                            case "ipv6.routing_hdr.rpl.full_address":
                                headerField.AssertNoFields();
                                // TODO: Uncomment the following code when https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=10673 is fixed.
//                                // TODO: Remove this condition when https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=11803 is fixed.
//                                if (routingProtocolLowPowerAndLossyNetworks.Addresses.Count > 0)
//                                {
//                                    IpV6Address actualFullAddress = new IpV6Address(headerField.Show());
//
//                                    IpV6Address destinationAddress = ipV6Datagram.CurrentDestination;
//                                    for (int i = 0; i < _currentExtensionHeaderIndex; ++i)
//                                    {
//                                        IpV6ExtensionHeaderRoutingHomeAddress ipV6ExtensionHeaderRoutingHomeAddress =
//                                            ipV6Datagram.ExtensionHeaders[i] as IpV6ExtensionHeaderRoutingHomeAddress;
//                                        if (ipV6ExtensionHeaderRoutingHomeAddress != null)
//                                            destinationAddress = ipV6ExtensionHeaderRoutingHomeAddress.HomeAddress;
//
//                                        IpV6ExtensionHeaderRoutingSourceRoute ipV6ExtensionHeaderRoutingSourceRoute =
//                                            ipV6Datagram.ExtensionHeaders[i] as IpV6ExtensionHeaderRoutingSourceRoute;
//                                        if (ipV6ExtensionHeaderRoutingSourceRoute != null && ipV6ExtensionHeaderRoutingSourceRoute.Addresses.Any())
//                                            destinationAddress = ipV6ExtensionHeaderRoutingSourceRoute.Addresses.Last();
//                                    }
//
//                                    int commonPrefixLength =
//                                        routingProtocolLowPowerAndLossyNetworksAddressIndex == routingProtocolLowPowerAndLossyNetworks.Addresses.Count - 1
//                                            ? routingProtocolLowPowerAndLossyNetworks.CommonPrefixLengthForLastAddress
//                                            : routingProtocolLowPowerAndLossyNetworks.CommonPrefixLengthForNonLastAddresses;
//
//                                    byte[] destinationAddressBytes = new byte[IpV6Address.SizeOf];
//                                    destinationAddressBytes.Write(0, destinationAddress, Endianity.Big);
//
//                                    byte[] routingAddressBytes = new byte[IpV6Address.SizeOf];
//                                    routingAddressBytes.Write(0, routingProtocolLowPowerAndLossyNetworks.Addresses[routingProtocolLowPowerAndLossyNetworksAddressIndex], Endianity.Big);
//                                    
//                                    byte[] fullAddressBytes = destinationAddressBytes.Subsegment(0, commonPrefixLength).Concat(routingAddressBytes.Subsegment(commonPrefixLength, IpV6Address.SizeOf - commonPrefixLength)).ToArray();
//                                    IpV6Address expectedFullAddress = fullAddressBytes.ReadIpV6Address(0, Endianity.Big);
//                                    
//                                    Assert.AreEqual(expectedFullAddress, actualFullAddress);
//                                }

                                ++routingProtocolLowPowerAndLossyNetworksAddressIndex;
                                break;

                            default:
                                throw new InvalidOperationException("Invalid IPv6 routing source route field " + headerField.Name());
                        }
                    }
                    break;

                case "ipv6.dst_opt":
                    if (_currentExtensionHeaderIndex >= ipV6Datagram.ExtensionHeaders.Headers.Count)
                    {
                        int expectedExtensionHeaderLength = (int.Parse(field.Fields().Skip(1).First().Value(), NumberStyles.HexNumber) + 1) * 8;
                        int actualMaxPossibleLength = ipV6Datagram.RealPayloadLength -
                                                   ipV6Datagram.ExtensionHeaders.Take(_currentExtensionHeaderIndex).Sum(
                                                       extensionHeader => extensionHeader.Length);
                        MoreAssert.IsSmaller(expectedExtensionHeaderLength, actualMaxPossibleLength);
                        return false;
                    }
                    IpV6ExtensionHeaderDestinationOptions destinationOptions = (IpV6ExtensionHeaderDestinationOptions)ipV6Datagram.ExtensionHeaders[_currentExtensionHeaderIndex];
                    IncrementCurrentExtensionHeaderIndex(ipV6Datagram);
                    CompareOptions(field, ref optionsIndex, ipV6Datagram, destinationOptions);
                    break;

                case "ipv6.shim6":
                    // TODO: Implement Shim6.
                    IpV4Protocol nextHeader = _currentExtensionHeaderIndex > 0
                                                  ? ipV6Datagram.ExtensionHeaders[_currentExtensionHeaderIndex - 1].NextHeader.Value
                                                  : ipV6Datagram.NextHeader;
                    Assert.IsTrue(nextHeader == IpV4Protocol.Shim6);
                    break;

                case "ipv6.unknown_hdr":
                    Assert.AreEqual(ipV6Datagram.ExtensionHeaders.Count(), _currentExtensionHeaderIndex);
                    // TODO: Fix according to https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9996
                    return false;

                case "ipv6.src_sa_mac":
                case "ipv6.dst_sa_mac":
                case "ipv6.sa_mac":
                case "ipv6.dst_6to4_gw_ipv4":
                case "ipv6.dst_6to4_sla_id":
                    // TODO: Understand how these are calculated.
                    break;

                case "":
                    switch (field.Show())
                    {
                        case "Fragmentation Header":
                            if (_currentExtensionHeaderIndex >= ipV6Datagram.ExtensionHeaders.Headers.Count && !ipV6Datagram.IsValid)
                                return false;
                            IpV6ExtensionHeaderFragmentData fragmentData =
                                (IpV6ExtensionHeaderFragmentData)ipV6Datagram.ExtensionHeaders[_currentExtensionHeaderIndex];
                            IncrementCurrentExtensionHeaderIndex(ipV6Datagram);
                            foreach (var headerField in field.Fields())
                            {
                                switch (headerField.Name())
                                {
                                    case "ipv6.fragment.nxt":
                                        headerField.AssertValue((byte)fragmentData.NextHeader.Value);
                                        break;

                                    case "ipv6.fragment.offset":
                                        headerField.AssertShowDecimal(fragmentData.FragmentOffset);
                                        break;

                                    case "ipv6.fragment.more":
                                        headerField.AssertShowDecimal(fragmentData.MoreFragments);
                                        break;

                                    case "ipv6.fragment.id":
                                        headerField.AssertShowDecimal(fragmentData.Identification);
                                        break;

                                    case "ipv6.fragment.reserved_octet":
                                    case "ipv6.fragment.reserved_bits":
                                        headerField.AssertShowDecimal(0);
                                        break;

                                    default:
                                        throw new InvalidOperationException("Invalid ipv6 fragmentation field " + headerField.Name());
                                }
                            }
                            break;

                        default:
                            throw new InvalidOperationException(string.Format("Invalid ipv6 field {0}", field.Show()));
                    }
                    break;

                default:
                    throw new InvalidOperationException(string.Format("Invalid ipv6 field {0}", field.Name()));
            }

            return true;
        }

        private void CompareOptions(XElement field, ref int optionsIndex, IpV6Datagram ipV6Datagram, IpV6ExtensionHeaderOptions header)
        {
            foreach (var headerField in field.Fields())
            {
                switch (headerField.Name())
                {
                    case "ipv6.nxt":
                        headerField.AssertNoFields();
                        headerField.AssertShowDecimal((byte)header.NextHeader);
                        break;

                    case "ipv6.opt.length":
                        headerField.AssertNoFields();
                        headerField.AssertShowDecimal((header.Length - 8) / 8);
                        break;

                    case "ipv6.opt":
                        foreach (XElement headerSubfield in headerField.Fields())
                        {
                            IpV6Option option = header.Options[optionsIndex];
                            var optionCalipso = option as IpV6OptionCalipso;
                            var optionQuickStart = option as IpV6OptionQuickStart;
                            switch (headerSubfield.Name())
                            {
                                case "ipv6.opt.type":
                                    headerSubfield.AssertNoFields();
                                    headerSubfield.AssertShowDecimal((byte)option.OptionType);
                                    break;

                                case "ipv6.opt.length":
                                    headerSubfield.AssertNoFields();
                                    headerSubfield.AssertShowDecimal(option.Length - 2);
                                    break;

                                case "ipv6.opt.tel":
                                    headerSubfield.AssertNoFields();
                                    IpV6OptionTunnelEncapsulationLimit optionTunnelEncapsulationLimit = (IpV6OptionTunnelEncapsulationLimit)option;
                                    headerSubfield.AssertShowDecimal(optionTunnelEncapsulationLimit.TunnelEncapsulationLimit);
                                    ++optionsIndex;
                                    break;

                                case "ipv6.opt.rpl.flag":
                                    IpV6OptionRoutingProtocolLowPowerAndLossyNetworks optionRoutingProtocolLowPowerAndLossyNetworks =
                                        (IpV6OptionRoutingProtocolLowPowerAndLossyNetworks)option;
                                    foreach (XElement optionSubfield in headerSubfield.Fields())
                                    {
                                        optionSubfield.AssertNoFields();
                                        switch (optionSubfield.Name())
                                        {
                                            case "ipv6.opt.rpl.flag.o":
                                                optionSubfield.AssertShowDecimal(optionRoutingProtocolLowPowerAndLossyNetworks.Down);
                                                break;

                                            case "ipv6.opt.rpl.flag.r":
                                                optionSubfield.AssertShowDecimal(optionRoutingProtocolLowPowerAndLossyNetworks.RankError);
                                                break;

                                            case "ipv6.opt.rpl.flag.f":
                                                optionSubfield.AssertShowDecimal(optionRoutingProtocolLowPowerAndLossyNetworks.ForwardingError);
                                                break;

                                            case "ipv6.opt.rpl.flag.rsv":
                                                optionSubfield.AssertShowDecimal(0);
                                                break;

                                            case "ipv6.opt.rpl.instance_id":
                                                optionSubfield.AssertShowDecimal(
                                                    optionRoutingProtocolLowPowerAndLossyNetworks.RoutingProtocolLowPowerAndLossyNetworksInstanceId);
                                                break;

                                            case "ipv6.opt.rpl.sender_rank":
                                                optionSubfield.AssertShowDecimal(optionRoutingProtocolLowPowerAndLossyNetworks.SenderRank);
                                                break;

                                            default:
                                                throw new InvalidOperationException("Invalid ipv6 option subfield " + optionSubfield.Name());
                                        }
                                    }
                                    ++optionsIndex;
                                    // TODO: change to break; after https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=10559 is fixed.
                                    return; 

                                case "ipv6.opt.calipso.doi":
                                    headerSubfield.AssertNoFields();
                                    headerSubfield.AssertShowDecimal((uint)optionCalipso.DomainOfInterpretation);
                                    break;

                                case "ipv6.opt.calipso.cmpt.length":
                                    headerSubfield.AssertNoFields();
                                    headerSubfield.AssertShowDecimal(optionCalipso.CompartmentLength);
                                    break;

                                case "ipv6.opt.calipso.sens_level":
                                    headerSubfield.AssertNoFields();
                                    headerSubfield.AssertShowDecimal(optionCalipso.SensitivityLevel);
                                    break;

                                case "ipv6.opt.calipso.checksum":
                                    headerSubfield.AssertNoFields();
                                    headerSubfield.AssertShowDecimal(optionCalipso.Checksum);
                                    break;

                                case "ipv6.opt.calipso.cmpt_bitmap":
                                    headerSubfield.AssertNoFields();
                                    headerSubfield.AssertValue(optionCalipso.CompartmentBitmap);
                                    ++optionsIndex;
                                    break;

                                case "ipv6.opt.router_alert":
                                    headerSubfield.AssertNoFields();
                                    var optionRouterAlert = (IpV6OptionRouterAlert)option;
                                    headerSubfield.AssertShowDecimal((ushort)optionRouterAlert.RouterAlertType);
                                    ++optionsIndex;
                                    break;

                                case "ipv6.opt.padn":
                                    headerSubfield.AssertNoFields();
                                    var optionPadN = (IpV6OptionPadN)option;
                                    headerSubfield.AssertValue(new byte[optionPadN.PaddingDataLength]);
                                    ++optionsIndex;
                                    break;

                                case "ipv6.opt.qs_func":
                                    headerSubfield.AssertNoFields();
                                    headerSubfield.AssertShowDecimal((byte)optionQuickStart.QuickStartFunction);
                                    break;

                                case "ipv6.opt.qs_rate":
                                    headerSubfield.AssertNoFields();
                                    headerSubfield.AssertShowDecimal(optionQuickStart.Rate);
                                    break;
                                
                                case "ipv6.opt.qs_ttl":
                                    headerSubfield.AssertNoFields();
                                    headerSubfield.AssertShowDecimal(optionQuickStart.Ttl);
                                    break;
                                
                                case "ipv6.opt.qs_ttl_diff":
                                    headerSubfield.AssertNoFields();
                                    headerSubfield.AssertShowDecimal((256 + ipV6Datagram.HopLimit - optionQuickStart.Ttl) % 256);
                                    break;

                                case "ipv6.opt.qs_unused":
                                    headerSubfield.AssertNoFields();
                                    headerSubfield.AssertShowDecimal(optionQuickStart.Ttl);
                                    break;

                                case "ipv6.opt.qs_nonce":
                                    headerSubfield.AssertNoFields();
                                    headerSubfield.AssertShowDecimal(optionQuickStart.Nonce);
                                    break;

                                case "ipv6.opt.qs_reserved":
                                    headerSubfield.AssertNoFields();
                                    headerSubfield.AssertShowDecimal(0);
                                    ++optionsIndex;
                                    break;

                                case "ipv6.opt.pad1":
                                    headerSubfield.AssertNoFields();
                                    headerSubfield.AssertShow("");
                                    Assert.IsTrue(option is IpV6OptionPad1);
                                    ++optionsIndex;
                                    break;

                                case "ipv6.opt.jumbo":
                                    headerSubfield.AssertNoFields();
                                    headerSubfield.AssertShowDecimal(((IpV6OptionJumboPayload)option).JumboPayloadLength);
                                    ++optionsIndex;
                                    break;

                                case "ipv6.mipv6_home_address":
                                    headerSubfield.AssertNoFields();
                                    headerSubfield.AssertShow(((IpV6OptionHomeAddress)option).HomeAddress.GetWiresharkString());
                                    ++optionsIndex;
                                    break;
                               
                                case "ipv6.opt.unknown":
                                    headerSubfield.AssertNoFields();
                                    Assert.IsTrue(new[]
                                                      {
                                                          IpV6OptionType.LineIdentification,
                                                          IpV6OptionType.IdentifierLocatorNetworkProtocolNonce,
                                                          IpV6OptionType.SimplifiedMulticastForwardingDuplicatePacketDetection,
                                                          IpV6OptionType.EndpointIdentification,
                                                      }.Contains(option.OptionType),
                                                  option.OptionType.ToString());
                                    ++optionsIndex;
                                    break;

                                default:
                                    throw new InvalidOperationException("Invalid ipv6 header subfield " + headerSubfield.Name());
                            }
                        }
                        break;

                    default:
                        throw new InvalidOperationException("Invalid ipv6 options field " + headerField.Name());
                }
            }
        }

        private void IncrementCurrentExtensionHeaderIndex(IpV6Datagram ipV6Datagram)
        {
            ++_currentExtensionHeaderIndex;
            SkipAuthenticationHeaders(ipV6Datagram);
        }

        private void SkipAuthenticationHeaders(IpV6Datagram ipV6Datagram)
        {
            while (_currentExtensionHeaderIndex < ipV6Datagram.ExtensionHeaders.Headers.Count &&
                   ipV6Datagram.ExtensionHeaders[_currentExtensionHeaderIndex].Protocol == IpV4Protocol.AuthenticationHeader)
            {
                ++_currentExtensionHeaderIndex;
            }
        }

        private void ValidateExtensionHeaderUnnamedField(IpV6ExtensionHeader header, XElement headerField)
        {
            int optionIndex = -1;
            ValidateExtensionHeaderUnnamedField(header, headerField, ref optionIndex);
        }

        private void ValidateExtensionHeaderUnnamedField(IpV6ExtensionHeader header, XElement headerField, ref int optionsIndex)
        {
            IpV6ExtensionHeaderOptions headerOptions = header as IpV6ExtensionHeaderOptions;

            string[] headerFieldShowParts = headerField.Show().Split(':');
            string headerFieldShowName = headerFieldShowParts[0];
            string headerFieldShowValue = headerFieldShowParts[1];
            switch (headerFieldShowName)
            {
                case "Next header":
                    headerField.AssertValue((byte)header.NextHeader.Value);
                    break;

                case "Length":
                    if (header.IsValid)
                        Assert.IsTrue(headerFieldShowValue.EndsWith(" (" + header.Length + " bytes)"));
                    break;

                case "Router alert":
                    IpV6OptionRouterAlert routerAlert = (IpV6OptionRouterAlert)headerOptions.Options[optionsIndex++];
                    switch (headerFieldShowValue)
                    {
                        case " MLD (4 bytes)":
                            Assert.AreEqual(IpV6RouterAlertType.MulticastListenerDiscovery, routerAlert.RouterAlertType);
                            break;

                        case " RSVP (4 bytes)":
                            Assert.AreEqual(IpV6RouterAlertType.Rsvp, routerAlert.RouterAlertType);
                            break;

                        case " Unknown (4 bytes)":
                            MoreAssert.IsInRange((ushort)IpV6RouterAlertType.ActiveNetwork, (ushort)IpV6RouterAlertType.NextStepsInSignalingNatFirewallLayerProtocol, (ushort)routerAlert.RouterAlertType);
                            headerField.AssertValueInRange(0x05020002, 0x05020044);
                            break;

                        default:
                            throw new InvalidOperationException("Invalid ipv6 header route Router alert value " + headerFieldShowValue);
                    }
                    break;

                case "Jumbo payload":
                    IpV6OptionJumboPayload jumboPayload = (IpV6OptionJumboPayload)headerOptions.Options[optionsIndex++];
                    Assert.AreEqual(" " + jumboPayload.JumboPayloadLength + " (6 bytes)", headerFieldShowValue);
                    break;

                default:
                    throw new InvalidOperationException("Invalid ipv6 header unnamed field show name " + headerFieldShowName);
            }
        }


        /// <summary>
        /// True iff the given extension header is equal to this extension header.
        /// </summary>
        public sealed override bool Equals(IpV6ExtensionHeader other)
        {
            return other != null &&
                   Protocol == other.Protocol && NextHeader == other.NextHeader && EqualsData(other);
        }

        /// <summary>
        /// Returns a hash code of the extension header.
        /// </summary>
        public sealed override int GetHashCode()
        {
            return Sequence.GetHashCode(Protocol, NextHeader, GetDataHashCode());
        }

        internal abstract bool EqualsData(IpV6ExtensionHeader other);

        internal sealed override void Write(byte[] buffer, ref int offset, IpV4Protocol nextHeader)
        {
            buffer.Write(offset + Offset.NextHeader, (byte)nextHeader);
            int length = Length;
            buffer.Write(offset + Offset.HeaderExtensionLength, (byte)((length / 8) - 1));
            WriteData(buffer, offset + Offset.Data);
            offset += length;
        }

        internal static bool IsStandard(IpV4Protocol nextHeader)
        {
            switch (nextHeader)
            {
                case IpV4Protocol.IpV6HopByHopOption: // 0
                case IpV4Protocol.IpV6Route: // 43
                case IpV4Protocol.FragmentHeaderForIpV6: // 44
                case IpV4Protocol.IpV6Opts: // 60
                case IpV4Protocol.MobilityHeader: // 135
                    return true;

                default:
                    return false;
            }
        }

        internal static IpV6ExtensionHeader CreateInstanceStandard(IpV4Protocol nextHeader, DataSegment extensionHeaderData, out int numBytesRead)
        {
            numBytesRead = 0;
            if (extensionHeaderData.Length < MinimumLength)
                return null;
            IpV4Protocol nextNextHeader = (IpV4Protocol)extensionHeaderData[Offset.NextHeader];
            int length = (extensionHeaderData[Offset.HeaderExtensionLength] + 1) * 8;
            if (extensionHeaderData.Length < length)
                return null;

            DataSegment data = extensionHeaderData.Subsegment(Offset.Data, length - Offset.Data);
            numBytesRead = length;

            // TODO: Implement Shim6.
            switch (nextHeader)
            {
                case IpV4Protocol.IpV6HopByHopOption: // 0
                    return IpV6ExtensionHeaderHopByHopOptions.ParseData(nextNextHeader, data);

                case IpV4Protocol.IpV6Route: // 43
                    return IpV6ExtensionHeaderRouting.ParseData(nextNextHeader, data);

                case IpV4Protocol.FragmentHeaderForIpV6: // 44
                    return IpV6ExtensionHeaderFragmentData.ParseData(nextNextHeader, data);

                case IpV4Protocol.IpV6Opts:                     // 60
                    return IpV6ExtensionHeaderDestinationOptions.ParseData(nextNextHeader, data);

                case IpV4Protocol.MobilityHeader:        // 135
                    return IpV6ExtensionHeaderMobility.ParseData(nextNextHeader, data);

                default:
                    throw new InvalidOperationException("Invalid next header value" + nextHeader);
            }
        }


        /// <summary>
        /// True iff the given extension header is equal to this extension header.
        /// </summary>
        public sealed override bool Equals(object obj)
        {
            return Equals(obj as IpV6ExtensionHeader);
        }

        /// <summary>
        /// True iff the given extension header is equal to this extension header.
        /// </summary>
        public abstract bool Equals(IpV6ExtensionHeader other);

        internal static bool IsExtensionHeader(IpV4Protocol nextHeader)
        {
            if (IpV6ExtensionHeaderStandard.IsStandard(nextHeader))
                return true;

            switch (nextHeader)
            {
                case IpV4Protocol.EncapsulatingSecurityPayload: // 50
                case IpV4Protocol.AuthenticationHeader: // 51
                    return true;

                default:
                    return false;
            }
        }

        internal static IpV6ExtensionHeader CreateInstance(IpV4Protocol nextHeader, DataSegment extensionHeaderData, out int numBytesRead)
        {
            if (IpV6ExtensionHeaderStandard.IsStandard(nextHeader))
                return IpV6ExtensionHeaderStandard.CreateInstanceStandard(nextHeader, extensionHeaderData, out numBytesRead);

            switch (nextHeader)
            {
                case IpV4Protocol.EncapsulatingSecurityPayload: // 50
                    return IpV6ExtensionHeaderEncapsulatingSecurityPayload.CreateInstance(extensionHeaderData, out numBytesRead);

                case IpV4Protocol.AuthenticationHeader: // 51
                    return IpV6ExtensionHeaderAuthentication.CreateInstance(extensionHeaderData, out numBytesRead);

                default:
                    throw new InvalidOperationException("Invalid next header value" + nextHeader);
            }
        }

        internal abstract void Write(byte[] buffer, ref int offset, IpV4Protocol nextHeader);


        protected override int GetParsedValueLength(string value, int startIndex, object storeValue,
            out object parsedValue)
        {
            return _getParsedValueLength(value, startIndex, out parsedValue);
        }

        #region Parse methods

        private static int ParseNameValue(string value, int startIndex, out object parsedValue)
        {
            NameValueHeaderValue temp = null;
            int resultLength = NameValueHeaderValue.GetNameValueLength(value, startIndex, out temp);

            parsedValue = temp;
            return resultLength;
        }

        private static int ParseProduct(string value, int startIndex, out object parsedValue)
        {
            ProductHeaderValue temp = null;
            int resultLength = ProductHeaderValue.GetProductLength(value, startIndex, out temp);

            parsedValue = temp;
            return resultLength;
        }

        private static int ParseSingleEntityTag(string value, int startIndex, out object parsedValue)
        {
            EntityTagHeaderValue temp = null;
            parsedValue = null;

            int resultLength = EntityTagHeaderValue.GetEntityTagLength(value, startIndex, out temp);

            // If we don't allow '*' ("Any") as valid ETag value, return false (e.g. 'ETag' header)
            if (temp == EntityTagHeaderValue.Any)
            {
                return 0;
            }

            parsedValue = temp;
            return resultLength;
        }

        // Note that if multiple ETag values are allowed (e.g. 'If-Match', 'If-None-Match'), according to the RFC
        // the value must either be '*' or a list of ETag values. It's not allowed to have both '*' and a list of 
        // ETag values. We're not that strict: We allow both '*' and ETag values in a list. If the server sends such
        // an invalid list, we want to be able to represent it using the corresponding header property.
        private static int ParseMultipleEntityTags(string value, int startIndex, out object parsedValue)
        {
            EntityTagHeaderValue temp = null;
            int resultLength = EntityTagHeaderValue.GetEntityTagLength(value, startIndex, out temp);

            parsedValue = temp;
            return resultLength;
        }

        private static int ParseMailAddress(string value, int startIndex, out object parsedValue)
        {
            parsedValue = null;

            if (HttpRuleParser.ContainsInvalidNewLine(value, startIndex))
            {
                return 0;
            }

            string result = value.Substring(startIndex);

            if (!HeaderUtilities.IsValidEmailAddress(result))
            {
                return 0;
            }

            parsedValue = result;
            return result.Length;
        }


        /// <summary>
        /// Returns an enumerator that iterates through the collection.
        /// </summary>
        /// <returns>
        /// A <see cref="T:System.Collections.Generic.IEnumerator`1"/> that can be used to iterate through the collection.
        /// </returns>
        /// <filterpriority>1</filterpriority>
        public IEnumerator<IpV6ExtensionHeader> GetEnumerator()
        {
            return Headers.GetEnumerator();
        }

        /// <summary>
        /// Returns an enumerator that iterates through a collection.
        /// </summary>
        /// <returns>
        /// An <see cref="T:System.Collections.IEnumerator"/> object that can be used to iterate through the collection.
        /// </returns>
        /// <filterpriority>2</filterpriority>
        IEnumerator IEnumerable.GetEnumerator()
        {
            return GetEnumerator();
        }

        /// <summary>
        /// True iff all the extension headers are equal to the given extension headers instance.
        /// </summary>
        public sealed override bool Equals(object obj)
        {
            return Equals(obj as IpV6ExtensionHeaders);
        }

        /// <summary>
        /// True iff all the extension headers are equal to the given extension headers instance.
        /// </summary>
        public bool Equals(IpV6ExtensionHeaders other)
        {
            return other != null && this.SequenceEqual(other);
        }

        /// <summary>
        /// A hash code based on all the extension headers.
        /// </summary>
        public override int GetHashCode()
        {
            return this.SequenceGetHashCode();
        }

        internal void Write(byte[] buffer, int offset, IpV4Protocol? nextLayerProtocol)
        {
            for (int i = 0; i != Headers.Count; ++i)
            {
                IpV6ExtensionHeader extensionHeader = Headers[i];
                IpV4Protocol nextHeader;
                if (extensionHeader.NextHeader != null)
                    nextHeader = extensionHeader.NextHeader.Value;
                else if (i < Headers.Count - 1)
                    nextHeader = Headers[i + 1].Protocol;
                else if (nextLayerProtocol.HasValue)
                    nextHeader = nextLayerProtocol.Value;
                else if (extensionHeader.Protocol == IpV4Protocol.EncapsulatingSecurityPayload)
                    nextHeader = IpV4Protocol.NoNextHeaderForIpV6;  // Arbitrary.
                else
                    throw new InvalidOperationException("Can't determine extension header next header value. It is the last extension header with no known next layer protocol.");

                extensionHeader.Write(buffer, ref offset, nextHeader);
            }
        }


        public static byte* GetElementPointer(BufferHeader* header)
        {
            if (header->Pointer != null)
                return header->Pointer;

            return (byte*) (header + 1);
        }

        public static void EnsureCapacity(BufferHeader* header, int count, int typeSize, int alignment, TrashMode trashMode)
        {
            if (header->Capacity >= count)
                return;

            int newCapacity = Math.Max(Math.Max(2 * header->Capacity, count), kMinimumCapacity);
            long newBlockSize = (long)newCapacity * typeSize;

            byte* oldData = GetElementPointer(header);
            byte* newData = (byte*) UnsafeUtility.Malloc(newBlockSize, alignment, Allocator.Persistent);

            if (trashMode == TrashMode.RetainOldData)
            {
                long oldBlockSize = (long)header->Capacity * typeSize;
                UnsafeUtility.MemCpy(newData, oldData, oldBlockSize);
            }

            // Note we're freeing the old buffer only if it was not using the internal capacity. Don't change this to 'oldData', because that would be a bug.
            if (header->Pointer != null)
            {
                UnsafeUtility.Free(header->Pointer, Allocator.Persistent);
            }

            header->Pointer = newData;
            header->Capacity = newCapacity;
        }

        public static void Assign(BufferHeader* header, byte* source, int count, int typeSize, int alignment)
        {
            EnsureCapacity(header, count, typeSize, alignment, TrashMode.TrashOldData);

            // Select between internal capacity buffer and heap buffer.
            byte* elementPtr = GetElementPointer(header);

            UnsafeUtility.MemCpy(elementPtr, source, (long)typeSize * count);

            header->Length = count;
        }

        public static void Initialize(BufferHeader* header, int bufferCapacity)
        {
            header->Pointer = null;
            header->Length = 0;
            header->Capacity = bufferCapacity;
        }

        public static void Destroy(BufferHeader* header)
        {
            if (header->Pointer != null)
            {
                UnsafeUtility.Free(header->Pointer, Allocator.Persistent);
            }

            Initialize(header, 0);
        }

        // After cloning two worlds have access to the same malloc'ed buffer pointer leading to double deallocate etc.
        // So after cloning, just allocate all malloc based buffers and copy the data.
        public static void PatchAfterCloningChunk(Chunk* chunk)
        {
            for (int i = 0; i < chunk->Archetype->TypesCount; ++i)
            {
                var type = chunk->Archetype->Types[i];
                if (!type.IsBuffer)
                    continue;
                var ti = TypeManager.GetTypeInfo(type.TypeIndex);
                var sizeOf = chunk->Archetype->SizeOfs[i];
                var offset = chunk->Archetype->Offsets[i];
                for (var j = 0; j < chunk->Count; ++j)
                {
                    var offsetOfBuffer = offset + sizeOf * j;
                    var header = (BufferHeader*)(chunk->Buffer + offsetOfBuffer);
                    if (header->Pointer != null) // hoo boy, it's a malloc
                    {
                        BufferHeader newHeader = *header;
                        long bytesToAllocate = (long)header->Capacity * ti.ElementSize;
                        long bytesToCopy = (long)header->Length * ti.ElementSize;
                        newHeader.Pointer = (byte*)UnsafeUtility.Malloc(bytesToAllocate, TypeManager.MaximumSupportedAlignment, Allocator.Persistent);
                        UnsafeUtility.MemCpy(newHeader.Pointer, header->Pointer, bytesToCopy);
                        *header = newHeader;
                    }
                }
            }
        }

using UnityEditor;
using UnityEngine;

namespace Unity.VisualScripting
{
    public static class LudiqStyles
    {
        static LudiqStyles()
        {
            // General

            centeredLabel = new GUIStyle(EditorStyles.label);
            centeredLabel.alignment = TextAnchor.MiddleCenter;
            centeredLabel.margin = new RectOffset(0, 0, 5, 5);
            centeredLabel.wordWrap = true;

            horizontalSeparator = ColorPalette.unityBackgroundVeryDark.CreateBackground();
            horizontalSeparator.fixedHeight = 1;
            horizontalSeparator.stretchWidth = true;

            verticalSeparator = ColorPalette.unityBackgroundVeryDark.CreateBackground();
            verticalSeparator.fixedWidth = 1;
            verticalSeparator.stretchHeight = true;

            expandedTooltip = new GUIStyle(EditorStyles.label);
            expandedTooltip.normal.textColor = ColorPalette.unityForegroundDim;
            expandedTooltip.wordWrap = true;
            expandedTooltip.fontSize = 10;
            expandedTooltip.padding = new RectOffset(2, 5, 0, 10);

            paddedButton = new GUIStyle("Button");
            paddedButton.padding = new RectOffset(10, 10, 5, 5);

            textAreaWordWrapped = new GUIStyle(EditorStyles.textArea);
            textAreaWordWrapped.wordWrap = true;

            spinnerButton = new GUIStyle("MiniToolbarButton");
            spinnerButton.padding = new RectOffset(0, 0, 0, 0);
            spinnerButton.imagePosition = ImagePosition.ImageOnly;
            spinnerButton.alignment = TextAnchor.MiddleCenter;
            spinnerButton.fixedWidth = 0;
            spinnerButton.fixedHeight = 0;

            spinnerDownArrow = new GUIStyle(LudiqGUIUtility.newSkin ? "IN MinMaxStateDropDown" : "IN DropDown").normal.background;

            // Headers

            headerBackground = new GUIStyle("IN BigTitle");
            headerBackground.margin = new RectOffset(0, 0, 0, 5);

            // Show smaller icons on high DPI displays,
            // and crisp 32x icons on standard DPI displays

            if (EditorGUIUtility.pixelsPerPoint >= 2)
            {
                headerBackground.padding = new RectOffset(8, 8, 8, 9);
            }
            else
            {
                headerBackground.padding = new RectOffset(8, 6, 6, 7);
            }

            headerTitle = new GUIStyle(EditorStyles.label);
            headerTitle.fontSize = 13;
            headerTitle.wordWrap = true;

            headerSummary = new GUIStyle(EditorStyles.label);
            headerSummary.wordWrap = true;

            headerIcon = new GUIStyle();

            if (EditorGUIUtility.pixelsPerPoint >= 2)
            {
                headerIcon.fixedWidth = 20;
                headerIcon.fixedHeight = 20;
                headerIcon.margin = new RectOffset(0, 8, 3, 0);
            }
            else
            {
                headerIcon.fixedWidth = 32;
                headerIcon.fixedHeight = 32;
                headerIcon.margin = new RectOffset(0, 6, 3, 0);
            }

            headerTitleField = new GUIStyle(EditorStyles.textField);
            headerTitleField.fontSize = 13;
            headerTitleField.fixedHeight = 19;

            headerTitleFieldHidable = new GUIStyle(headerTitleField);
            headerTitleFieldHidable.hover.background = headerTitleFieldHidable.normal.background;
            headerTitleFieldHidable.normal.background = ColorPalette.transparent.GetPixel();

            headerTitlePlaceholder = new GUIStyle(EditorStyles.label);
            headerTitlePlaceholder.normal.textColor = EditorStyles.centeredGreyMiniLabel.normal.textColor;
            headerTitlePlaceholder.padding = headerTitleField.padding;
            headerTitlePlaceholder.fontSize = headerTitleField.fontSize;

            headerSummaryField = new GUIStyle(EditorStyles.textArea);

            headerSummaryFieldHidable = new GUIStyle(headerSummaryField);
            headerSummaryFieldHidable.hover.background = headerSummaryFieldHidable.normal.background;
            headerSummaryFieldHidable.normal.background = ColorPalette.transparent.GetPixel();

            headerSummaryPlaceholder = new GUIStyle(EditorStyles.label);
            headerSummaryPlaceholder.normal.textColor = EditorStyles.centeredGreyMiniLabel.normal.textColor;
            headerSummaryPlaceholder.padding = EditorStyles.textField.padding;

            // Lists

            listBackground = ColorPalette.unityBackgroundLight.CreateBackground();

            listRow = new GUIStyle();
            listRow.fontSize = 13;
            listRow.richText = true;
            listRow.alignment = TextAnchor.MiddleRight;
            listRow.padding = new RectOffset(18, 8, 10, 10);

            var normalBackground = ColorPalette.transparent.GetPixel();
            var selectedBackground = ColorPalette.unitySelectionHighlight.GetPixel();
            var normalForeground = ColorPalette.unityForeground;
            var selectedForeground = ColorPalette.unityForegroundSelected;

            listRow.normal.background = normalBackground;
            listRow.normal.textColor = normalForeground;
            listRow.onNormal.background = selectedBackground;
            listRow.onNormal.textColor = selectedForeground;

            listRow.active.background = normalBackground;
            listRow.active.textColor = normalForeground;
            listRow.onActive.background = selectedBackground;
            listRow.onActive.textColor = selectedForeground;

            listRow.border = new RectOffset(1, 1, 1, 1);

            // Toolbars

            toolbarBackground = new GUIStyle(EditorStyles.toolbar);
            toolbarButton = new GUIStyle(EditorStyles.toolbarButton);
            toolbarButton.alignment = TextAnchor.MiddleCenter;
            toolbarButton.padding.right -= 2;
            toolbarPopup = new GUIStyle(EditorStyles.toolbarPopup);

            toolbarBreadcrumbRoot = new GUIStyle("GUIEditor.BreadcrumbLeft");
            toolbarBreadcrumbRoot.alignment = TextAnchor.MiddleCenter;
            toolbarBreadcrumbRoot.padding.bottom++;
            toolbarBreadcrumbRoot.fontSize = 9;
            toolbarBreadcrumbRoot.margin.left = 0;

            toolbarBreadcrumb = new GUIStyle("GUIEditor.BreadcrumbMid");
            toolbarBreadcrumb.alignment = TextAnchor.MiddleCenter;
            toolbarBreadcrumb.padding.bottom++;
            toolbarBreadcrumb.fontSize = 9;

            toolbarLabel = new GUIStyle(EditorStyles.label);
            toolbarLabel.alignment = TextAnchor.MiddleCenter;
            toolbarLabel.padding = new RectOffset(2, 2, 2, 2);
            toolbarLabel.fontSize = 9;

            // Windows

            windowHeaderBackground = new GUIStyle("IN BigTitle");
            windowHeaderBackground.margin = new RectOffset(0, 0, 0, 0);
            windowHeaderBackground.padding = new RectOffset(10, 10, 20, 20);

            windowHeaderTitle = new GUIStyle(EditorStyles.label);
            windowHeaderTitle.padding = new RectOffset(0, 0, 0, 0);
            windowHeaderTitle.margin = new RectOffset(0, 0, 0, 0);
            windowHeaderTitle.alignment = TextAnchor.MiddleCenter;
            windowHeaderTitle.fontSize = 14;

            windowHeaderIcon = new GUIStyle();
            windowHeaderIcon.imagePosition = ImagePosition.ImageOnly;
            windowHeaderIcon.alignment = TextAnchor.MiddleCenter;
            windowHeaderIcon.fixedWidth = IconSize.Medium;
            windowHeaderIcon.fixedHeight = IconSize.Medium;

            windowHeaderTitle.fixedHeight = headerIcon.fixedHeight;

            windowBackground = ColorPalette.unityBackgroundMid.CreateBackground();
        }

        // General
        public static readonly GUIStyle centeredLabel;
        public static readonly GUIStyle horizontalSeparator;
        public static readonly GUIStyle verticalSeparator;
        public static readonly GUIStyle expandedTooltip;
        public static readonly GUIStyle paddedButton;
        public static readonly float compactHorizontalSpacing = 2;
        public static readonly GUIStyle textAreaWordWrapped;
        public static readonly GUIStyle spinnerButton;
        public static readonly Texture2D spinnerDownArrow;

        // Headers
        public static readonly GUIStyle headerBackground;
        public static readonly GUIStyle headerIcon;
        public static readonly GUIStyle headerTitle;
        public static readonly GUIStyle headerTitleField;
        public static readonly GUIStyle headerTitleFieldHidable;
        public static readonly GUIStyle headerTitlePlaceholder;
        public static readonly GUIStyle headerSummary;
        public static readonly GUIStyle headerSummaryField;
        public static readonly GUIStyle headerSummaryFieldHidable;
        public static readonly GUIStyle headerSummaryPlaceholder;

        // Lists
        public static readonly GUIStyle listRow;
        public static readonly GUIStyle listBackground;

        // Toolbars
        public static readonly GUIStyle toolbarBackground;
        public static readonly GUIStyle toolbarButton;
        public static readonly GUIStyle toolbarPopup;
        public static readonly GUIStyle toolbarBreadcrumbRoot;
        public static readonly GUIStyle toolbarBreadcrumb;
        public static readonly GUIStyle toolbarLabel;

        // Windows
        public static readonly GUIStyle windowHeaderBackground;
        public static readonly GUIStyle windowHeaderTitle;
        public static readonly GUIStyle windowHeaderIcon;
        public static readonly GUIStyle windowBackground;
        public static readonly float spaceBetweenWindowHeaderIconAndTitle = 14;
    }
}


        public void Add(string name, string value)
        {
            CheckHeaderName(name);

            // We don't use GetOrCreateHeaderInfo() here, since this would create a new header in the store. If parsing
            // the value then throws, we would have to remove the header from the store again. So just get a 
            // HeaderStoreItemInfo object and try to parse the value. If it works, we'll add the header.
            HeaderStoreItemInfo info;
            bool addToStore;
            PrepareHeaderInfoForAdd(name, out info, out addToStore);

            ParseAndAddValue(name, info, value);

            // If we get here, then the value could be parsed correctly. If we created a new HeaderStoreItemInfo, add
            // it to the store if we added at least one value.
            if (addToStore && (info.ParsedValue != null))
            {
                AddHeaderToStore(name, info);
            }
        }

        public void Add(string name, IEnumerable<string> values)
        {
            if (values == null)
            {
                throw new ArgumentNullException(nameof(values));
            }
            CheckHeaderName(name);

            HeaderStoreItemInfo info;
            bool addToStore;
            PrepareHeaderInfoForAdd(name, out info, out addToStore);

            try
            {
                // Note that if the first couple of values are valid followed by an invalid value, the valid values
                // will be added to the store before the exception for the invalid value is thrown.
                foreach (string value in values)
                {
                    ParseAndAddValue(name, info, value);
                }
            }
            finally
            {
                // Even if one of the values was invalid, make sure we add the header for the valid ones. We need to be
                // consistent here: If values get added to an _existing_ header, then all values until the invalid one
                // get added. Same here: If multiple values get added to a _new_ header, make sure the header gets added
                // with the valid values.
                // However, if all values for a _new_ header were invalid, then don't add the header.
                if (addToStore && (info.ParsedValue != null))
                {
                    AddHeaderToStore(name, info);
                }
            }
        }

        public bool TryAddWithoutValidation(string name, string value)
        {
            if (!TryCheckHeaderName(name))
            {
                return false;
            }

            if (value == null)
            {
                // We allow empty header values. (e.g. "My-Header: "). If the user adds multiple null/empty
                // values, we'll just add them to the collection. This will result in delimiter-only values:
                // E.g. adding two null-strings (or empty, or whitespace-only) results in "My-Header: ,".
                value = string.Empty;
            }

            HeaderStoreItemInfo info = GetOrCreateHeaderInfo(name, false);
            AddValue(info, value, StoreLocation.Raw);

            return true;
        }

        public bool TryAddWithoutValidation(string name, IEnumerable<string> values)
        {
            if (values == null)
            {
                throw new ArgumentNullException(nameof(values));
            }
            if (!TryCheckHeaderName(name))
            {
                return false;
            }

            HeaderStoreItemInfo info = GetOrCreateHeaderInfo(name, false);
            foreach (string value in values)
            {
                // We allow empty header values. (e.g. "My-Header: "). If the user adds multiple null/empty
                // values, we'll just add them to the collection. This will result in delimiter-only values:
                // E.g. adding two null-strings (or empty, or whitespace-only) results in "My-Header: ,".
                AddValue(info, value ?? string.Empty, StoreLocation.Raw);
            }

            return true;
        }

        public void Clear()
        {
            if (_headerStore != null)
            {
                _headerStore.Clear();
            }
        }

        public bool Remove(string name)
        {
            CheckHeaderName(name);

            if (_headerStore == null)
            {
                return false;
            }

            return _headerStore.Remove(name);
        }

Avro.File.Header : Object

Constructors :

public Header()

Methods :

public IDictionary<String, Byte[]> get_MetaData()
public Byte[] get_SyncData()
public Schema get_Schema()
public Void set_Schema(Schema value = )
public Type GetType()
public String ToString()
public Boolean Equals(Object obj = )
public Int32 GetHashCode()