From: Pieter Lexis Date: Wed, 10 Jan 2018 10:33:09 +0000 (+0100) Subject: ixplore: fix all indenting, no functional changes X-Git-Tag: dnsdist-1.3.0~111^2~32 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ae7af19fe773b8074c2d1b894a6c810b383e5802;p=thirdparty%2Fpdns.git ixplore: fix all indenting, no functional changes --- diff --git a/pdns/ixplore.cc b/pdns/ixplore.cc index 41001dfcb0..43f8cddcc3 100644 --- a/pdns/ixplore.cc +++ b/pdns/ixplore.cc @@ -26,7 +26,7 @@ #include "base64.hh" #include #include - + #include "dnsparser.hh" #include "sstuff.hh" #include "misc.hh" @@ -62,20 +62,19 @@ struct CIContentCompareStruct }; -typedef multi_index_container< +typedef multi_index_container < DNSRecord, indexed_by< ordered_non_unique< composite_key, - member, - member, - member, &DNSRecord::d_content> >, - composite_key_compare, std::less, CIContentCompareStruct > - - > - > - >records_t; + member, + member, + member, + member, &DNSRecord::d_content> >, + composite_key_compare, std::less, CIContentCompareStruct > + > /* ordered_non_uniquw */ + > /* indexed_by */ +> /* multi_index_container */ records_t; uint32_t getSerialFromMaster(const ComboAddress& master, const DNSName& zone, shared_ptr& sr, const TSIGTriplet& tt = TSIGTriplet()) { @@ -90,7 +89,7 @@ uint32_t getSerialFromMaster(const ComboAddress& master, const DNSName& zone, sh trc.d_eRcode=0; addTSIG(pw, trc, tt.name, tt.secret, "", false); } - + Socket s(master.sin4.sin_family, SOCK_DGRAM); s.connect(master); string msg((const char*)&packet[0], packet.size()); @@ -116,10 +115,10 @@ uint32_t getSerialsFromDir(const std::string& dir) { uint32_t ret=0; DIR* dirhdl=opendir(dir.c_str()); - if(!dirhdl) + if(!dirhdl) throw runtime_error("Could not open IXFR directory"); struct dirent *entry; - + while((entry = readdir(dirhdl))) { uint32_t num = atoi(entry->d_name); if(std::to_string(num) == entry->d_name) @@ -130,7 +129,7 @@ uint32_t getSerialsFromDir(const std::string& dir) } uint32_t getSerialFromRecords(const records_t& records, DNSRecord& soaret) -{ +{ DNSName root("."); uint16_t t=QType::SOA; @@ -158,10 +157,10 @@ void writeZoneToDisk(const records_t& records, const DNSName& zone, const std::s fprintf(fp, "$ORIGIN %s\n", zone.toString().c_str()); for(const auto& outer : {soarecord, records, soarecord} ) { for(const auto& r: outer) { - fprintf(fp, "%s\tIN\t%s\t%s\n", - r.d_name.isRoot() ? "@" : r.d_name.toStringNoDot().c_str(), - DNSRecordContent::NumberToType(r.d_type).c_str(), - r.d_content->getZoneRepresentation().c_str()); + fprintf(fp, "%s\tIN\t%s\t%s\n", + r.d_name.isRoot() ? "@" : r.d_name.toStringNoDot().c_str(), + DNSRecordContent::NumberToType(r.d_type).c_str(), + r.d_content->getZoneRepresentation().c_str()); } } fclose(fp); @@ -180,7 +179,7 @@ void loadZoneFromDisk(records_t& records, const string& fname, const DNSName& zo if(rr.qtype.getCode() == QType::CNAME && rr.content.empty()) rr.content="."; rr.qname = rr.qname.makeRelative(zone); - + if(rr.qtype.getCode() != QType::SOA || seenSOA==false) records.insert(DNSRecord(rr)); if(rr.qtype.getCode() == QType::SOA) { @@ -202,197 +201,197 @@ void usage() { cerr<<"Syntax: ixplore track IP-ADDRESS PORT ZONE DIRECTORY [TSIGKEY TSIGALGO TSIGSECRET]"< diff; - - set_difference(before.cbegin(), before.cend(), after.cbegin(), after.cend(), back_inserter(diff), before.value_comp()); - for(const auto& d : diff) { - cout<<'-'<< (d.d_name+zone) <<" IN "<getZoneRepresentation()<getZoneRepresentation()< diff; + + set_difference(before.cbegin(), before.cend(), after.cbegin(), after.cend(), back_inserter(diff), before.value_comp()); + for(const auto& d : diff) { + cout<<'-'<< (d.d_name+zone) <<" IN "<getZoneRepresentation()<getZoneRepresentation()< 6) - tt.name=DNSName(toLower(argv[6])); - if(argc > 7) - tt.algo=DNSName(toLower(argv[7])); + cout<<"Loading zone, our highest available serial is "<< ourSerial< 8) { - if(B64Decode(argv[8], tt.secret) < 0) { - cerr<<"Could not decode tsig secret!"< 6) + tt.name=DNSName(toLower(argv[6])); + if(argc > 7) + tt.algo=DNSName(toLower(argv[7])); - try { - if(!ourSerial) - throw std::runtime_error("There is no local zone available"); - string fname=directory+"/"+std::to_string(ourSerial); - cout<<"Loading serial number "< chunk; - char wheel[]="|/-\\"; - int count=0; - time_t last=0; - while(axfr.getChunk(nop, &chunk)) { - for(auto& dr : chunk) { - if(dr.d_type == QType::TSIG) - continue; - dr.d_name.makeUsRelative(zone); - records.insert(dr); - nrecords++; - } - - if(last != time(0)) { - cout << '\r' << wheel[count % (sizeof(wheel)-1)] << ' ' < 8) { + if(B64Decode(argv[8], tt.secret) < 0) { + cerr<<"Could not decode tsig secret!"< sr; - uint32_t serial = getSerialFromMaster(master, zone, sr, tt); - if(ourSerial == serial) { - cout<<"still up to date, their serial is "<d_st.refresh<<" seconds"<d_st.refresh); - continue; + try { + if(!ourSerial) + throw std::runtime_error("There is no local zone available"); + string fname=directory+"/"+std::to_string(ourSerial); + cout<<"Loading serial number "<(rr.d_content)->d_st.serial; - } - } - - cout<<"This delta ("< chunk; + char wheel[]="|/-\\"; + int count=0; + time_t last=0; + while(axfr.getChunk(nop, &chunk)) { + for(auto& dr : chunk) { + if(dr.d_type == QType::TSIG) + continue; + dr.d_name.makeUsRelative(zone); + records.insert(dr); + nrecords++; + } + + if(last != time(0)) { + cout << '\r' << wheel[count % (sizeof(wheel)-1)] << ' ' <getZoneRepresentation()< sr; + uint32_t serial = getSerialFromMaster(master, zone, sr, tt); + if(ourSerial == serial) { + cout<<"still up to date, their serial is "<d_st.refresh<<" seconds"<d_st.refresh); + continue; } - for(const auto& rr : add) { - report<<'+'<< (rr.d_name+zone) <<" IN "<getZoneRepresentation()<(rr.d_content)->d_st.serial; + } + } + + cout<<"This delta ("<getZoneRepresentation()<getZoneRepresentation()<