virtual void _receive_msg(std::shared_ptr<const Msg>&& m, int /* index */) { /* * Controllo per vedere se il pacchetto entrante è un packetPlus */ if(m->type() != MSG_ID(PacketPlus)) throw std::runtime_error("wrong message type in metric_block"); pkt_count++; auto pktp = static_cast<const PacketPlus *>(m.get()); if ( !(pktp->is_udp() && pktp->src_port() == 53 ) ) // && pktp->get_DNSflag() == 0) ) { send_out_through(std::move(m), id_outgate); return; } buff_mon.Reset(); /* auto packet = pktp->getPacket(); */ // uint64_t time_packet_us = pktp->timestamp_us(); // double time_packet = time_packet_us/1000000.0; // std::vector<uint32_t> answersIP; // pktp->get_answersIP(answersIP); // std::string domain = pktp->get_domain_query(); // buff_mon << domain; // // for(unsigned int i = 0; i < answersIP.size(); i++) // { // answersIP[i] = answersIP[i] & 0xFFFF0000; // } // for(unsigned int i=0; i<answersIP.size(); i++) // { // buff_det.Reset(); // buff_det << domain << answersIP[i]; // if(!bloom->check( (unsigned char*) buff_det.GetRawData(), buff_det.GetLength())) // { // bloom->add((unsigned char*)buff_det.GetRawData(), buff_det.GetLength()); // counter->add(buff_mon, 1, time_packet); // } // } // pktp->setMetrics(metric_id, counter->get(buff_mon, time_packet)); send_out_through(std::move(m), id_outgate); }
net::Socket source() const noexcept { return {ip_src(), src_port()}; }
Socket source() const { return Socket{ip_src(), src_port()}; }