Main Page | Modules | Class List | Directories | File List | Class Members | File Members | Related Pages

packet_time.c

Go to the documentation of this file.
00001 /**
00002  * @file   packet_time.c
00003  * @author Chris Green <cmg@sourcefire.com>
00004  * @date   Tue Jun 17 17:09:59 2003
00005  * 
00006  * @brief  Easily allow modules to have a gettimeofday() based on packet time
00007  * 
00008  * In many modules in snort, especially the rate detectors need to
00009  * work based off time values.  It's very hard to reproduce time
00010  * constraints via pcap readbacks so we either have to throttle snort
00011  * or use the packet time.  I choose the latter.
00012  */
00013 
00014 #include "packet_time.h"
00015 
00016 static time_t s_first_packet  = 0;
00017 static time_t s_recent_packet = 0;
00018 
00019 void packet_time_update(time_t cur)
00020 {
00021     if(s_first_packet == 0)
00022     {
00023         s_first_packet = cur;
00024     }
00025 
00026     s_recent_packet = cur;
00027 }
00028 
00029 time_t packet_timeofday(void)
00030 {
00031     return s_recent_packet;
00032 }
00033 
00034 time_t packet_first_time(void)
00035 {
00036     return s_first_packet;
00037 }

Generated on Sun May 14 14:51:14 2006 by  doxygen 1.4.2