Skip to content

Commit a5965b1

Browse files
authored
Master hotfix 1.6.1 (#230)
* update * removed submodules from master * emergency release of version 1.6.1, with all submodules flattened. It should compile on all platforms. * removed macos from git actions. If you want macos, you will need to install openssl through macports. We have support for the native mac crypto libraries in the next version. * removed the darwin stuff that was causing linux configure.ac to crash * just ubuntu 20.04 now * install more of boost * more typos
1 parent bf62371 commit a5965b1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+9883
-69
lines changed

.github/workflows/continuous-integration.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
runs-on: ${{ matrix.os }}
1313
strategy:
1414
matrix:
15-
os: ['ubuntu-18.04', 'ubuntu-20.04', 'macos-10.15']
15+
os: ['ubuntu-20.04']
1616

1717
steps:
1818
# https://github.com/actions/checkout
@@ -29,11 +29,10 @@ jobs:
2929
- name: Install C++ dependencies on Ubuntu
3030
if: startsWith(matrix.os, 'ubuntu')
3131
run: |
32-
sudo apt install libtool autoconf automake g++ libboost-dev libssl-dev libpcap-dev libcairo2-dev
32+
sudo apt install libtool autoconf automake g++ libboost-all-dev libssl-dev libpcap-dev libcairo2-dev
3333
automake --help
3434
3535
- name: c/c++ test
3636
run: |
3737
bash bootstrap.sh
38-
./configure && make && make check
39-
38+
./configure && make && make check

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,3 +93,4 @@ tests/*.pdf
9393
tests/out
9494
tests/packet1.pcap
9595
*.d
96+
ar-lib

.gitmodules

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
[submodule "src/be13_api"]
2-
path = src/be13_api
3-
url = https://github.com/simsong/be13_api.git
4-
branch = master
5-
[submodule "src/dfxml"]
6-
path = src/dfxml_x
7-
url = https://github.com/simsong/dfxml.git
8-
branch = master
91
[submodule "src/http-parser"]
102
path = src/http-parser
113
url = https://github.com/simsong/http-parser.git

configure.ac

Lines changed: 2 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# and http://www.openismus.com/documents/linux/automake/automake.shtml
88

99
AC_PREREQ(2.57)
10-
AC_INIT(TCPFLOW, 1.6.0, [email protected])
10+
AC_INIT(TCPFLOW, 1.6.1, [email protected])
1111
AC_CONFIG_MACRO_DIR([m4])
1212

1313
AC_CONFIG_FILES([Makefile src/Makefile tests/Makefile doc/Makefile])
@@ -143,50 +143,7 @@ done
143143
unset option
144144

145145

146-
# C++
147-
# We don't use these warnings:
148-
# -Waggregate-return -- aggregate returns are GOOD; they simplify code design
149-
# We can use these warnings after ZLIB gets upgraded:
150-
# -Wundef --- causes problems with zlib
151-
# -Wcast-qual
152-
# -Wmissing-format-attribute --- Just too annoying
153-
AC_LANG_PUSH(C++)
154-
WARNINGS_TO_TEST="-Wall -MD -D_FORTIFY_SOURCE=2 -Wpointer-arith \
155-
-Wshadow -Wwrite-strings -Wcast-align \
156-
-Wredundant-decls -Wdisabled-optimization \
157-
-Wfloat-equal -Wmultichar -Wmissing-noreturn \
158-
-Woverloaded-virtual -Wsign-promo \
159-
-funit-at-a-time"
160-
161-
add_strict_null_sentinel='yes'
162-
if $CXX -dM -E - < /dev/null | grep -q __clang__ ; then
163-
AC_MSG_RESULT([Using clang])
164-
add_strict_null_sentinel='no'
165-
fi
166-
167-
if uname -a | grep -q Darwin; then
168-
add_strict_null_sentinel='no'
169-
fi
170-
171-
if [ $add_strict_null_sentinel = 'yes' ]; then
172-
WARNINGS_TO_TEST="$WARNINGS_TO_TEST -Wstrict-null-sentinel"
173-
fi
174-
175-
for option in $WARNINGS_TO_TEST
176-
do
177-
SAVE_CXXFLAGS="$CXXFLAGS"
178-
CXXFLAGS="$CXXFLAGS $option"
179-
AC_MSG_CHECKING([whether g++ understands $option])
180-
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
181-
[has_option=yes],
182-
[has_option=no; CXXFLAGS="$SAVE_CXXFLAGS"])
183-
AC_MSG_RESULT($has_option)
184-
unset has_option
185-
unset SAVE_CXXFLAGS
186-
done
187-
unset option
188-
AC_LANG_POP()
189-
146+
# CUT1
190147
################################################################
191148
##
192149

src/Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ tcpflow_SOURCES = \
104104
mime_map.h
105105

106106
# Removed because it hasn't been updated to Python 3:
107-
scan_python.cpp \
107+
# scan_python.cpp
108108

109109

110110
EXTRA_DIST =\

src/be13_api

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/be13_api/Makefile.defs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
BE13_API= \
2+
be13_api/atomic_set_map.h \
3+
be13_api/aftimer.h \
4+
be13_api/beregex.cpp \
5+
be13_api/beregex.h \
6+
be13_api/bulk_extractor_i.h \
7+
be13_api/cppmutex.h \
8+
be13_api/feature_recorder.cpp \
9+
be13_api/feature_recorder.h \
10+
be13_api/feature_recorder_set.cpp \
11+
be13_api/feature_recorder_set.h \
12+
be13_api/feature_recorder_sql.cpp \
13+
be13_api/histogram.h \
14+
be13_api/histogram.cpp \
15+
be13_api/net_ethernet.h \
16+
be13_api/pcap_fake.cpp \
17+
be13_api/pcap_fake.h \
18+
be13_api/plugin.cpp \
19+
be13_api/sbuf.cpp \
20+
be13_api/sbuf.h \
21+
be13_api/sbuf_private.h \
22+
be13_api/sbuf_stream.cpp \
23+
be13_api/sbuf_stream.h \
24+
be13_api/unicode_escape.cpp \
25+
be13_api/unicode_escape.h \
26+
be13_api/utf8.h \
27+
be13_api/utf8/checked.h \
28+
be13_api/utf8/core.h \
29+
be13_api/utf8/unchecked.h \
30+
be13_api/utils.cpp \
31+
be13_api/utils.h \
32+
be13_api/word_and_context_list.cpp \
33+
be13_api/word_and_context_list.h
34+
35+
36+

src/be13_api/aftimer.h

Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
#ifndef __AFTIMER_H__
2+
#define __AFTIMER_H__
3+
4+
#ifdef __cplusplus
5+
#ifndef WIN32
6+
#ifndef __STDC_FORMAT_MACROS
7+
#define __STDC_FORMAT_MACROS
8+
#endif
9+
#include <inttypes.h>
10+
#include <sys/time.h>
11+
#endif
12+
#include <sys/types.h>
13+
#include <stdio.h>
14+
#include <string>
15+
16+
class aftimer {
17+
struct timeval t0;
18+
bool running;
19+
long total_sec;
20+
long total_usec;
21+
double lap_time_; // time from when we last did a "stop"
22+
public:
23+
aftimer():t0(),running(false),total_sec(0),total_usec(0),lap_time_(0){}
24+
25+
void start(); // start the timer
26+
void stop(); // stop the timer
27+
28+
time_t tstart() const { return t0.tv_sec;} // time we started
29+
double elapsed_seconds() const; // how long timer has been running, total
30+
double lap_time() const; // how long the timer is running this time
31+
double eta(double fraction_done) const; // calculate ETA in seconds, given fraction
32+
std::string hms(long t) const; // turn a number of seconds into h:m:s
33+
std::string elapsed_text() const; /* how long we have been running */
34+
std::string eta_text(double fraction_done) const; // h:m:s
35+
std::string eta_time(double fraction_done) const; // the actual time
36+
};
37+
38+
/* This code in part from
39+
* http://social.msdn.microsoft.com/Forums/en/vcgeneral/thread/430449b3-f6dd-4e18-84de-eebd26a8d668
40+
*/
41+
42+
#if defined(WIN32) || defined(__MINGW32__)
43+
# include <winsock2.h>
44+
# include <windows.h>
45+
# ifndef DELTA_EPOCH_IN_MICROSECS
46+
# if defined(_MSC_VER) || defined(_MSC_EXTENSIONS)
47+
# define DELTA_EPOCH_IN_MICROSECS 11644473600000000Ui64
48+
# else
49+
# define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL
50+
# endif
51+
# endif
52+
#endif
53+
54+
inline void timestamp(struct timeval *t)
55+
{
56+
#ifdef WIN32
57+
FILETIME ft;
58+
GetSystemTimeAsFileTime(&ft);
59+
unsigned __int64 tmpres = 0;
60+
tmpres |= ft.dwHighDateTime;
61+
tmpres <<= 32;
62+
tmpres |= ft.dwLowDateTime;
63+
64+
/*converting file time to unix epoch*/
65+
tmpres -= DELTA_EPOCH_IN_MICROSECS;
66+
tmpres /= 10; /*convert into microseconds*/
67+
t->tv_sec = (long)(tmpres / 1000000UL);
68+
t->tv_usec = (long)(tmpres % 1000000UL);
69+
#else
70+
gettimeofday(t,NULL);
71+
#endif
72+
}
73+
74+
inline void aftimer::start()
75+
{
76+
timestamp(&t0);
77+
running = 1;
78+
}
79+
80+
inline void aftimer::stop(){
81+
if(running){
82+
struct timeval t;
83+
timestamp(&t);
84+
total_sec += t.tv_sec - t0.tv_sec;
85+
total_usec += t.tv_usec - t0.tv_usec;
86+
lap_time_ = (double)(t.tv_sec - t0.tv_sec) + (double)(t.tv_usec - t0.tv_usec)/1000000.0;
87+
running = false;
88+
}
89+
}
90+
91+
inline double aftimer::lap_time() const
92+
{
93+
return lap_time_;
94+
}
95+
96+
inline double aftimer::elapsed_seconds() const
97+
{
98+
double ret = (double)total_sec + (double)total_usec/1000000.0;
99+
if(running){
100+
struct timeval t;
101+
timestamp(&t);
102+
ret += t.tv_sec - t0.tv_sec;
103+
ret += (t.tv_usec - t0.tv_usec) / 1000000.0;
104+
}
105+
return ret;
106+
}
107+
108+
inline std::string aftimer::hms(long t) const
109+
{
110+
char buf[64];
111+
int days = t / (60*60*24);
112+
113+
t = t % (60*60*24); /* what's left */
114+
115+
int h = t / 3600;
116+
int m = (t / 60) % 60;
117+
int s = t % 60;
118+
buf[0] = 0;
119+
switch(days){
120+
case 0:
121+
snprintf(buf,sizeof(buf),"%2d:%02d:%02d",h,m,s);
122+
break;
123+
case 1:
124+
snprintf(buf,sizeof(buf),"%d day, %2d:%02d:%02d",days,h,m,s);
125+
break;
126+
default:
127+
snprintf(buf,sizeof(buf),"%d days %2d:%02d:%02d",days,h,m,s);
128+
}
129+
return std::string(buf);
130+
}
131+
132+
inline std::string aftimer::elapsed_text() const
133+
{
134+
return hms((int)elapsed_seconds());
135+
}
136+
137+
/**
138+
* returns the number of seconds until the job is complete.
139+
*/
140+
inline double aftimer::eta(double fraction_done) const
141+
{
142+
double t = elapsed_seconds();
143+
if(t<=0) return -1; // can't figure it out
144+
if(fraction_done<=0) return -1; // can't figure it out
145+
return (t * 1.0/fraction_done - t);
146+
}
147+
148+
/**
149+
* Retuns the number of hours:minutes:seconds until the job is done.
150+
*/
151+
inline std::string aftimer::eta_text(double fraction_done) const
152+
{
153+
double e = eta(fraction_done);
154+
if(e<0) return std::string("n/a"); // can't figure it out
155+
return hms((long)e);
156+
}
157+
158+
/**
159+
* Returns the time when data is due.
160+
*/
161+
inline std::string aftimer::eta_time(double fraction_done) const
162+
{
163+
time_t t = time_t(eta(fraction_done)) + time(0);
164+
struct tm tm;
165+
#ifdef HAVE_LOCALTIME_R
166+
localtime_r(&t,&tm);
167+
#else
168+
tm = *localtime(&t);
169+
#endif
170+
171+
char buf[64];
172+
snprintf(buf,sizeof(buf),"%02d:%02d:%02d",tm.tm_hour,tm.tm_min,tm.tm_sec);
173+
return std::string(buf);
174+
}
175+
176+
#endif
177+
178+
#endif

0 commit comments

Comments
 (0)