@@ -888,99 +888,15 @@ namespace OpenWifi::Utils {
888888 return password;
889889 }
890890
891- # if 0
892- /*
893- Note that this function isn't used. It has been removed due to this deprecation warning:
894- #47 3.825 /owgw/src/framework/utils.cpp: In function 'std::vector<OpenWifi::Utils::NAPTRRecord> OpenWifi::Utils::getNAPTRRecords(const std::string&)':
891+ /*
892+ Note that these 2 functions aren't used. They have been removed due to this deprecation warning:
893+ // Function to query NAPTR records for a domain and return them in a vector
894+ #47 3.825 /owgw/src/framework/utils.cpp: In function 'std::vector<OpenWifi::Utils::NAPTRRecord> OpenWifi::Utils::getNAPTRRecords(const std::string&)':
895895#47 3.825 /owgw/src/framework/utils.cpp:915:28: warning: 'int ns_sprintrr(const ns_msg*, const ns_rr*, const char*, const char*, char*, size_t)' is deprecated [-Wdeprecated-declarations]
896- #47 3.825 915 | ns_sprintrr(&handle, &rr, nullptr, nullptr, rdata, sizeof(rdata));
897- #47 3.825 | ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
898- #47 3.825 In file included from /usr/include/resolv.h:60,
899- #47 3.825 from /owgw/src/framework/utils.cpp:17:
900- #47 3.825 /usr/include/arpa/nameser.h:408:17: note: declared here
901- #47 3.825 408 | int ns_sprintrr (const ns_msg *, const ns_rr *,
902- #47 3.825 | ^~~~~~~~~~~
903- #47 3.833 /owgw/src/framework/utils.cpp: In function 'std::vector<OpenWifi::Utils::SrvRecord> OpenWifi::Utils::getSRVRecords(const std::string&)':
904- #47 3.833 /owgw/src/framework/utils.cpp:952:28: warning: 'int ns_sprintrr(const ns_msg*, const ns_rr*, const char*, const char*, char*, size_t)' is deprecated [-Wdeprecated-declarations]
905- #47 3.833 952 | ns_sprintrr(&handle, &rr, nullptr, nullptr, rdata, sizeof(rdata));
906- #47 3.833 | ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
907- #47 3.833 /usr/include/arpa/nameser.h:408:17: note: declared here
908- #47 3.833 408 | int ns_sprintrr (const ns_msg *, const ns_rr *,
909- #47 3.833 | ^~~~~~~~~~~
910- */
911- // Function to query NAPTR records for a domain and return them in a vector
912- std::vector<NAPTRRecord> getNAPTRRecords(const std::string& domain) {
913- std::vector<NAPTRRecord> naptrRecords;
914-
915- unsigned char buf[4096];
916- ns_msg handle;
917- ns_initparse(buf, NS_PACKETSZ, &handle);
918-
919- // Query NAPTR records for the given domain
920- int response = res_query(domain.c_str(), ns_c_in, ns_t_naptr, buf, sizeof(buf));
921- if (response < 0) {
922- return naptrRecords;
923- }
924-
925- if(ns_initparse(buf, response, &handle) < 0) {
926- return naptrRecords;
927- }
928-
929- // Iterate through the DNS response and extract NAPTR records
930- int count = ns_msg_count(handle, ns_s_an);
931- for (int i = 0; i < count; ++i) {
932- ns_rr rr;
933- if (ns_parserr(&handle, ns_s_an, i, &rr) == 0) {
934- char rdata[256];
935- ns_sprintrr(&handle, &rr, nullptr, nullptr, rdata, sizeof(rdata));
936- NAPTRRecord record;
937- std::istringstream os(rdata);
938- os >> record.name >> record.ttl >> record.rclass >> record.rtype >> record.order >> record.preference >> record.flags
939- >> record.service >> record.regexp >> record.replacement;
940- naptrRecords.push_back(record);
941- }
942- }
943-
944- return naptrRecords;
945- }
946896
947897 std::vector<SrvRecord> getSRVRecords(const std::string& domain) {
948- std::vector<SrvRecord> srvRecords;
949-
950- // Buffer to hold the DNS response
951- unsigned char buf[4096];
952- ns_msg handle;
953- ns_initparse(buf, NS_PACKETSZ, &handle);
954-
955- // Query NAPTR records for the given domain
956- int response = res_query(domain.c_str(), ns_c_in, ns_t_srv, buf, sizeof(buf));
957- if (response < 0) {
958- std::cerr << "DNS query failed for " << domain << ": " << hstrerror(h_errno) << std::endl;
959- return srvRecords;
960- }
961-
962- if(ns_initparse(buf, response, &handle) < 0) {
963- return srvRecords;
964- }
965-
966- // Iterate through the DNS response and extract NAPTR records
967- int count = ns_msg_count(handle, ns_s_an);
968- for (int i = 0; i < count; ++i) {
969- ns_rr rr;
970- if (ns_parserr(&handle, ns_s_an, i, &rr) == 0) {
971- char rdata[256];
972- ns_sprintrr(&handle, &rr, nullptr, nullptr, rdata, sizeof(rdata));
973- SrvRecord record;
974- std::istringstream os(rdata);
975- os >> record.name >> record.ttl >> record.rclass >> record.rtype >> record.pref >> record.weight >>
976- record.port >> record.srvname ;
977- srvRecords.push_back(record);
978- }
979- }
980-
981- return srvRecords;
982- }
983- #endif
984-
898+ #47 3.833 /owgw/src/framework/utils.cpp: In function 'std::vector<OpenWifi::Utils::SrvRecord> OpenWifi::Utils::getSRVRecords(const std::string&)':
899+ #47 3.833 /owgw/src/framework/utils.cpp:952:28: warning: 'int ns_sprintrr(const ns_msg*, const ns_rr*, const char*, const char*, char*, size_t)' is deprecated [-Wdeprecated-declarations]
900+ */
985901
986902} // namespace OpenWifi::Utils
0 commit comments