コード例 #1
0
 public void Extract(byte[] arr)
 {
     up1       = BitHelper.Extract8(arr, offset);
     up2       = BitHelper.Extract8(arr, offset + 1);
     down1     = BitHelper.Extract8(arr, offset + 2);
     down2     = BitHelper.Extract8(arr, offset + 3);
     ethertype = BitHelper.Extract16(arr, offset + 4);
 }
コード例 #2
0
ファイル: vss-examples.cs プロジェクト: TMVector/P4ToCSharp
 public override void Extract(byte[] arr, uint offset)
 {
     version        = (bit4)BitHelper.ExtractBits(arr, offset * 8, 4);
     ihl            = (bit4)BitHelper.ExtractBits(arr, offset * 8 + 4, 4);
     diffserv       = BitHelper.Extract8(arr, offset + 1);
     totalLen       = BitHelper.Extract16(arr, offset + 2);
     identification = BitHelper.Extract16(arr, offset + 4);
     flags          = (bit3)BitHelper.ExtractBits(arr, offset + 48, 3);
     fragOffset     = BitHelper.ExtractBits(arr, offset + 51, 13);
     ttl            = BitHelper.Extract8(arr, offset + 8);
     protocol       = BitHelper.Extract8(arr, offset + 9);
     hdrChecksum    = BitHelper.Extract16(arr, offset + 10);
     srcAddr        = BitHelper.Extract32(arr, offset + 12);
     dstAddr        = BitHelper.Extract32(arr, offset + 16);
 }
コード例 #3
0
ファイル: ipv4_t.cs プロジェクト: TMVector/P4ToCSharp
 public void Extract(byte[] arr)
 {
     version        = (byte)BitHelper.ExtractBits(arr, offset * 8, 4);
     ihl            = (byte)BitHelper.ExtractBits(arr, offset * 8 + 4, 4);
     diffserv       = BitHelper.Extract8(arr, offset + 1);
     totalLen       = BitHelper.Extract16(arr, offset + 2);
     identification = BitHelper.Extract16(arr, offset + 4);
     flags          = (byte)BitHelper.ExtractBits(arr, offset + 48, 3);
     fragOffset     = BitHelper.ExtractBits(arr, offset + 51, 13);
     ttl            = BitHelper.Extract8(arr, offset + 8);
     protocol       = BitHelper.Extract8(arr, offset + 9);
     hdrChecksum    = BitHelper.Extract16(arr, offset + 10);
     srcAddr        = BitHelper.Extract32(arr, offset + 12);
     dstAddr        = BitHelper.Extract32(arr, offset + 16);
     options        = BitHelper.ExtractBytes(arr, offset + 20, length - 20);
 }
コード例 #4
0
 public override void Parse(byte[] data, uint offset)
 {
     offset        *= 8;
     version        = BitHelper.Extract4(data, offset + 0);
     ihl            = BitHelper.Extract4(data, offset + 4);
     diffserv       = BitHelper.Extract8(data, offset + 8);
     totalLen       = BitHelper.Extract16(data, offset + 16);
     identification = BitHelper.Extract16(data, offset + 32);
     flags          = BitHelper.ExtractN(data, offset + 48, 3);
     fragOffset     = BitHelper.ExtractN(data, offset + 51, 13);
     ttl            = BitHelper.Extract8(data, offset + 64);
     protocol       = BitHelper.Extract8(data, offset + 72);
     hdrChecksum    = BitHelper.Extract16(data, offset + 80);
     srcAddr        = BitHelper.Extract32(data, offset + 96);
     dstAddr        = BitHelper.Extract32(data, offset + 128);
     length         = 160;
     setValid();
 }