Beispiel #1
0
        public int SaveNewPacket(PacketInfo packet)
        {
            int pos = -1;

            lock (thisLock)
            {
                dbf.AddRow();
                pos = dbf.GetCountRows - 1;

                dbf.SetValue(pos, POS_IP_SOURCE_POS, packet.ipSource, dbf.GetColumnType(POS_IP_SOURCE_POS));
                dbf.SetValue(pos, POS_IP_DEST_POS, packet.ipDestination, dbf.GetColumnType(POS_IP_DEST_POS));
                dbf.SetValue(pos, POS_ACTIVE, packet.active, dbf.GetColumnType(POS_ACTIVE));
                dbf.SetValue(pos, POS_PORT_SOURCE_POS, packet.portSource, dbf.GetColumnType(POS_PORT_SOURCE_POS));
                dbf.SetValue(pos, POS_PORT_DEST_POS, packet.portDestination, dbf.GetColumnType(POS_PORT_DEST_POS));
                dbf.SetValue(pos, POS_PROTOCOL, packet.protocol, dbf.GetColumnType(POS_PROTOCOL));
                dbf.SetValue(pos, POS_TOTAL_BYTES, Convert.ToString(packet.size), dbf.GetColumnType(POS_TOTAL_BYTES));
                dbf.SetValue(pos, POS_TOTAL_PACKETS, "1", dbf.GetColumnType(POS_TOTAL_PACKETS));
                dbf.SetValue(pos, POS_DATEBEGIN, packet.time.ToString(), dbf.GetColumnType(POS_DATEBEGIN));
                dbf.SetValue(pos, POS_LASTACTIVE, packet.time.ToString(), dbf.GetColumnType(POS_LASTACTIVE));
                dbf.SetValue(pos, POS_DESCRIPTION, packet.desription, dbf.GetColumnType(POS_DESCRIPTION));
                dbf.SetValue(pos, POS_PROTO, Convert.ToString((int)packet.protocolE), dbf.GetColumnType(POS_PROTO));
                dbf.RefreshRecordsCount();
            }
            return(pos);
        }