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-03-03 19:56:33 +00:00
|
|
|
#include "tooling/path_event.hpp"
|
|
|
|
#include "tooling/rc_event.hpp"
|
2020-06-11 19:02:34 +00:00
|
|
|
#include "tooling/peer_stats_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
|
2020-03-07 01:20:11 +00:00
|
|
|
RouterEvent_Init(py::module& mod)
|
2020-02-28 02:20:28 +00:00
|
|
|
{
|
2020-04-07 18:38:56 +00:00
|
|
|
py::class_<RouterEvent>(mod, "RouterEvent")
|
2020-03-07 01:20:11 +00:00
|
|
|
.def("__repr__", &RouterEvent::ToString)
|
|
|
|
.def("__str__", &RouterEvent::ToString)
|
|
|
|
.def_readonly("routerID", &RouterEvent::routerID)
|
|
|
|
.def_readonly("triggered", &RouterEvent::triggered);
|
2020-02-28 02:20:28 +00:00
|
|
|
|
2020-04-07 18:38:56 +00:00
|
|
|
py::class_<PathAttemptEvent, RouterEvent>(mod, "PathAttemptEvent")
|
2020-03-07 01:20:11 +00:00
|
|
|
.def_readonly("hops", &PathAttemptEvent::hops);
|
2020-03-01 00:26:23 +00:00
|
|
|
|
2020-04-07 18:38:56 +00:00
|
|
|
py::class_<PathRequestReceivedEvent, RouterEvent>(mod, "PathRequestReceivedEvent")
|
2020-03-07 01:20:11 +00:00
|
|
|
.def_readonly("prevHop", &PathRequestReceivedEvent::prevHop)
|
|
|
|
.def_readonly("nextHop", &PathRequestReceivedEvent::nextHop)
|
|
|
|
.def_readonly("txid", &PathRequestReceivedEvent::txid)
|
|
|
|
.def_readonly("rxid", &PathRequestReceivedEvent::rxid)
|
|
|
|
.def_readonly("isEndpoint", &PathRequestReceivedEvent::isEndpoint);
|
2020-03-03 04:15:18 +00:00
|
|
|
|
2020-04-07 18:38:56 +00:00
|
|
|
py::class_<PathStatusReceivedEvent, RouterEvent>(mod, "PathStatusReceivedEvent")
|
2020-03-07 01:20:11 +00:00
|
|
|
.def_readonly("rxid", &PathStatusReceivedEvent::rxid)
|
|
|
|
.def_readonly("status", &PathStatusReceivedEvent::rxid)
|
2020-04-07 18:38:56 +00:00
|
|
|
.def_property_readonly("Successful", [](const PathStatusReceivedEvent* const ev) {
|
|
|
|
return ev->status == llarp::LR_StatusRecord::SUCCESS;
|
|
|
|
});
|
2020-03-03 05:26:25 +00:00
|
|
|
|
2020-04-07 18:38:56 +00:00
|
|
|
py::class_<PubIntroSentEvent, RouterEvent>(mod, "DhtPubIntroSentEvent")
|
2020-03-07 01:20:11 +00:00
|
|
|
.def_readonly("introsetPubkey", &PubIntroSentEvent::introsetPubkey)
|
|
|
|
.def_readonly("relay", &PubIntroSentEvent::relay)
|
|
|
|
.def_readonly("relayIndex", &PubIntroSentEvent::relayIndex);
|
2020-03-04 05:57:07 +00:00
|
|
|
|
2020-04-07 18:38:56 +00:00
|
|
|
py::class_<PubIntroReceivedEvent, RouterEvent>(mod, "DhtPubIntroReceivedEvent")
|
2020-03-12 19:51:57 +00:00
|
|
|
.def_readonly("from", &PubIntroReceivedEvent::from)
|
|
|
|
.def_readonly("location", &PubIntroReceivedEvent::location)
|
|
|
|
.def_readonly("relayOrder", &PubIntroReceivedEvent::relayOrder)
|
|
|
|
.def_readonly("txid", &PubIntroReceivedEvent::txid);
|
2020-03-03 04:15:18 +00:00
|
|
|
|
2020-04-07 18:38:56 +00:00
|
|
|
py::class_<GotIntroReceivedEvent, RouterEvent>(mod, "DhtGotIntroReceivedEvent")
|
2020-03-07 01:20:11 +00:00
|
|
|
.def_readonly("from", &GotIntroReceivedEvent::From)
|
|
|
|
.def_readonly("location", &GotIntroReceivedEvent::Introset)
|
|
|
|
.def_readonly("relayOrder", &GotIntroReceivedEvent::RelayOrder)
|
|
|
|
.def_readonly("txid", &GotIntroReceivedEvent::TxID);
|
2020-03-03 19:56:33 +00:00
|
|
|
|
2020-04-07 18:38:56 +00:00
|
|
|
py::class_<RCGossipReceivedEvent, RouterEvent>(mod, "RCGossipReceivedEvent")
|
2020-03-07 01:20:11 +00:00
|
|
|
.def_readonly("rc", &RCGossipReceivedEvent::rc)
|
|
|
|
.def("LongString", &RCGossipReceivedEvent::LongString);
|
2020-03-04 00:50:20 +00:00
|
|
|
|
2020-04-07 18:38:56 +00:00
|
|
|
py::class_<RCGossipSentEvent, RouterEvent>(mod, "RCGossipSentEvent")
|
2020-03-07 01:20:11 +00:00
|
|
|
.def_readonly("rc", &RCGossipSentEvent::rc)
|
|
|
|
.def("LongString", &RCGossipSentEvent::LongString);
|
2020-03-10 18:12:11 +00:00
|
|
|
|
2020-04-07 18:38:56 +00:00
|
|
|
py::class_<FindRouterEvent, RouterEvent>(mod, "FindRouterEvent")
|
2020-03-12 17:50:46 +00:00
|
|
|
.def_readonly("from", &FindRouterEvent::from)
|
|
|
|
.def_readonly("iterative", &FindRouterEvent::iterative)
|
|
|
|
.def_readonly("exploritory", &FindRouterEvent::exploritory)
|
|
|
|
.def_readonly("txid", &FindRouterEvent::txid)
|
|
|
|
.def_readonly("version", &FindRouterEvent::version);
|
2020-03-10 18:12:11 +00:00
|
|
|
|
2020-04-07 18:38:56 +00:00
|
|
|
py::class_<FindRouterReceivedEvent, FindRouterEvent, RouterEvent>(
|
|
|
|
mod, "FindRouterReceivedEvent");
|
2020-03-12 17:50:46 +00:00
|
|
|
|
2020-04-07 18:38:56 +00:00
|
|
|
py::class_<FindRouterSentEvent, FindRouterEvent, RouterEvent>(mod, "FindRouterSentEvent");
|
2020-06-11 19:02:34 +00:00
|
|
|
|
|
|
|
py::class_<LinkSessionEstablishedEvent, RouterEvent>(mod, "LinkSessionEstablishedEvent")
|
|
|
|
.def_readonly("remoteId", &LinkSessionEstablishedEvent::remoteId)
|
|
|
|
.def_readonly("inbound", &LinkSessionEstablishedEvent::inbound);
|
2020-06-15 17:37:57 +00:00
|
|
|
|
|
|
|
py::class_<ConnectionAttemptEvent, RouterEvent>(mod, "ConnectionAttemptEvent")
|
|
|
|
.def_readonly("remoteId", &ConnectionAttemptEvent::remoteId);
|
2020-02-28 02:20:28 +00:00
|
|
|
}
|
|
|
|
|
2020-03-07 01:20:11 +00:00
|
|
|
} // namespace tooling
|