unsafe public int GetTCPPart(int CurrentPtr) { ushort u = 0; uint ui = 0; byte b = 0; ushort *usptr = ( ushort * )CurrentPtr; uint * uiptr = ( uint * )CurrentPtr; byte * ptr = ( byte * )CurrentPtr; u = AllFunctions.Get2Bytes(ptr, NORMAL); ptr += 2; PTcp.SourcePort = u; PTcp.SourcePortStr = GetPortStr((int)u); u = AllFunctions.Get2Bytes(ptr, NORMAL); ptr += 2; PTcp.DestinationPort = u; PTcp.DestinationPortStr = GetPortStr((int)u); ui = AllFunctions.Get4Bytes(ptr, NORMAL); ptr += 4; PTcp.SequenceNumber = ui; // ? ui = AllFunctions.Get4Bytes(ptr, NORMAL); ptr += 4; PTcp.Acknowledgement = ui; b = *(ptr++); PTcp.HeaderLength = (byte)(((int)b >> 4) * 4); b = *(ptr++); PTcp.Falgs = b; PTcp.FalgsStr = GetTCPFLAGSStr(b); u = AllFunctions.Get2Bytes(ptr, NORMAL); ptr += 2; PTcp.WindowSize = u; u = AllFunctions.Get2Bytes(ptr, NORMAL); ptr += 2; PTcp.Checksum = u; u = AllFunctions.Get2Bytes(ptr, NORMAL); ptr += 2; PTcp.Options = u; return(CurrentPtr + PACKET_TCP_LENGTH); }
unsafe public int GetEIGRPPart(int CurrentPtr) { byte * ptr = ( byte * )CurrentPtr; ushort u = 0; uint ui = 0; byte b = 0; b = *(ptr++); PEigrp.Version = b; b = *(ptr++); PEigrp.OpCode = b; u = AllFunctions.Get2Bytes(ptr, NORMAL); ptr += 2; PEigrp.Checksum = u; ui = AllFunctions.Get4Bytes(ptr, NORMAL); ptr += 4; PEigrp.Flags = ui; ui = AllFunctions.Get4Bytes(ptr, NORMAL); ptr += 4; PEigrp.Sequence = ui; ui = AllFunctions.Get4Bytes(ptr, NORMAL); ptr += 4; PEigrp.Acknowledge = ui; ui = AllFunctions.Get4Bytes(ptr, NORMAL); ptr += 4; PEigrp.AutonomousSystem = ui; u = AllFunctions.Get2Bytes(ptr, NORMAL); ptr += 2; PEigrp.Parameters.Type = u; u = AllFunctions.Get2Bytes(ptr, NORMAL); ptr += 2; PEigrp.Parameters.Size = u; b = *(ptr++); PEigrp.Parameters.K1 = b; b = *(ptr++); PEigrp.Parameters.K2 = b; b = *(ptr++); PEigrp.Parameters.K3 = b; b = *(ptr++); PEigrp.Parameters.K4 = b; b = *(ptr++); PEigrp.Parameters.K5 = b; b = *(ptr++); PEigrp.Parameters.Reserved = b; u = AllFunctions.Get2Bytes(ptr, NORMAL); ptr += 2; PEigrp.Parameters.HoldTime = u; u = AllFunctions.Get2Bytes(ptr, NORMAL); ptr += 2; PEigrp.Software.Type = u; u = AllFunctions.Get2Bytes(ptr, NORMAL); ptr += 2; PEigrp.Software.Size = u; b = *(ptr++); PEigrp.Software.IOS = b.ToString() + "."; b = *(ptr++); PEigrp.Software.IOS += b.ToString(); b = *(ptr++); PEigrp.Software.EigrpRelease = b.ToString() + "."; b = *(ptr++); PEigrp.Software.EigrpRelease += b.ToString(); return(CurrentPtr + PACKET_EIGRP_LENGTH); }