|
@@ -45,7 +45,7 @@ void statistics_db::writeStatisticsIP(const std::unordered_map<IPv4Address, entr
|
|
|
SQLite::Statement query(*db, "INSERT INTO ip_statistics VALUES (?, ?, ?, ?, ?, ?, ?, ?)");
|
|
|
for (auto it = ipStatistics.begin(); it != ipStatistics.end(); ++it) {
|
|
|
const entry_ipStat &e = it->second;
|
|
|
- query.bindNoCopy(1, it->first.to_string());
|
|
|
+ query.bind(1, it->first.to_string());
|
|
|
query.bind(2, (int) e.pkts_received);
|
|
|
query.bind(3, (int) e.pkts_sent);
|
|
|
query.bind(4, e.kbytes_received);
|
|
@@ -82,7 +82,7 @@ void statistics_db::writeStatisticsDegree(const std::unordered_map<IPv4Address,
|
|
|
SQLite::Statement query(*db, "INSERT INTO ip_degrees VALUES (?, ?, ?, ?)");
|
|
|
for (auto it = ipStatistics.begin(); it != ipStatistics.end(); ++it) {
|
|
|
const entry_ipStat &e = it->second;
|
|
|
- query.bindNoCopy(1, it->first.to_string());
|
|
|
+ query.bind(1, it->first.to_string());
|
|
|
query.bind(2, e.in_degree);
|
|
|
query.bind(3, e.out_degree);
|
|
|
query.bind(4, e.overall_degree);
|
|
@@ -114,7 +114,7 @@ void statistics_db::writeStatisticsTTL(const std::unordered_map<ipAddress_ttl, i
|
|
|
SQLite::Statement query(*db, "INSERT INTO ip_ttl VALUES (?, ?, ?)");
|
|
|
for (auto it = ttlDistribution.begin(); it != ttlDistribution.end(); ++it) {
|
|
|
const ipAddress_ttl &e = it->first;
|
|
|
- query.bindNoCopy(1, e.ipAddress.to_string());
|
|
|
+ query.bind(1, e.ipAddress.to_string());
|
|
|
query.bind(2, e.ttlValue);
|
|
|
query.bind(3, it->second);
|
|
|
query.exec();
|
|
@@ -145,7 +145,7 @@ void statistics_db::writeStatisticsMSS(const std::unordered_map<ipAddress_mss, i
|
|
|
SQLite::Statement query(*db, "INSERT INTO tcp_mss VALUES (?, ?, ?)");
|
|
|
for (auto it = mssDistribution.begin(); it != mssDistribution.end(); ++it) {
|
|
|
const ipAddress_mss &e = it->first;
|
|
|
- query.bindNoCopy(1, e.ipAddress.to_string());
|
|
|
+ query.bind(1, e.ipAddress.to_string());
|
|
|
query.bind(2, e.mssValue);
|
|
|
query.bind(3, it->second);
|
|
|
query.exec();
|
|
@@ -175,7 +175,7 @@ void statistics_db::writeStatisticsToS(const std::unordered_map<ipAddress_tos, i
|
|
|
SQLite::Statement query(*db, "INSERT INTO ip_tos VALUES (?, ?, ?)");
|
|
|
for (auto it = tosDistribution.begin(); it != tosDistribution.end(); ++it) {
|
|
|
const ipAddress_tos &e = it->first;
|
|
|
- query.bindNoCopy(1, e.ipAddress.to_string());
|
|
|
+ query.bind(1, e.ipAddress.to_string());
|
|
|
query.bind(2, e.tosValue);
|
|
|
query.bind(3, it->second);
|
|
|
query.exec();
|
|
@@ -206,7 +206,7 @@ void statistics_db::writeStatisticsWin(const std::unordered_map<ipAddress_win, i
|
|
|
SQLite::Statement query(*db, "INSERT INTO tcp_win VALUES (?, ?, ?)");
|
|
|
for (auto it = winDistribution.begin(); it != winDistribution.end(); ++it) {
|
|
|
const ipAddress_win &e = it->first;
|
|
|
- query.bindNoCopy(1, e.ipAddress.to_string());
|
|
|
+ query.bind(1, e.ipAddress.to_string());
|
|
|
query.bind(2, e.winSize);
|
|
|
query.bind(3, it->second);
|
|
|
query.exec();
|
|
@@ -237,7 +237,7 @@ void statistics_db::writeStatisticsProtocols(const std::unordered_map<ipAddress_
|
|
|
SQLite::Statement query(*db, "INSERT INTO ip_protocols VALUES (?, ?, ?, ?)");
|
|
|
for (auto it = protocolDistribution.begin(); it != protocolDistribution.end(); ++it) {
|
|
|
const ipAddress_protocol &e = it->first;
|
|
|
- query.bindNoCopy(1, e.ipAddress.to_string());
|
|
|
+ query.bind(1, e.ipAddress.to_string());
|
|
|
query.bindNoCopy(2, e.protocol);
|
|
|
query.bind(3, it->second.count);
|
|
|
query.bind(4, it->second.byteCount);
|
|
@@ -279,7 +279,7 @@ void statistics_db::writeStatisticsPorts(const std::unordered_map<ipAddress_inOu
|
|
|
else {portService = "unknown";}
|
|
|
}
|
|
|
|
|
|
- query.bindNoCopy(1, e.ipAddress.to_string());
|
|
|
+ query.bind(1, e.ipAddress.to_string());
|
|
|
query.bindNoCopy(2, e.trafficDirection);
|
|
|
query.bind(3, e.portNumber);
|
|
|
query.bind(4, it->second.count);
|
|
@@ -311,7 +311,7 @@ void statistics_db::writeStatisticsIpMac(const std::unordered_map<IPv4Address, s
|
|
|
db->exec(createTable);
|
|
|
SQLite::Statement query(*db, "INSERT INTO ip_mac VALUES (?, ?)");
|
|
|
for (auto it = IpMacStatistics.begin(); it != IpMacStatistics.end(); ++it) {
|
|
|
- query.bindNoCopy(1, it->first.to_string());
|
|
|
+ query.bind(1, it->first.to_string());
|
|
|
query.bindNoCopy(2, it->second);
|
|
|
query.exec();
|
|
|
query.reset();
|
|
@@ -420,9 +420,9 @@ void statistics_db::writeStatisticsConv(std::unordered_map<conv, entry_convStat>
|
|
|
std::chrono::microseconds conn_duration = end_timesttamp - start_timesttamp;
|
|
|
e.avg_pkt_rate = (float) e.pkts_count * 1000000 / conn_duration.count(); // pkt per sec
|
|
|
|
|
|
- query.bindNoCopy(1, f.ipAddressA.to_string());
|
|
|
+ query.bind(1, f.ipAddressA.to_string());
|
|
|
query.bind(2, f.portA);
|
|
|
- query.bindNoCopy(3, f.ipAddressB.to_string());
|
|
|
+ query.bind(3, f.ipAddressB.to_string());
|
|
|
query.bind(4, f.portB);
|
|
|
query.bind(5, (int) e.pkts_count);
|
|
|
query.bind(6, (float) e.avg_pkt_rate);
|
|
@@ -495,9 +495,9 @@ void statistics_db::writeStatisticsConvExt(std::unordered_map<convWithProt, entr
|
|
|
e.avg_pkt_rate = e.pkts_count / e.total_comm_duration;
|
|
|
|
|
|
if (e.avg_int_pkts_count > 0){
|
|
|
- query.bindNoCopy(1, f.ipAddressA.to_string());
|
|
|
+ query.bind(1, f.ipAddressA.to_string());
|
|
|
query.bind(2, f.portA);
|
|
|
- query.bindNoCopy(3, f.ipAddressB.to_string());
|
|
|
+ query.bind(3, f.ipAddressB.to_string());
|
|
|
query.bind(4, f.portB);
|
|
|
query.bindNoCopy(5, f.protocol);
|
|
|
query.bind(6, (int) e.pkts_count);
|