2020-02-28 02:20:28 +00:00
|
|
|
#include "common.hpp"
|
2020-03-03 00:42:06 +00:00
|
|
|
#include "pybind11/stl.h"
|
2020-02-28 02:20:28 +00:00
|
|
|
|
|
|
|
#include "tooling/router_event.hpp"
|
2020-03-01 01:58:45 +00:00
|
|
|
#include "tooling/dht_event.hpp"
|
2020-02-28 02:20:28 +00:00
|
|
|
|
2020-03-03 05:26:25 +00:00
|
|
|
#include <messages/relay_status.hpp>
|
2020-02-28 04:01:14 +00:00
|
|
|
#include <path/path.hpp>
|
|
|
|
|
2020-02-28 02:20:28 +00:00
|
|
|
namespace tooling
|
|
|
|
{
|
|
|
|
void
|
|
|
|
RouterEvent_Init(py::module & mod)
|
|
|
|
{
|
|
|
|
py::class_<RouterEvent>(mod, "RouterEvent")
|
2020-02-28 04:01:14 +00:00
|
|
|
.def("__repr__", &RouterEvent::ToString)
|
|
|
|
.def("__str__", &RouterEvent::ToString)
|
2020-02-29 22:53:54 +00:00
|
|
|
.def_readonly("routerID", &RouterEvent::routerID)
|
|
|
|
.def_readonly("triggered", &RouterEvent::triggered);
|
2020-02-28 02:20:28 +00:00
|
|
|
|
2020-03-01 00:26:23 +00:00
|
|
|
py::class_<PathAttemptEvent, RouterEvent>(mod, "PathAttemptEvent")
|
|
|
|
.def_readonly("hops", &PathAttemptEvent::hops);
|
|
|
|
|
|
|
|
py::class_<PathRequestReceivedEvent, RouterEvent>(mod, "PathRequestReceivedEvent")
|
|
|
|
.def_readonly("prevHop", &PathRequestReceivedEvent::prevHop)
|
|
|
|
.def_readonly("nextHop", &PathRequestReceivedEvent::nextHop)
|
2020-03-03 04:15:18 +00:00
|
|
|
.def_readonly("txid", &PathRequestReceivedEvent::txid)
|
|
|
|
.def_readonly("rxid", &PathRequestReceivedEvent::rxid)
|
2020-03-01 00:26:23 +00:00
|
|
|
.def_readonly("isEndpoint", &PathRequestReceivedEvent::isEndpoint);
|
2020-03-03 04:15:18 +00:00
|
|
|
|
2020-03-03 05:26:25 +00:00
|
|
|
py::class_<PathStatusReceivedEvent, RouterEvent>(mod, "PathStatusReceivedEvent")
|
|
|
|
.def_readonly("rxid", &PathStatusReceivedEvent::rxid)
|
|
|
|
.def_readonly("status", &PathStatusReceivedEvent::rxid)
|
|
|
|
.def_property_readonly("Successful", [](const PathStatusReceivedEvent* const ev) {
|
|
|
|
return ev->status == llarp::LR_StatusRecord::SUCCESS;
|
|
|
|
});
|
|
|
|
|
2020-03-02 22:10:01 +00:00
|
|
|
py::class_<PubIntroReceivedEvent, RouterEvent>(mod, "DhtPubIntroReceivedEvent")
|
2020-03-01 01:58:45 +00:00
|
|
|
.def_readonly("from", &PubIntroReceivedEvent::From)
|
|
|
|
.def_readonly("location", &PubIntroReceivedEvent::IntrosetLocation)
|
|
|
|
.def_readonly("relayOrder", &PubIntroReceivedEvent::RelayOrder)
|
|
|
|
.def_readonly("txid", &PubIntroReceivedEvent::TxID);
|
2020-03-03 04:15:18 +00:00
|
|
|
|
2020-03-02 22:10:01 +00:00
|
|
|
py::class_<GotIntroReceivedEvent, RouterEvent>(mod, "DhtGotIntroReceivedEvent")
|
2020-03-01 08:14:27 +00:00
|
|
|
.def_readonly("from", &GotIntroReceivedEvent::From)
|
|
|
|
.def_readonly("location", &GotIntroReceivedEvent::Introset)
|
|
|
|
.def_readonly("relayOrder", &GotIntroReceivedEvent::RelayOrder)
|
|
|
|
.def_readonly("txid", &GotIntroReceivedEvent::TxID);
|
2020-02-28 02:20:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace tooling
|