home *** CD-ROM | disk | FTP | other *** search
- package org.xbill.DNS;
-
- import java.io.IOException;
- import java.net.Socket;
-
- class SimpleResolver$Stream {
- SimpleResolver res;
- Socket sock;
- TSIG tsig;
- TSIG.StreamVerifier verifier;
-
- SimpleResolver$Stream(SimpleResolver res) throws IOException {
- this.res = res;
- this.sock = new Socket(SimpleResolver.access$0(res), SimpleResolver.access$1(res));
- this.sock.setSoTimeout(SimpleResolver.access$2(res));
- this.tsig = SimpleResolver.access$3(res);
- }
-
- void send(Message query) throws IOException {
- if (this.tsig != null) {
- this.tsig.apply(query, (TSIGRecord)null);
- this.verifier = new TSIG.StreamVerifier(this.tsig, query.getTSIG());
- }
-
- byte[] out = query.toWire(65535);
- SimpleResolver.access$4(this.res, this.sock, out);
- }
-
- Message next() throws IOException {
- byte[] in = SimpleResolver.access$5(this.res, this.sock);
- Message response = SimpleResolver.access$6(this.res, in);
- if (response.getHeader().getRcode() != 0) {
- return response;
- } else {
- if (this.verifier != null) {
- TSIGRecord tsigrec = response.getTSIG();
- int error = this.verifier.verify(response, in);
- if (error == 0 && tsigrec != null) {
- response.tsigState = 1;
- } else if (error == 0) {
- response.tsigState = 2;
- } else {
- response.tsigState = 4;
- }
- }
-
- return response;
- }
- }
-
- void close() {
- try {
- this.sock.close();
- } catch (IOException var2) {
- }
-
- }
- }
-