| 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 | { |
nothing calls this directly
no test coverage detected