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