lokinet/pybind/llarp/peerstats.cpp
dr7ana 46ad8d4058 Clang format include sorting + CMake
- includes are now sorted in consistent, logical order; first step in an attempt to fix the tomfoolery (no relation to Tom) brought in by include-what-you-use
- shuffled around some cmake linking to simplify dependency graph
- superfluous files removed
2023-10-24 12:11:51 -07:00

41 lines
1.8 KiB
C++

#include <llarp/config/config.hpp>
#include <llarp/peerstats/peer_db.hpp>
#include <llarp/peerstats/types.hpp>
#include <common.hpp>
#include <netinet/in.h>
namespace llarp
{
void
PeerDb_Init(py::module& mod)
{
using PeerDb_ptr = std::shared_ptr<PeerDb>;
py::class_<PeerDb, PeerDb_ptr>(mod, "PeerDb")
.def("getCurrentPeerStats", &PeerDb::getCurrentPeerStats);
}
void
PeerStats_Init(py::module& mod)
{
py::class_<PeerStats>(mod, "PeerStats")
.def_readwrite("routerId", &PeerStats::routerId)
.def_readwrite("numConnectionAttempts", &PeerStats::numConnectionAttempts)
.def_readwrite("numConnectionSuccesses", &PeerStats::numConnectionSuccesses)
.def_readwrite("numConnectionRejections", &PeerStats::numConnectionRejections)
.def_readwrite("numConnectionTimeouts", &PeerStats::numConnectionTimeouts)
.def_readwrite("numPathBuilds", &PeerStats::numPathBuilds)
.def_readwrite("numPacketsAttempted", &PeerStats::numPacketsAttempted)
.def_readwrite("numPacketsSent", &PeerStats::numPacketsSent)
.def_readwrite("numPacketsDropped", &PeerStats::numPacketsDropped)
.def_readwrite("numPacketsResent", &PeerStats::numPacketsResent)
.def_readwrite("numDistinctRCsReceived", &PeerStats::numDistinctRCsReceived)
.def_readwrite("numLateRCs", &PeerStats::numLateRCs)
.def_readwrite("peakBandwidthBytesPerSec", &PeerStats::peakBandwidthBytesPerSec)
.def_readwrite("longestRCReceiveInterval", &PeerStats::longestRCReceiveInterval)
.def_readwrite("leastRCRemainingLifetime", &PeerStats::leastRCRemainingLifetime)
.def_readwrite("lastRCUpdated", &PeerStats::lastRCUpdated)
.def_readwrite("stale", &PeerStats::stale);
}
} // namespace llarp