private int WriteAttributeTo(StunAttribute attribute, Span <byte> bytes) { WriteAttributeType(attribute.Type, bytes); WriteAttributeContentLength(attribute.Content.Length, bytes); WriteAttributeContent(attribute.Content.Span, bytes); return(StunAttributeHeaderLength + attribute.Content.Length); }
public StunBuilderStep AddAttribute(StunAttribute attribute) { var newAttributeBytes = new byte[attributes.Length + StunAttributeHeaderLength + attribute.Content.Length]; CopyCurrentAttributesTo(newAttributeBytes); WriteAttributeTo(attribute, SliceNewAttributes(newAttributeBytes)); return(new StunBuilderStep(type, transactionId, newAttributeBytes)); }