Produced by Araxis Merge on 5/25/2018 9:21:42 AM Central Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | C:\AraxisMergeCompare\Pri_un\ZIP\DSM-cif\Direct Implementation\java\dns\src\main\java\org\nhindirect\dns | ProxyDNSStore.java | Tue May 22 13:36:04 2018 UTC |
| 2 | C:\AraxisMergeCompare\Pri_re\ZIP\DSM-cif\Direct Implementation\java\dns\src\main\java\org\nhindirect\dns | ProxyDNSStore.java | Wed May 23 18:53:01 2018 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 306 |
| Changed | 1 | 2 |
| Inserted | 0 | 0 |
| Removed | 0 | 0 |
| Whitespace | |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
| 1 | /* | |
| 2 | Copyright (c) 2010, Direct Pr oject | |
| 3 | All right s reserved . | |
| 4 | ||
| 5 | Authors: | |
| 6 | Umesh Madan umeshma@mi crosoft.co m | |
| 7 | Chris Lomonico chris.lomo nico@sures cripts.com | |
| 8 | Greg M eyer gm2552@cer ner.com | |
| 9 | ||
| 10 | Redistribu tion and u se in sour ce and bin ary forms, with or w ithout mod ification, are permi tted provi ded that t he followi ng conditi ons are me t: | |
| 11 | ||
| 12 | Redistribu tions of s ource code must reta in the abo ve copyrig ht notice, this list of condit ions and t he followi ng disclai mer. | |
| 13 | Redistribu tions in b inary form must repr oduce the above copy right noti ce, this l ist of con ditions an d the foll owing disc laimer in the docume ntation an d/or other materials provided with the d istributio n. | |
| 14 | Neither th e name of The Direct Project ( directproj ect.org) n or the nam es of its contributo rs may be used to en dorse or p romote pro ducts deri ved from t his softwa re without specific prior writ ten permis sion. | |
| 15 | THIS SOFTW ARE IS PRO VIDED BY T HE COPYRIG HT HOLDERS AND CONTR IBUTORS "A S IS" AND ANY EXPRES S OR IMPLI ED WARRANT IES, INCLU DING, BUT NOT LIMITE D TO, THE IMPLIED WA RRANTIES O F MERCHANT ABILITY AN D FITNESS FOR A PART ICULAR PUR POSE ARE D ISCLAIMED. IN NO EVE NT SHALL T HE COPYRIG HT HOLDER OR CONTRIB UTORS BE L IABLE FOR ANY DIRECT , INDIRECT , INCIDENT AL, SPECIA L, EXEMPLA RY, OR CON SEQUENTIAL DAMAGES ( INCLUDING, BUT NOT L IMITED TO, PROCUREME NT OF SUBS TITUTE GOO DS OR SERV ICES; LOSS OF USE, D ATA, OR PR OFITS; OR BUSINESS I NTERRUPTIO N) HOWEVER CAUSED AN D ON ANY T HEORY OF L IABILITY, WHETHER IN CONTRACT, STRICT LI ABILITY, O R TORT (IN CLUDING NE GLIGENCE O R OTHERWIS E) ARISING IN ANY WA Y OUT OF T HE USE OF THIS SOFTW ARE, EVEN IF ADVISED OF THE PO SSIBILITY OF SUCH DA MAGE. | |
| 16 | */ | |
| 17 | ||
| 18 | package or g.nhindire ct.dns; | |
| 19 | ||
| 20 | import jav a.io.IOExc eption; | |
| 21 | import jav a.net.Unkn ownHostExc eption; | |
| 22 | import jav a.util.Col lection; | |
| 23 | ||
| 24 | import org .apache.co mmons.logg ing.Log; | |
| 25 | import org .apache.co mmons.logg ing.LogFac tory; | |
| 26 | import org .xbill.DNS .ExtendedR esolver; | |
| 27 | import org .xbill.DNS .Message; | |
| 28 | import org .xbill.DNS .ResolverC onfig; | |
| 29 | ||
| 30 | /** | |
| 31 | * Proxy D NS store t hat delega tes all re quests to another se t of DNS s ervers. | |
| 32 | * The sto re default s to using port 53 a nd the mac hine's con figured DN S servers. | |
| 33 | * @author Greg Meye r | |
| 34 | * | |
| 35 | * @since 1.0 | |
| 36 | */ | |
| 37 | public cla ss ProxyDN SStore imp lements DN SStore | |
| 38 | { | |
| 39 | pr ivate stat ic final i nt DEFAULT _RESOLVER_ PORT = PORT ; | |
| 40 | ||
| 41 | pr ivate fina l String[] servers; | |
| 42 | pr ivate fina l int port ; | |
| 43 | ||
| 44 | pr otected st atic final Log LOGGE R = LogFac tory.getFa ctory().ge tInstance( ProxyDNSSt ore.class) ; | |
| 45 | ||
| 46 | /* * | |
| 47 | * Creates a default p roxy store . | |
| 48 | * / | |
| 49 | pu blic Proxy DNSStore() | |
| 50 | { | |
| 51 | this (DEFAULT_R ESOLVER_PO RT); | |
| 52 | } | |
| 53 | ||
| 54 | /* * | |
| 55 | * Creates a proxy sto re delegat ing reques ts to the provided p ort. | |
| 56 | * @param po rt The IP port to us e when cal ling the p roxy DNS s erver. | |
| 57 | * / | |
| 58 | pu blic Proxy DNSStore(i nt port) | |
| 59 | { | |
| 60 | this (null, DEF AULT_RESOL VER_PORT); | |
| 61 | } | |
| 62 | ||
| 63 | /* * | |
| 64 | * Creates a proxy usi ng the the provided servers fo r delegati ng request s. | |
| 65 | * @param se rvers A co llections of IP4 add resses (as strings) that the p roxy will delegate r equest to. | |
| 66 | * / | |
| 67 | pu blic Proxy DNSStore(C ollection< String> se rvers) | |
| 68 | { | |
| 69 | this (servers, DEFAULT_RE SOLVER_POR T); | |
| 70 | } | |
| 71 | ||
| 72 | /* * | |
| 73 | * Creates a proxy usi ng the pro vided serv ers and po rt for del egating re quests. | |
| 74 | * @param se rvers A co llections of IP4 add resses (as strings) that the p roxy will delegate r equest to. | |
| 75 | * @param po rt The IP port to us e when cal ling the p roxy DNS s erver. | |
| 76 | * / | |
| 77 | pu blic Proxy DNSStore(C ollection< String> se rvers, int port) | |
| 78 | { | |
| 79 | if ( servers == null || s ervers.siz e() == 0) | |
| 80 | { | |
| 81 | ||
| 82 | String [] confige dServers = ResolverC onfig.getC urrentConf ig().serve rs(); | |
| 83 | ||
| 84 | if (co nfigedServ ers != nul l) | |
| 85 | { | |
| 86 | this.ser vers = con figedServe rs; | |
| 87 | } | |
| 88 | else | |
| 89 | this.ser vers = nul l; | |
| 90 | } | |
| 91 | else | |
| 92 | { | |
| 93 | this.s ervers = n ew String[ servers.si ze()]; | |
| 94 | server s.toArray( this.serve rs); | |
| 95 | } | |
| 96 | ||
| 97 | this .port = po rt; | |
| 98 | } | |
| 99 | ||
| 100 | /* * | |
| 101 | * {@inherit Doc} | |
| 102 | * / | |
| 103 | @O verride | |
| 104 | pu blic Messa ge get(Mes sage dnsMs g) throws DNSExcepti on | |
| 105 | { | |
| 106 | Exte ndedResolv er resolve r = create ExResolver (servers, port, 2, 2 000); | |
| 107 | // t ry UPD fir st | |
| 108 | ||
| 109 | Mess age respon se = null; | |
| 110 | try | |
| 111 | { | |
| 112 | respon se = resol ver.send(d nsMsg); | |
| 113 | } | |
| 114 | catc h (IOExcep tion e) | |
| 115 | { | |
| 116 | /* no- op */ | |
| 117 | } | |
| 118 | ||
| 119 | if ( response = = null) | |
| 120 | { | |
| 121 | // try TCP | |
| 122 | resolv er.setTCP( true); | |
| 123 | try | |
| 124 | { | |
| 125 | response = resolve r.send(dns Msg); | |
| 126 | } | |
| 127 | catch (IOExcepti on e) | |
| 128 | { | |
| 129 | /* no-op */ | |
| 130 | } | |
| 131 | } | |
| 132 | ||
| 133 | retu rn respons e; | |
| 134 | } | |
| 135 | ||
| 136 | /* | |
| 137 | * Create th e resolver that will do the DN S requests . | |
| 138 | * / | |
| 139 | pr ivate Exte ndedResolv er createE xResolver( String[] s ervers, in t port, in t retries, int timeo ut) | |
| 140 | { | |
| 141 | Exte ndedResolv er retVal = null; | |
| 142 | try | |
| 143 | { | |
| 144 | retVal = new Ext endedResol ver(server s); | |
| 145 | retVal .setRetrie s(retries) ; | |
| 146 | retVal .setTimeou t(timeout) ; | |
| 147 | } | |
| 148 | catc h (Unknown HostExcept ion e) | |
| 149 | { | |
| 150 | LOGGER .warn("Pro xy store r esolver co uld not be created: " + e.getM essage(), e); | |
| 151 | } | |
| 152 | retu rn retVal; | |
| 153 | } | |
| 154 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.