MCPcopy Create free account
hub / github.com/attermann/microReticulum / ExampleAnnounceHandler

Class ExampleAnnounceHandler

examples/udp_announce/src/main.cpp:45–61  ·  view source on GitHub ↗

Test AnnounceHandler

Source from the content-addressed store, hash-verified

43
44// Test AnnounceHandler
45class ExampleAnnounceHandler : public RNS::AnnounceHandler {
46public:
47 ExampleAnnounceHandler(const char* aspect_filter = nullptr) : AnnounceHandler(aspect_filter) {}
48 virtual ~ExampleAnnounceHandler() {}
49 virtual void received_announce(const RNS::Bytes& destination_hash, const RNS::Identity& announced_identity, const RNS::Bytes& app_data) {
50 INFO("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
51 INFOF("ExampleAnnounceHandler: destination hash: %s", destination_hash.toHex().c_str());
52 if (announced_identity) {
53 INFOF("ExampleAnnounceHandler: announced identity hash: %s", announced_identity.hash().toHex().c_str());
54 INFOF("ExampleAnnounceHandler: announced identity app data: %s", announced_identity.app_data().toHex().c_str());
55 }
56 if (app_data) {
57 INFOF("ExampleAnnounceHandler: app data text: \"%s\"", app_data.toString().c_str());
58 }
59 INFO("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
60 }
61};
62
63// Test packet receive callback
64void onPacket(const RNS::Bytes& data, const RNS::Packet& packet) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected