aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/gnunet/gns/Gns.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/gnunet/gns/Gns.java')
-rw-r--r--src/main/java/org/gnunet/gns/Gns.java24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/main/java/org/gnunet/gns/Gns.java b/src/main/java/org/gnunet/gns/Gns.java
index 0e64ae0..cd9d02b 100644
--- a/src/main/java/org/gnunet/gns/Gns.java
+++ b/src/main/java/org/gnunet/gns/Gns.java
@@ -37,6 +37,23 @@ import org.slf4j.LoggerFactory;
37public class Gns { 37public class Gns {
38 private static final Logger logger = LoggerFactory 38 private static final Logger logger = LoggerFactory
39 .getLogger(Gns.class); 39 .getLogger(Gns.class);
40
41 /**
42 * Defaults, look in cache, then in DHT.
43 */
44 public static final int LOOKUP_OPTION_DEFAULT = 0;
45
46 /**
47 * Never look in the DHT, keep request to local cache.
48 */
49 public static final int LOOKUP_OPTION_NO_DHT = 1;
50
51 /**
52 * For the rightmost label, only look in the cache (it
53 * is our master zone), for the others, the DHT is OK.
54 */
55 public static final int LOOKUP_OPTION_LOCAL_MASTER = 2;
56
40 /** 57 /**
41 * All pending and active lookup requests. 58 * All pending and active lookup requests.
42 */ 59 */
@@ -97,7 +114,7 @@ public class Gns {
97 * @param name the name to look up 114 * @param name the name to look up
98 * @param zone zone to look in 115 * @param zone zone to look in
99 * @param type the GNS record type to look for 116 * @param type the GNS record type to look for
100 * @param onlyCached true to only check locally (not in the DHT) 117 * @param lookupOption a Gns.LOOKUP_OPTION_* value
101 * @param shortenZoneKey the private key of the shorten zone (can be NULL); 118 * @param shortenZoneKey the private key of the shorten zone (can be NULL);
102 * specify to enable automatic shortening (given a PSEU 119 * specify to enable automatic shortening (given a PSEU
103 * record, if a given pseudonym is not yet used in the 120 * record, if a given pseudonym is not yet used in the
@@ -108,7 +125,7 @@ public class Gns {
108 */ 125 */
109 public Cancelable lookup(String name, 126 public Cancelable lookup(String name,
110 EcdsaPublicKey zone, 127 EcdsaPublicKey zone,
111 long type, boolean onlyCached, 128 long type, int lookupOption,
112 EcdsaPrivateKey shortenZoneKey, 129 EcdsaPrivateKey shortenZoneKey,
113 LookupResultProcessor proc) { 130 LookupResultProcessor proc) {
114 ClientLookupMessage m = new ClientLookupMessage(); 131 ClientLookupMessage m = new ClientLookupMessage();
@@ -122,10 +139,11 @@ public class Gns {
122 } 139 }
123 m.id = nextUID++; 140 m.id = nextUID++;
124 m.name = name; 141 m.name = name;
125 m.onlyCached = onlyCached ? 1 : 0; 142 m.onlyCached = lookupOption;
126 m.type = type; 143 m.type = type;
127 m.zone = zone; 144 m.zone = zone;
128 145
146
129 return lookupRequests.addRequest(m.id, new FixedMessageRequest<LookupResultProcessor>(m, proc)); 147 return lookupRequests.addRequest(m.id, new FixedMessageRequest<LookupResultProcessor>(m, proc));
130 } 148 }
131 149