FreeBSD/sys/netipsec/key.c
/* record data transfer on SA, and update timestamps */
record data transfer on SA, and update timestamps
record data transfer on SA and update timestamps
void
key_sa_recordxfer(struct secasvar *sav, struct mbuf *m)
{
	IPSEC_ASSERT(sav != NULL, ("Null secasvar"));
	IPSEC_ASSERT(m != NULL, ("Null mbuf"));
	if (!sav->lft_c)
		return;
	sav->lft_c->bytes += m->m_pkthdr.len;
	sav->lft_c->allocations++;
	sav->lft_c->usetime = time_second;
	return;
}
void key_sa_recordxfer ( struct secasvar * sav , struct mbuf * m ) { IPSEC_ASSERT ( sav != NULL , ( " " ) ) ; IPSEC_ASSERT ( m != NULL , ( " " ) ) ; if ( ! sav -> lft_c ) return ; sav -> lft_c -> bytes += m -> m_pkthdr . len ; sav -> lft_c -> allocations ++ ; sav -> lft_c -> usetime = time_second ; return ; }
record data transfer on SA, and update timestamps
record data transfer on SA and update timestamps
/*
	 * XXX Currently, there is a difference of bytes size
	 * between inbound and outbound processing.
	 */ /* to check bytes lifetime is done in key_timehandler(). */ /*
	 * We use the number of packets as the unit of
	 * allocations.  We increment the variable
	 * whenever {esp,ah}_{in,out}put is called.
	 */ /* XXX check for expires? */ /*
	 * NOTE: We record CURRENT usetime by using wall clock,
	 * in seconds.  HARD and SOFT lifetime are measured by the time
	 * difference (again in seconds) from usetime.
	 *
	 *	usetime
	 *	v     expire   expire
	 * -----+-----+--------+---> t
	 *	<--------------> HARD
	 *	<-----> SOFT
	 */ /* XXX check for expires? */