c_haship_addr::c_haship_addr(tag_constr_by_addr_bin, const t_ipv6bin & data ) { if (! ( this->size() == data.size() ) ) { ostringstream oss; oss << "Trying to set hip address from binary data " << to_debug_b(data); _throw_error( std::runtime_error(oss.str()) ); } for (size_t i=0; i<this->size(); ++i) this->at(i) = data.at(i); }
void c_peering_udp::send_data_RAW_udp(const char * data, size_t data_size, int udp_socket) { _UNUSED(udp_socket); _info("UDP send to peer RAW. To IP: " << m_peering_addr << ", RAW-DATA: " << to_debug_b(std::string(data,data_size)) ); //#ifdef __linux__ switch (m_peering_addr.get_ip_type()) { case c_ip46_addr::t_tag::tag_ipv4 : { m_udp_wrapper.get().send_data(m_peering_addr, data, data_size); } break; case c_ip46_addr::t_tag::tag_ipv6 : { m_udp_wrapper.get().send_data(m_peering_addr, data, data_size); } break; default: { std::ostringstream oss; oss << m_peering_addr; // TODO _throw_error( std::runtime_error(string("Invalid IP type (when trying to send RAW udp): ") + oss.str()) ); } } //#endif }