/*************** Reset a record in the hash table **************************/
---------------------------------------------------------------------------
/* Reset flow record */
----------------------------------
function reset_flow(flow_stats fs)
----------------------------------
{ 
  if (fs did not send or receive any packet during FLOW_INACTIVE_PERIOD)
  {
	delete fs
	decrement flow_hash_table.filled 
  }
  else
  {
      fs.sent_to = 0
      fs.good_bytes = 0
      fs.good_bytes_old = fs.good_bytes_old * ALPHA + fs.good_bytes*(1-ALPHA)
      fs.received_from = 0
      fs.sent_bytes = 0
      fs.received_bytes = 0
      fs.TCP_received_from = 0
      fs.TCP_sent_to = 0
      fs.TCP_sent_bytes = 0
      fs.TCP_received_bytes = 0
      fs.UDP_received_from = 0
      fs.UDP_sent_to = 0
      fs.UDP_sent_bytes = 0
      fs.UDP_received_bytes = 0
      fs.ICMP_received_from = 0
      fs.ICMP_sent_to = 0
      fs.ICMP_sent_bytes = 0
      fs.ICMP_received_bytes = 0
      fs.OTHER_received_from = 0
      fs.OTHER_sent_to = 0
      fs.OTHER_sent_bytes = 0
      fs.OTHER_received_bytes = 0
      get current time with maximum precision, as seconds and fractions of
      	seconds and store it in fs.timestamp
}
---------------------------------------------------------------------------
/* Reset connection record */
----------------------------------------------
function reset_connection(connection_stats cs)
----------------------------------------------
{ 
  if ((cs.classification == GOOD and 
     cs did not send or receive any packet during GOOD_CONN_INACTIVE_PERIOD) or
     cs did not send or receive any packet during TRAN_CONN_INACTIVE_PERIOD))
  {
	find flow i which contains cs
	switch (cs.protocol)
	{
		TCP:  	decrement flow[i].TCP_conn
		UDP:  	decrement flow[i].UDP_conn
		ICMP:  	decrement flow[i].ICMP_conn
		OTHER:  decrement flow[i].OTHER_conn
	}
	delete cs
	decrement connection_hash_table.filled 
  }
  else
  {
      cs.sent_to = 0
      cs.received_from = 0
      cs.sent_bytes = 0
      cs.received_bytes = 0
      get current time with maximum precision, as seconds and fractions of
      	seconds and store it in cs.timestamp
}
