|
suricata
|
Go to the source code of this file.
Data Structures | |
| struct | SCTime_t |
Macros | |
| #define | SCTIME_INIT(t) |
| #define | SCTIME_INITIALIZER |
| #define | SCTIME_USECS(t) ((t).usecs) |
| #define | SCTIME_SECS(t) ((t).secs) |
| #define | SCTIME_MSECS(t) (SCTIME_SECS(t) * 1000 + SCTIME_USECS(t) / 1000) |
| #define | SCTIME_ADD_USECS(ts, us) |
| #define | SCTIME_ADD_SECS(ts, s) |
| #define | SCTIME_FROM_SECS(s) |
| #define | SCTIME_FROM_USECS(us) |
| #define | SCTIME_FROM_TIMEVAL(tv) |
| #define | SCTIME_FROM_TIMEVAL_UNTRUSTED(tv) |
| variant to deal with potentially bad timestamps, like from pcap files More... | |
| #define | SCTIME_FROM_TIMESPEC(ts) |
| #define | SCTIME_TO_TIMEVAL(tv, t) |
| #define | SCTIME_CMP(a, b, CMP) |
| #define | SCTIME_CMP_GTE(a, b) SCTIME_CMP((a), (b), >=) |
| #define | SCTIME_CMP_GT(a, b) SCTIME_CMP((a), (b), >) |
| #define | SCTIME_CMP_LT(a, b) SCTIME_CMP((a), (b), <) |
| #define | SCTIME_CMP_LTE(a, b) SCTIME_CMP((a), (b), <=) |
| #define | SCTIME_CMP_NEQ(a, b) SCTIME_CMP((a), (b), !=) |
| #define | SCTIME_CMP_EQ(a, b) SCTIME_CMP((a), (b), ==) |
| #define | FROM_TIMEVAL(timev) { .tv_sec = (timev).tv_sec, .tv_nsec = (timev).tv_usec * 1000 } |
| initialize a 'struct timespec' from a 'struct timeval'. More... | |
| #define | timeradd(a, b, r) |
Functions | |
| void | TimeInit (void) |
| void | TimeDeinit (void) |
| void | TimeSetByThread (const int thread_id, SCTime_t tv) |
| SCTime_t | TimeGet (void) |
| void | TimeSet (SCTime_t) |
| void | TimeSetToCurrentTime (void) |
| set the time to "gettimeofday" meant for testing More... | |
| void | TimeSetIncrementTime (uint32_t) |
| increment the time in the engine More... | |
| bool | TimeModeIsReady (void) |
| void | TimeModeSetLive (void) |
| void | TimeModeSetOffline (void) |
| bool | TimeModeIsLive (void) |
| struct tm * | SCLocalTime (time_t timep, struct tm *result) |
| void | CreateTimeString (const SCTime_t ts, char *str, size_t size) |
| void | CreateIsoTimeString (const SCTime_t ts, char *str, size_t size) |
| void | CreateUtcIsoTimeString (const SCTime_t ts, char *str, size_t size) |
| void | CreateFormattedTimeString (const struct tm *t, const char *fmt, char *str, size_t size) |
| time_t | SCMkTimeUtc (struct tm *tp) |
| Convert broken-down time to seconds since Unix epoch. More... | |
| int | SCStringPatternToTime (char *string, const char **patterns, int num_patterns, struct tm *time) |
| Parse a date string based on specified patterns. More... | |
| int | SCTimeToStringPattern (time_t epoch, const char *pattern, char *str, size_t size) |
| Convert epoch time to string pattern. More... | |
| uint64_t | SCParseTimeSizeString (const char *str) |
| Parse string containing time size (1m, 1h, etc). More... | |
| uint64_t | SCGetSecondsUntil (const char *str, time_t epoch) |
| Get seconds until a time unit changes. More... | |
| uint64_t | SCTimespecAsEpochMillis (const struct timespec *ts) |
| uint64_t | TimeDifferenceMicros (struct timeval t0, struct timeval t1) |
Definition in file util-time.h.
| #define FROM_TIMEVAL | ( | timev | ) | { .tv_sec = (timev).tv_sec, .tv_nsec = (timev).tv_usec * 1000 } |
initialize a 'struct timespec' from a 'struct timeval'.
Definition at line 125 of file util-time.h.
| #define SCTIME_ADD_SECS | ( | ts, | |
| s | |||
| ) |
Definition at line 65 of file util-time.h.
| #define SCTIME_ADD_USECS | ( | ts, | |
| us | |||
| ) |
| #define SCTIME_CMP | ( | a, | |
| b, | |||
| CMP | |||
| ) |
Definition at line 101 of file util-time.h.
| #define SCTIME_CMP_EQ | ( | a, | |
| b | |||
| ) | SCTIME_CMP((a), (b), ==) |
Definition at line 109 of file util-time.h.
| #define SCTIME_CMP_GT | ( | a, | |
| b | |||
| ) | SCTIME_CMP((a), (b), >) |
Definition at line 105 of file util-time.h.
| #define SCTIME_CMP_GTE | ( | a, | |
| b | |||
| ) | SCTIME_CMP((a), (b), >=) |
Definition at line 104 of file util-time.h.
| #define SCTIME_CMP_LT | ( | a, | |
| b | |||
| ) | SCTIME_CMP((a), (b), <) |
Definition at line 106 of file util-time.h.
| #define SCTIME_CMP_LTE | ( | a, | |
| b | |||
| ) | SCTIME_CMP((a), (b), <=) |
Definition at line 107 of file util-time.h.
| #define SCTIME_CMP_NEQ | ( | a, | |
| b | |||
| ) | SCTIME_CMP((a), (b), !=) |
Definition at line 108 of file util-time.h.
| #define SCTIME_FROM_SECS | ( | s | ) |
Definition at line 70 of file util-time.h.
| #define SCTIME_FROM_TIMESPEC | ( | ts | ) |
Definition at line 92 of file util-time.h.
| #define SCTIME_FROM_TIMEVAL | ( | tv | ) |
Definition at line 80 of file util-time.h.
| #define SCTIME_FROM_TIMEVAL_UNTRUSTED | ( | tv | ) |
| #define SCTIME_FROM_USECS | ( | us | ) |
Definition at line 75 of file util-time.h.
| #define SCTIME_INIT | ( | t | ) |
Definition at line 46 of file util-time.h.
| #define SCTIME_INITIALIZER |
Definition at line 52 of file util-time.h.
| #define SCTIME_MSECS | ( | t | ) | (SCTIME_SECS(t) * 1000 + SCTIME_USECS(t) / 1000) |
Definition at line 59 of file util-time.h.
| #define SCTIME_SECS | ( | t | ) | ((t).secs) |
Definition at line 58 of file util-time.h.
| #define SCTIME_TO_TIMEVAL | ( | tv, | |
| t | |||
| ) |
Definition at line 98 of file util-time.h.
| #define SCTIME_USECS | ( | t | ) | ((t).usecs) |
Definition at line 57 of file util-time.h.
| #define timeradd | ( | a, | |
| b, | |||
| r | |||
| ) |
Definition at line 128 of file util-time.h.
| void CreateFormattedTimeString | ( | const struct tm * | t, |
| const char * | fmt, | ||
| char * | str, | ||
| size_t | size | ||
| ) |
Definition at line 246 of file util-time.c.
Referenced by LogCustomFormatWriteTimestamp().

| void CreateIsoTimeString | ( | const SCTime_t | ts, |
| char * | str, | ||
| size_t | size | ||
| ) |
Definition at line 209 of file util-time.c.
References likely, SCLocalTime(), SCTIME_SECS, SCTIME_USECS, str, and ts.
Referenced by CreateEveHeader(), and EveAddFlow().


| void CreateTimeString | ( | const SCTime_t | ts, |
| char * | str, | ||
| size_t | size | ||
| ) |
Definition at line 272 of file util-time.c.
References likely, SCLocalTime(), SCTIME_SECS, SCTIME_USECS, str, and ts.
Referenced by AlertFastLogger().


| void CreateUtcIsoTimeString | ( | const SCTime_t | ts, |
| char * | str, | ||
| size_t | size | ||
| ) |
Definition at line 230 of file util-time.c.
References likely, SCTIME_SECS, SCTIME_USECS, SCUtcTime(), str, and ts.

| uint64_t SCGetSecondsUntil | ( | const char * | str, |
| time_t | epoch | ||
| ) |
Get seconds until a time unit changes.
| str | String containing time type (minute, hour, etc). |
| epoch | Epoch time. |
| seconds. |
Definition at line 621 of file util-time.c.
References SCLocalTime(), and str.
Referenced by SCConfLogOpenGeneric().


| struct tm* SCLocalTime | ( | time_t | timep, |
| struct tm * | result | ||
| ) |
Definition at line 267 of file util-time.c.
Referenced by CreateIsoTimeString(), CreateTimeString(), LogCustomFormatWriteTimestamp(), SCGetSecondsUntil(), and SCTimeToStringPattern().

| time_t SCMkTimeUtc | ( | struct tm * | tp | ) |
Convert broken-down time to seconds since Unix epoch.
This function is based on: http://www.catb.org/esr/time-programming (released to the public domain).
| tp | Pointer to broken-down time. |
| Seconds | since Unix epoch. |
Definition at line 442 of file util-time.c.
References MONTHSPERYEAR.
| uint64_t SCParseTimeSizeString | ( | const char * | str | ) |
Parse string containing time size (1m, 1h, etc).
| str | String to parse. |
| size | on success. |
| 0 | on failure. |
Definition at line 570 of file util-time.c.
References str.
Referenced by SCConfLogOpenGeneric().

| int SCStringPatternToTime | ( | char * | string, |
| const char ** | patterns, | ||
| int | num_patterns, | ||
| struct tm * | tp | ||
| ) |
Parse a date string based on specified patterns.
This function is based on GNU C library getdate.
| string | Date string to parse. |
| patterns | String array containing patterns. |
| num_patterns | Number of patterns to check. |
| tp | Pointer to broken-down time. |
| 0 | on success. |
| 1 | on failure. |
Definition at line 485 of file util-time.c.
References strptime().

| uint64_t SCTimespecAsEpochMillis | ( | const struct timespec * | ts | ) |
Definition at line 639 of file util-time.c.
References ts.
| int SCTimeToStringPattern | ( | time_t | epoch, |
| const char * | pattern, | ||
| char * | str, | ||
| size_t | size | ||
| ) |
Convert epoch time to string pattern.
This function converts epoch time to a string based on a pattern.
| epoch | Epoch time. |
| pattern | String pattern. |
| str | Formated string. |
| size | Size of allocated string. |
| 0 | on success. |
| 1 | on failure. |
Definition at line 541 of file util-time.c.
References SCLocalTime(), str, strlcpy(), and unlikely.

| void TimeDeinit | ( | void | ) |
Definition at line 87 of file util-time.c.
References SCSpinDestroy.
Referenced by GlobalsDestroy().

| uint64_t TimeDifferenceMicros | ( | struct timeval | t0, |
| struct timeval | t1 | ||
| ) |
Definition at line 644 of file util-time.c.
| SCTime_t TimeGet | ( | void | ) |
Definition at line 152 of file util-time.c.
References tv.
Referenced by TimeSetIncrementTime(), UTHBuildPacketIPV6Real(), and UTHBuildPacketReal().

| void TimeInit | ( | void | ) |
Definition at line 79 of file util-time.c.
References SCSpinInit.
Referenced by GlobalsInitPreConfig().

| bool TimeModeIsLive | ( | void | ) |
Definition at line 111 of file util-time.c.
| bool TimeModeIsReady | ( | void | ) |
Definition at line 92 of file util-time.c.
| void TimeModeSetLive | ( | void | ) |
Definition at line 99 of file util-time.c.
Referenced by RunModeIdsAFPAutoFp(), RunModeIdsAFPSingle(), RunModeIdsAFPWorkers(), RunModeIdsAFXDPSingle(), RunModeIdsAFXDPWorkers(), RunModeIdsDpdkWorkers(), RunModeIdsErfDagAutoFp(), RunModeIdsErfDagSingle(), RunModeIdsErfDagWorkers(), RunModeIdsPcapAutoFp(), RunModeIdsPcapSingle(), RunModeIdsPcapWorkers(), RunModeIpsIPFWAutoFp(), RunModeIpsIPFWWorker(), RunModeIpsNFQAutoFp(), RunModeIpsNFQWorker(), RunModeIpsWinDivertAutoFp(), and SCRunModeLibIdsLive().

| void TimeModeSetOffline | ( | void | ) |
Definition at line 105 of file util-time.c.
Referenced by RunModeErfFileAutoFp(), RunModeErfFileSingle(), RunModeFilePcapAutoFp(), RunModeFilePcapSingle(), and SCRunModeLibIdsOffline().

| void TimeSet | ( | SCTime_t | ) |
Definition at line 125 of file util-time.c.
Referenced by TimeSetIncrementTime(), and TimeSetToCurrentTime().

| void TimeSetByThread | ( | const int | thread_id, |
| SCTime_t | tv | ||
| ) |
Definition at line 116 of file util-time.c.
| void TimeSetIncrementTime | ( | uint32_t | tv_sec | ) |
increment the time in the engine
| tv_sec | seconds to increment the time with |
Definition at line 180 of file util-time.c.
References SCTIME_ADD_SECS, TimeGet(), TimeSet(), and ts.

| void TimeSetToCurrentTime | ( | void | ) |
set the time to "gettimeofday" meant for testing
Definition at line 140 of file util-time.c.
References SCTIME_FROM_TIMEVAL, TimeSet(), ts, and tv.
