|
Jitsi: the OpenSource Java VoIP and Instant Messaging client. | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.java.sip.communicator.util.dns.UnboundApi
public class UnboundApi
Wrapper for the JUnbound JNI wrapper.
The JavaDoc of these methods is directly copied from libunbound, licensed as follows:
Copyright (c) 2007, NLnet Labs. All rights reserved. This software is open source. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of the NLNET LABS nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
| Nested Class Summary | |
|---|---|
static interface |
UnboundApi.UnboundCallback
Interface for the async resolve callback. |
| Constructor Summary | |
|---|---|
UnboundApi()
|
|
| Method Summary | |
|---|---|
static void |
addTrustAnchor(long context,
String anchor)
Add a trust anchor to the given context. |
static void |
cancelAsync(long context,
int asyncId)
Cancel an async query in progress. |
static long |
createContext()
Create a resolving and validation context. |
static void |
deleteContext(long context)
Destroy a validation context and free all its resources. |
static String |
errorCodeToString(int code)
Convert error value to a human readable string. |
static boolean |
isAvailable()
Indicates whether the Unbound library is loaded. |
static void |
processAsync(long context)
Wait for a context to finish with results. |
static UnboundResult |
resolve(long context,
String name,
int rrtype,
int rrclass)
Perform resolution and validation of the target name. |
static int |
resolveAsync(long context,
String name,
int rrtype,
int rrclass,
Object data,
UnboundApi.UnboundCallback cb)
Perform resolution and validation of the target name. |
static void |
setDebugLevel(long context,
int level)
Set debug verbosity for the context. |
static void |
setForwarder(long context,
String server)
Set machine to forward DNS queries to, the caching resolver to use. |
static void |
tryLoadUnbound()
Attempts to load the Unbound native library. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public UnboundApi()
| Method Detail |
|---|
public static void tryLoadUnbound()
isAvailable() returns true.
public static boolean isAvailable()
public static void setDebugLevel(long context,
int level)
context - context.level - The debug level.public static long createContext()
public static void deleteContext(long context)
context - context to delete
public static void setForwarder(long context,
String server)
IP4 or IP6 address. Forwards all DNS requests to that machine, which is expected to run a recursive resolver. If the proxy is not DNSSEC-capable, validation may fail. Can be called several times, in that case the addresses are used as backup servers.
context - context. At this time it is only possible to set
configuration before the first resolve is done.server - address, IP4 or IP6 in string format. If the server is
NULL, forwarding is disabled.
public static void addTrustAnchor(long context,
String anchor)
The trust anchor is a string, on one line, that holds a valid DNSKEY or DS RR.
context - context. At this time it is only possible to add trusted
keys before the first resolve is done.anchor - string, with zone-format RR on one line. [domainname] [TTL
optional] [type] [class optional] [rdata contents]
public static UnboundResult resolve(long context,
String name,
int rrtype,
int rrclass)
throws UnboundException
context - context. The context is finalized, and can no longer
accept config changes.name - domain name in text format (a zero terminated text string).rrtype - type of RR in host order, 1 is A (address).rrclass - class of RR in host order, 1 is IN (for internet).
UnboundException - when an error occurred.
public static int resolveAsync(long context,
String name,
int rrtype,
int rrclass,
Object data,
UnboundApi.UnboundCallback cb)
throws UnboundException
Asynchronous, after a while, the callback will be called with your data and the result.
context - context. If no thread or process has been created yet to
perform the work in the background, it is created now. The
context is finalized, and can no longer accept config changes.name - domain name in text format (a string).rrtype - type of RR in host order, 1 is A.rrclass - class of RR in host order, 1 is IN (for internet).data - this data is your own data (you can pass null), and is passed
on to the callback function.cb - this is called on completion of the resolution.
UnboundException - when an error occurred.
public static void cancelAsync(long context,
int asyncId)
throws UnboundException
context - context.asyncId - which query to cancel.
UnboundException - This routine can error if the async_id passed
does not exist or has already been delivered. If another
thread is processing results at the same time, the result may
be delivered at the same time and the cancel fails with an
error. Also the cancel can fail due to a system error, no
memory or socket failures.public static String errorCodeToString(int code)
code - error code from one of the Unbound functions.
public static void processAsync(long context)
throws UnboundException
context - context.
UnboundException - when an error occurred.
|
Jitsi: the OpenSource Java VoIP and Instant Messaging client. | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||