MCPcopy Create free account
hub / github.com/OpenVPN/openvpn3 / tun_stats

Method tun_stats

client/ovpncli.cpp:1216–1246  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1214 }
1215
1216 OPENVPN_CLIENT_EXPORT InterfaceStats OpenVPNClient::tun_stats() const
1217 {
1218 InterfaceStats ret;
1219 if (state->is_foreign_thread_access())
1220 {
1221 MySessionStats* stats = state->stats.get();
1222
1223 // The reason for the apparent inversion between in/out below is
1224 // that TUN_*_OUT stats refer to data written to tun device,
1225 // but from the perspective of tun interface, this is incoming
1226 // data. Vice versa for TUN_*_IN.
1227 if (stats)
1228 {
1229 ret.bytesOut = stats->stat_count(SessionStats::TUN_BYTES_IN);
1230 ret.bytesIn = stats->stat_count(SessionStats::TUN_BYTES_OUT);
1231 ret.packetsOut = stats->stat_count(SessionStats::TUN_PACKETS_IN);
1232 ret.packetsIn = stats->stat_count(SessionStats::TUN_PACKETS_OUT);
1233 ret.errorsOut = stats->error_count(Error::TUN_READ_ERROR);
1234 ret.errorsIn = stats->error_count(Error::TUN_WRITE_ERROR);
1235 return ret;
1236 }
1237 }
1238
1239 ret.bytesOut = 0;
1240 ret.bytesIn = 0;
1241 ret.packetsOut = 0;
1242 ret.packetsIn = 0;
1243 ret.errorsOut = 0;
1244 ret.errorsIn = 0;
1245 return ret;
1246 }
1247
1248 OPENVPN_CLIENT_EXPORT TransportStats OpenVPNClient::transport_stats() const
1249 {

Callers

nothing calls this directly

Calls 4

stat_countMethod · 0.80
error_countMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected