public Connection(Tamir.IPLib.Packets.TCPPacket packet) { m_srcIp = packet.SourceAddress; m_dstIp = packet.DestinationAddress; m_srcPort = (ushort)packet.SourcePort; m_dstPort = (ushort)packet.DestinationPort; }
/// <summary> /// The main function of the class receives a tcp packet and reconstructs the stream /// </summary> /// <param name="tcpPacket"></param> public void ReassemblePacket(Tamir.IPLib.Packets.TCPPacket tcpPacket) { // if the paylod length is zero bail out ulong length = (ulong)(tcpPacket.TCPPacketByteLength - tcpPacket.TCPHeaderLength); if (length == 0) { return; } // Raise Events if (tcpPacket.Syn && tcpPacket.Ack) { this.OnSynRecived(this); } else if (tcpPacket.Fin && tcpPacket.Ack) { this.OnFinRecived(this); } else if (tcpPacket.Rst) { this.OnRstRecived(this); } reassemble_tcp((ulong)tcpPacket.SequenceNumber, length, tcpPacket.TCPData, (ulong)tcpPacket.TCPData.Length, tcpPacket.Syn, tcpPacket.SourceAddressAsLong, tcpPacket.DestinationAddressAsLong, (uint)tcpPacket.SourcePort, (uint)tcpPacket.DestinationPort); }
public void ReassemblePacket(Tamir.IPLib.Packets.TCPPacket tcpPacket) { PacketWritten = false; ulong length = (ulong)(tcpPacket.TCPPacketByteLength - tcpPacket.TCPHeaderLength); if (length == 0) { return; } reassemble_tcp((ulong)tcpPacket.SequenceNumber, length, tcpPacket.TCPData, (ulong)tcpPacket.TCPData.Length, tcpPacket.Syn, tcpPacket.SourceAddressAsLong, tcpPacket.DestinationAddressAsLong, (uint)tcpPacket.SourcePort, (uint)tcpPacket.DestinationPort); }
public static int GenerateHashCode(Tamir.IPLib.Packets.TCPPacket packet) { return(((packet.SourceAddress.GetHashCode() ^ packet.SourcePort.GetHashCode()) as object).GetHashCode() ^ ((packet.DestinationAddress.GetHashCode() ^ packet.DestinationPort.GetHashCode()) as object).GetHashCode()); }