コード例 #1
0
    public Packet(PacketSizeSet sizeSet, ReadOnlySpan <byte> initialContentsToCopy = default)
    {
        sizeSet.UseDefault();

        this.Elastic = new ElasticSpan <byte>(initialContentsToCopy, sizeSet);
        this.PinHead = 0;
        this.PinTail = this.Elastic.Length;
    }
コード例 #2
0
    public void WritePacket(ReadOnlySpan <byte> srcPacketData, long timeStampUsecs, string?comment = null)
    {
        PacketSizeSet sizeSet = PacketSizeSets.PcapNgPacket;

        if (comment != null && comment.Length >= 1)
        {
            comment._TruncStr(10000);
            sizeSet += new PacketSizeSet(0, 8 + comment.Length * 3);
        }

        Packet pkt = new Packet(sizeSet, srcPacketData);

        WritePacket(ref pkt, timeStampUsecs, comment);
    }