summaryrefslogtreecommitdiffstats
blob: 05e4d322b9803dfa310d110fbcb2f227eda81371 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
 * Copyright (c) 2010, Isode Limited, London, England.
 * All rights reserved.
 */
/*
 * Copyright (c) 2010, Remko Tronçon.
 * All rights reserved.
 */
package com.isode.stroke.network;

import com.isode.stroke.signals.Signal1;
import java.util.Collection;

public abstract class DomainNameServiceQuery {

    public static class Result {

        public Result() {
            hostname = "";
            port = -1;
            priority = -1;
            weight = -1;
        }

        public Result(String hostname, int port, int priority, int weight) {
            this.hostname = hostname;
            this.port = port;
            this.priority = priority;
            this.weight = weight;
        }
        public final String hostname;
        public final int port;
        public final int priority;
        public final int weight;
    };

    public class ResultPriorityComparator {

        public boolean compare(DomainNameServiceQuery.Result a, DomainNameServiceQuery.Result b) {
            return a.priority < b.priority;
        }
    };

    public abstract void run();
    public final Signal1<Collection<Result>> onResult = new Signal1<Collection<Result>>();
}