Package ch.bailu.gtk.gio
Class Resolver
java.lang.Object
ch.bailu.gtk.type.Type
ch.bailu.gtk.type.Pointer
ch.bailu.gtk.gobject.Object
ch.bailu.gtk.gio.Resolver
- All Implemented Interfaces:
PointerInterface
#GResolver provides cancellable synchronous and asynchronous DNS
resolution, for hostnames (g_resolver_lookup_by_address(),
g_resolver_lookup_by_name() and their async variants) and SRV
(service) records (g_resolver_lookup_service()).
#GNetworkAddress and #GNetworkService provide wrappers around
#GResolver functionality that also implement #GSocketConnectable,
making it easy to connect to a remote host/service.
resolution, for hostnames (g_resolver_lookup_by_address(),
g_resolver_lookup_by_name() and their async variants) and SRV
(service) records (g_resolver_lookup_service()).
#GNetworkAddress and #GNetworkService provide wrappers around
#GResolver functionality that also implement #GSocketConnectable,
making it easy to connect to a remote host/service.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
static interface
Nested classes/interfaces inherited from class ch.bailu.gtk.gobject.Object
Object.OnBindingTransformFunc, Object.OnDestroyNotify, Object.OnDuplicateFunc, Object.OnNotify, Object.OnToggleNotify, Object.OnWeakNotify
-
Field Summary
Fields inherited from class ch.bailu.gtk.gobject.Object
SIGNAL_ON_NOTIFY
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
freeAddresses
(List addresses) Frees @addresses (which should be the return value from
g_resolver_lookup_by_name() or g_resolver_lookup_by_name_finish()).static void
freeTargets
(List targets) Frees @targets (which should be the return value from
g_resolver_lookup_service() or g_resolver_lookup_service_finish()).static ClassHandler
static Resolver
Gets the default #GResolver.static int
static long
static TypeSystem.TypeSize
static long
static TypeSystem.TypeSize
lookupByAddress
(InetAddress address, Cancellable cancellable) Synchronously reverse-resolves @address to determine its
associated hostname.void
lookupByAddressAsync
(InetAddress address, Cancellable cancellable, Resolver.OnAsyncReadyCallback callback, Pointer user_data) Begins asynchronously reverse-resolving @address to determine its
associated hostname, and eventually calls @callback, which must
call g_resolver_lookup_by_address_finish() to get the final result.lookupByAddressFinish
(AsyncResult result) Retrieves the result of a previous call to
g_resolver_lookup_by_address_async().lookupByName
(Str hostname, Cancellable cancellable) Synchronously resolves @hostname to determine its associated IP
address(es).lookupByName
(String hostname, Cancellable cancellable) Synchronously resolves @hostname to determine its associated IP
address(es).void
lookupByNameAsync
(Str hostname, Cancellable cancellable, Resolver.OnAsyncReadyCallback callback, Pointer user_data) Begins asynchronously resolving @hostname to determine its
associated IP address(es), and eventually calls @callback, which
must call g_resolver_lookup_by_name_finish() to get the result.void
lookupByNameAsync
(String hostname, Cancellable cancellable, Resolver.OnAsyncReadyCallback callback, Pointer user_data) Begins asynchronously resolving @hostname to determine its
associated IP address(es), and eventually calls @callback, which
must call g_resolver_lookup_by_name_finish() to get the result.lookupByNameFinish
(AsyncResult result) Retrieves the result of a call to
g_resolver_lookup_by_name_async().lookupByNameWithFlags
(Str hostname, int flags, Cancellable cancellable) This differs from g_resolver_lookup_by_name() in that you can modify
the lookup behavior with @flags.lookupByNameWithFlags
(String hostname, int flags, Cancellable cancellable) This differs from g_resolver_lookup_by_name() in that you can modify
the lookup behavior with @flags.void
lookupByNameWithFlagsAsync
(Str hostname, int flags, Cancellable cancellable, Resolver.OnAsyncReadyCallback callback, Pointer user_data) Begins asynchronously resolving @hostname to determine its
associated IP address(es), and eventually calls @callback, which
must call g_resolver_lookup_by_name_with_flags_finish() to get the result.void
lookupByNameWithFlagsAsync
(String hostname, int flags, Cancellable cancellable, Resolver.OnAsyncReadyCallback callback, Pointer user_data) Begins asynchronously resolving @hostname to determine its
associated IP address(es), and eventually calls @callback, which
must call g_resolver_lookup_by_name_with_flags_finish() to get the result.Retrieves the result of a call to
g_resolver_lookup_by_name_with_flags_async().lookupRecords
(Str rrname, int record_type, Cancellable cancellable) Synchronously performs a DNS record lookup for the given @rrname and returns
a list of records as #GVariant tuples.lookupRecords
(String rrname, int record_type, Cancellable cancellable) Synchronously performs a DNS record lookup for the given @rrname and returns
a list of records as #GVariant tuples.void
lookupRecordsAsync
(Str rrname, int record_type, Cancellable cancellable, Resolver.OnAsyncReadyCallback callback, Pointer user_data) Begins asynchronously performing a DNS lookup for the given
@rrname, and eventually calls @callback, which must call
g_resolver_lookup_records_finish() to get the final result.void
lookupRecordsAsync
(String rrname, int record_type, Cancellable cancellable, Resolver.OnAsyncReadyCallback callback, Pointer user_data) Begins asynchronously performing a DNS lookup for the given
@rrname, and eventually calls @callback, which must call
g_resolver_lookup_records_finish() to get the final result.lookupRecordsFinish
(AsyncResult result) Retrieves the result of a previous call to
g_resolver_lookup_records_async().lookupService
(Str service, Str protocol, Str domain, Cancellable cancellable) Synchronously performs a DNS SRV lookup for the given @service and
@protocol in the given @domain and returns an array of #GSrvTarget.lookupService
(String service, String protocol, String domain, Cancellable cancellable) Synchronously performs a DNS SRV lookup for the given @service and
@protocol in the given @domain and returns an array of #GSrvTarget.void
lookupServiceAsync
(Str service, Str protocol, Str domain, Cancellable cancellable, Resolver.OnAsyncReadyCallback callback, Pointer user_data) Begins asynchronously performing a DNS SRV lookup for the given
@service and @protocol in the given @domain, and eventually calls
@callback, which must call g_resolver_lookup_service_finish() to
get the final result.void
lookupServiceAsync
(String service, String protocol, String domain, Cancellable cancellable, Resolver.OnAsyncReadyCallback callback, Pointer user_data) Begins asynchronously performing a DNS SRV lookup for the given
@service and @protocol in the given @domain, and eventually calls
@callback, which must call g_resolver_lookup_service_finish() to
get the final result.lookupServiceFinish
(AsyncResult result) Retrieves the result of a previous call to
g_resolver_lookup_service_async().onReload
(Resolver.OnReload signal) Connect to signal "reload".void
Sets @resolver to be the application's default resolver (reffing
@resolver, and unreffing the previous default resolver, if any).Methods inherited from class ch.bailu.gtk.gobject.Object
addToggleRef, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, disconnect, disconnect, dupData, dupData, dupQdata, forceFloating, freezeNotify, get, get, getData, getData, getProperty, getProperty, getQdata, interfaceFindProperty, interfaceInstallProperty, isFloating, notify, notify, notifyByPspec, onNotify, ref, refSink, removeToggleRef, replaceData, replaceData, replaceQdata, runDispose, set, set, setData, setData, setDataFull, setDataFull, setProperty, setProperty, setQdata, setQdataFull, stealData, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref
Methods inherited from class ch.bailu.gtk.type.Pointer
asCPointer, cast, connectSignal, disconnectSignals, disconnectSignals, equals, hashCode, throwIfNull, throwNullPointerException, toString, unregisterCallbacks, unregisterCallbacks
Methods inherited from class ch.bailu.gtk.type.Type
asCPointer, asCPointer, asCPointerNotNull, asJnaPointer, asJnaPointer, asPointer, asPointer, cast, cast, throwIfNull
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface ch.bailu.gtk.type.PointerInterface
asCPointerNotNull, asJnaPointer, asPointer, isNotNull, isNull
-
Field Details
-
SIGNAL_ON_RELOAD
- See Also:
-
-
Constructor Details
-
Resolver
-
-
Method Details
-
getClassHandler
-
lookupByAddress
public Str lookupByAddress(@Nonnull InetAddress address, @Nullable Cancellable cancellable) throws AllocationError Synchronously reverse-resolves @address to determine its
associated hostname.
If the DNS resolution fails, @error (if non-%NULL) will be set to
a value from #GResolverError.
If @cancellable is non-%NULL, it can be used to cancel the
operation, in which case @error (if non-%NULL) will be set to
%G_IO_ERROR_CANCELLED.- Parameters:
address
- the address to reverse-resolvecancellable
- a #GCancellable, or %NULL- Returns:
- a hostname (either ASCII-only, or in ASCII-encoded form), or %NULL on error.
- Throws:
AllocationError
-
lookupByAddressAsync
public void lookupByAddressAsync(@Nonnull InetAddress address, @Nullable Cancellable cancellable, Resolver.OnAsyncReadyCallback callback, @Nullable Pointer user_data) Begins asynchronously reverse-resolving @address to determine its
associated hostname, and eventually calls @callback, which must
call g_resolver_lookup_by_address_finish() to get the final result.- Parameters:
address
- the address to reverse-resolvecancellable
- a #GCancellable, or %NULLcallback
- callback to call after resolution completesuser_data
- data for @callback
-
lookupByAddressFinish
Retrieves the result of a previous call to
g_resolver_lookup_by_address_async().
If the DNS resolution failed, @error (if non-%NULL) will be set to
a value from #GResolverError. If the operation was cancelled,
@error will be set to %G_IO_ERROR_CANCELLED.- Parameters:
result
- the result passed to your #GAsyncReadyCallback- Returns:
- a hostname (either ASCII-only, or in ASCII-encoded form), or %NULL on error.
- Throws:
AllocationError
-
lookupByName
public List lookupByName(@Nonnull Str hostname, @Nullable Cancellable cancellable) throws AllocationError Synchronously resolves @hostname to determine its associated IP
address(es). @hostname may be an ASCII-only or UTF-8 hostname, or
the textual form of an IP address (in which case this just becomes
a wrapper around g_inet_address_new_from_string()).
On success, g_resolver_lookup_by_name() will return a non-empty #GList of
#GInetAddress, sorted in order of preference and guaranteed to not
contain duplicates. That is, if using the result to connect to
@hostname, you should attempt to connect to the first address
first, then the second if the first fails, etc. If you are using
the result to listen on a socket, it is appropriate to add each
result using e.g. g_socket_listener_add_address().
If the DNS resolution fails, @error (if non-%NULL) will be set to a
value from #GResolverError and %NULL will be returned.
If @cancellable is non-%NULL, it can be used to cancel the
operation, in which case @error (if non-%NULL) will be set to
%G_IO_ERROR_CANCELLED.
If you are planning to connect to a socket on the resolved IP
address, it may be easier to create a #GNetworkAddress and use its
#GSocketConnectable interface.- Parameters:
hostname
- the hostname to look upcancellable
- a #GCancellable, or %NULL- Returns:
- a non-empty #GList of #GInetAddress, or %NULL on error. You must unref each of the addresses and free the list when you are done with it. (You can use g_resolver_free_addresses() to do this.)
- Throws:
AllocationError
-
lookupByName
Synchronously resolves @hostname to determine its associated IP
address(es). @hostname may be an ASCII-only or UTF-8 hostname, or
the textual form of an IP address (in which case this just becomes
a wrapper around g_inet_address_new_from_string()).
On success, g_resolver_lookup_by_name() will return a non-empty #GList of
#GInetAddress, sorted in order of preference and guaranteed to not
contain duplicates. That is, if using the result to connect to
@hostname, you should attempt to connect to the first address
first, then the second if the first fails, etc. If you are using
the result to listen on a socket, it is appropriate to add each
result using e.g. g_socket_listener_add_address().
If the DNS resolution fails, @error (if non-%NULL) will be set to a
value from #GResolverError and %NULL will be returned.
If @cancellable is non-%NULL, it can be used to cancel the
operation, in which case @error (if non-%NULL) will be set to
%G_IO_ERROR_CANCELLED.
If you are planning to connect to a socket on the resolved IP
address, it may be easier to create a #GNetworkAddress and use its
#GSocketConnectable interface.- Parameters:
hostname
- the hostname to look upcancellable
- a #GCancellable, or %NULL- Returns:
- a non-empty #GList of #GInetAddress, or %NULL on error. You must unref each of the addresses and free the list when you are done with it. (You can use g_resolver_free_addresses() to do this.)
- Throws:
AllocationError
-
lookupByNameAsync
public void lookupByNameAsync(@Nonnull Str hostname, @Nullable Cancellable cancellable, Resolver.OnAsyncReadyCallback callback, @Nullable Pointer user_data) Begins asynchronously resolving @hostname to determine its
associated IP address(es), and eventually calls @callback, which
must call g_resolver_lookup_by_name_finish() to get the result.
See g_resolver_lookup_by_name() for more details.- Parameters:
hostname
- the hostname to look up the address ofcancellable
- a #GCancellable, or %NULLcallback
- callback to call after resolution completesuser_data
- data for @callback
-
lookupByNameAsync
public void lookupByNameAsync(String hostname, @Nullable Cancellable cancellable, Resolver.OnAsyncReadyCallback callback, @Nullable Pointer user_data) Begins asynchronously resolving @hostname to determine its
associated IP address(es), and eventually calls @callback, which
must call g_resolver_lookup_by_name_finish() to get the result.
See g_resolver_lookup_by_name() for more details.- Parameters:
hostname
- the hostname to look up the address ofcancellable
- a #GCancellable, or %NULLcallback
- callback to call after resolution completesuser_data
- data for @callback
-
lookupByNameFinish
Retrieves the result of a call to
g_resolver_lookup_by_name_async().
If the DNS resolution failed, @error (if non-%NULL) will be set to
a value from #GResolverError. If the operation was cancelled,
@error will be set to %G_IO_ERROR_CANCELLED.- Parameters:
result
- the result passed to your #GAsyncReadyCallback- Returns:
- a #GList of #GInetAddress, or %NULL on error. See g_resolver_lookup_by_name() for more details.
- Throws:
AllocationError
-
lookupByNameWithFlags
public List lookupByNameWithFlags(@Nonnull Str hostname, int flags, @Nullable Cancellable cancellable) throws AllocationError This differs from g_resolver_lookup_by_name() in that you can modify
the lookup behavior with @flags. For example this can be used to limit
results with %G_RESOLVER_NAME_LOOKUP_FLAGS_IPV4_ONLY.- Parameters:
hostname
- the hostname to look upflags
- extra #GResolverNameLookupFlags for the lookupcancellable
- a #GCancellable, or %NULL- Returns:
- a non-empty #GList of #GInetAddress, or %NULL on error. You must unref each of the addresses and free the list when you are done with it. (You can use g_resolver_free_addresses() to do this.)
- Throws:
AllocationError
-
lookupByNameWithFlags
public List lookupByNameWithFlags(String hostname, int flags, @Nullable Cancellable cancellable) throws AllocationError This differs from g_resolver_lookup_by_name() in that you can modify
the lookup behavior with @flags. For example this can be used to limit
results with %G_RESOLVER_NAME_LOOKUP_FLAGS_IPV4_ONLY.- Parameters:
hostname
- the hostname to look upflags
- extra #GResolverNameLookupFlags for the lookupcancellable
- a #GCancellable, or %NULL- Returns:
- a non-empty #GList of #GInetAddress, or %NULL on error. You must unref each of the addresses and free the list when you are done with it. (You can use g_resolver_free_addresses() to do this.)
- Throws:
AllocationError
-
lookupByNameWithFlagsAsync
public void lookupByNameWithFlagsAsync(@Nonnull Str hostname, int flags, @Nullable Cancellable cancellable, Resolver.OnAsyncReadyCallback callback, @Nullable Pointer user_data) Begins asynchronously resolving @hostname to determine its
associated IP address(es), and eventually calls @callback, which
must call g_resolver_lookup_by_name_with_flags_finish() to get the result.
See g_resolver_lookup_by_name() for more details.- Parameters:
hostname
- the hostname to look up the address offlags
- extra #GResolverNameLookupFlags for the lookupcancellable
- a #GCancellable, or %NULLcallback
- callback to call after resolution completesuser_data
- data for @callback
-
lookupByNameWithFlagsAsync
public void lookupByNameWithFlagsAsync(String hostname, int flags, @Nullable Cancellable cancellable, Resolver.OnAsyncReadyCallback callback, @Nullable Pointer user_data) Begins asynchronously resolving @hostname to determine its
associated IP address(es), and eventually calls @callback, which
must call g_resolver_lookup_by_name_with_flags_finish() to get the result.
See g_resolver_lookup_by_name() for more details.- Parameters:
hostname
- the hostname to look up the address offlags
- extra #GResolverNameLookupFlags for the lookupcancellable
- a #GCancellable, or %NULLcallback
- callback to call after resolution completesuser_data
- data for @callback
-
lookupByNameWithFlagsFinish
Retrieves the result of a call to
g_resolver_lookup_by_name_with_flags_async().
If the DNS resolution failed, @error (if non-%NULL) will be set to
a value from #GResolverError. If the operation was cancelled,
@error will be set to %G_IO_ERROR_CANCELLED.- Parameters:
result
- the result passed to your #GAsyncReadyCallback- Returns:
- a #GList of #GInetAddress, or %NULL on error. See g_resolver_lookup_by_name() for more details.
- Throws:
AllocationError
-
lookupRecords
public List lookupRecords(@Nonnull Str rrname, int record_type, @Nullable Cancellable cancellable) throws AllocationError Synchronously performs a DNS record lookup for the given @rrname and returns
a list of records as #GVariant tuples. See #GResolverRecordType for
information on what the records contain for each @record_type.
If the DNS resolution fails, @error (if non-%NULL) will be set to
a value from #GResolverError and %NULL will be returned.
If @cancellable is non-%NULL, it can be used to cancel the
operation, in which case @error (if non-%NULL) will be set to
%G_IO_ERROR_CANCELLED.- Parameters:
rrname
- the DNS name to look up the record forrecord_type
- the type of DNS record to look upcancellable
- a #GCancellable, or %NULL- Returns:
- a non-empty #GList of #GVariant, or %NULL on error. You must free each of the records and the list when you are done with it. (You can use g_list_free_full() with g_variant_unref() to do this.)
- Throws:
AllocationError
-
lookupRecords
public List lookupRecords(String rrname, int record_type, @Nullable Cancellable cancellable) throws AllocationError Synchronously performs a DNS record lookup for the given @rrname and returns
a list of records as #GVariant tuples. See #GResolverRecordType for
information on what the records contain for each @record_type.
If the DNS resolution fails, @error (if non-%NULL) will be set to
a value from #GResolverError and %NULL will be returned.
If @cancellable is non-%NULL, it can be used to cancel the
operation, in which case @error (if non-%NULL) will be set to
%G_IO_ERROR_CANCELLED.- Parameters:
rrname
- the DNS name to look up the record forrecord_type
- the type of DNS record to look upcancellable
- a #GCancellable, or %NULL- Returns:
- a non-empty #GList of #GVariant, or %NULL on error. You must free each of the records and the list when you are done with it. (You can use g_list_free_full() with g_variant_unref() to do this.)
- Throws:
AllocationError
-
lookupRecordsAsync
public void lookupRecordsAsync(@Nonnull Str rrname, int record_type, @Nullable Cancellable cancellable, Resolver.OnAsyncReadyCallback callback, @Nullable Pointer user_data) Begins asynchronously performing a DNS lookup for the given
@rrname, and eventually calls @callback, which must call
g_resolver_lookup_records_finish() to get the final result. See
g_resolver_lookup_records() for more details.- Parameters:
rrname
- the DNS name to look up the record forrecord_type
- the type of DNS record to look upcancellable
- a #GCancellable, or %NULLcallback
- callback to call after resolution completesuser_data
- data for @callback
-
lookupRecordsAsync
public void lookupRecordsAsync(String rrname, int record_type, @Nullable Cancellable cancellable, Resolver.OnAsyncReadyCallback callback, @Nullable Pointer user_data) Begins asynchronously performing a DNS lookup for the given
@rrname, and eventually calls @callback, which must call
g_resolver_lookup_records_finish() to get the final result. See
g_resolver_lookup_records() for more details.- Parameters:
rrname
- the DNS name to look up the record forrecord_type
- the type of DNS record to look upcancellable
- a #GCancellable, or %NULLcallback
- callback to call after resolution completesuser_data
- data for @callback
-
lookupRecordsFinish
Retrieves the result of a previous call to
g_resolver_lookup_records_async(). Returns a non-empty list of records as
#GVariant tuples. See #GResolverRecordType for information on what the
records contain.
If the DNS resolution failed, @error (if non-%NULL) will be set to
a value from #GResolverError. If the operation was cancelled,
@error will be set to %G_IO_ERROR_CANCELLED.- Parameters:
result
- the result passed to your #GAsyncReadyCallback- Returns:
- a non-empty #GList of #GVariant, or %NULL on error. You must free each of the records and the list when you are done with it. (You can use g_list_free_full() with g_variant_unref() to do this.)
- Throws:
AllocationError
-
lookupService
public List lookupService(@Nonnull Str service, @Nonnull Str protocol, @Nonnull Str domain, @Nullable Cancellable cancellable) throws AllocationError Synchronously performs a DNS SRV lookup for the given @service and
@protocol in the given @domain and returns an array of #GSrvTarget.
@domain may be an ASCII-only or UTF-8 hostname. Note also that the
@service and @protocol arguments do not include the leading underscore
that appears in the actual DNS entry.
On success, g_resolver_lookup_service() will return a non-empty #GList of
#GSrvTarget, sorted in order of preference. (That is, you should
attempt to connect to the first target first, then the second if
the first fails, etc.)
If the DNS resolution fails, @error (if non-%NULL) will be set to
a value from #GResolverError and %NULL will be returned.
If @cancellable is non-%NULL, it can be used to cancel the
operation, in which case @error (if non-%NULL) will be set to
%G_IO_ERROR_CANCELLED.
If you are planning to connect to the service, it is usually easier
to create a #GNetworkService and use its #GSocketConnectable
interface.- Parameters:
service
- the service type to look up (eg, "ldap")protocol
- the networking protocol to use for @service (eg, "tcp")domain
- the DNS domain to look up the service incancellable
- a #GCancellable, or %NULL- Returns:
- a non-empty #GList of #GSrvTarget, or %NULL on error. You must free each of the targets and the list when you are done with it. (You can use g_resolver_free_targets() to do this.)
- Throws:
AllocationError
-
lookupService
public List lookupService(String service, String protocol, String domain, @Nullable Cancellable cancellable) throws AllocationError Synchronously performs a DNS SRV lookup for the given @service and
@protocol in the given @domain and returns an array of #GSrvTarget.
@domain may be an ASCII-only or UTF-8 hostname. Note also that the
@service and @protocol arguments do not include the leading underscore
that appears in the actual DNS entry.
On success, g_resolver_lookup_service() will return a non-empty #GList of
#GSrvTarget, sorted in order of preference. (That is, you should
attempt to connect to the first target first, then the second if
the first fails, etc.)
If the DNS resolution fails, @error (if non-%NULL) will be set to
a value from #GResolverError and %NULL will be returned.
If @cancellable is non-%NULL, it can be used to cancel the
operation, in which case @error (if non-%NULL) will be set to
%G_IO_ERROR_CANCELLED.
If you are planning to connect to the service, it is usually easier
to create a #GNetworkService and use its #GSocketConnectable
interface.- Parameters:
service
- the service type to look up (eg, "ldap")protocol
- the networking protocol to use for @service (eg, "tcp")domain
- the DNS domain to look up the service incancellable
- a #GCancellable, or %NULL- Returns:
- a non-empty #GList of #GSrvTarget, or %NULL on error. You must free each of the targets and the list when you are done with it. (You can use g_resolver_free_targets() to do this.)
- Throws:
AllocationError
-
lookupServiceAsync
public void lookupServiceAsync(@Nonnull Str service, @Nonnull Str protocol, @Nonnull Str domain, @Nullable Cancellable cancellable, Resolver.OnAsyncReadyCallback callback, @Nullable Pointer user_data) Begins asynchronously performing a DNS SRV lookup for the given
@service and @protocol in the given @domain, and eventually calls
@callback, which must call g_resolver_lookup_service_finish() to
get the final result. See g_resolver_lookup_service() for more
details.- Parameters:
service
- the service type to look up (eg, "ldap")protocol
- the networking protocol to use for @service (eg, "tcp")domain
- the DNS domain to look up the service incancellable
- a #GCancellable, or %NULLcallback
- callback to call after resolution completesuser_data
- data for @callback
-
lookupServiceAsync
public void lookupServiceAsync(String service, String protocol, String domain, @Nullable Cancellable cancellable, Resolver.OnAsyncReadyCallback callback, @Nullable Pointer user_data) Begins asynchronously performing a DNS SRV lookup for the given
@service and @protocol in the given @domain, and eventually calls
@callback, which must call g_resolver_lookup_service_finish() to
get the final result. See g_resolver_lookup_service() for more
details.- Parameters:
service
- the service type to look up (eg, "ldap")protocol
- the networking protocol to use for @service (eg, "tcp")domain
- the DNS domain to look up the service incancellable
- a #GCancellable, or %NULLcallback
- callback to call after resolution completesuser_data
- data for @callback
-
lookupServiceFinish
Retrieves the result of a previous call to
g_resolver_lookup_service_async().
If the DNS resolution failed, @error (if non-%NULL) will be set to
a value from #GResolverError. If the operation was cancelled,
@error will be set to %G_IO_ERROR_CANCELLED.- Parameters:
result
- the result passed to your #GAsyncReadyCallback- Returns:
- a non-empty #GList of #GSrvTarget, or %NULL on error. See g_resolver_lookup_service() for more details.
- Throws:
AllocationError
-
setDefault
public void setDefault()Sets @resolver to be the application's default resolver (reffing
@resolver, and unreffing the previous default resolver, if any).
Future calls to g_resolver_get_default() will return this resolver.
This can be used if an application wants to perform any sort of DNS
caching or "pinning"; it can implement its own #GResolver that
calls the original default resolver for DNS operations, and
implements its own cache policies on top of that, and then set
itself as the default resolver for all later code to use. -
onReload
Connect to signal "reload".
SeeResolver.OnReload.onReload()
for signal description.
FieldSIGNAL_ON_RELOAD
contains original signal name and can be used as resource reference.- Parameters:
signal
- callback function (lambda).- Returns:
SignalHandler
. Can be used to disconnect signal and to release callback function.
-
freeAddresses
Frees @addresses (which should be the return value from
g_resolver_lookup_by_name() or g_resolver_lookup_by_name_finish()).
(This is a convenience method; you can also simply free the results
by hand.)- Parameters:
addresses
- a #GList of #GInetAddress
-
freeTargets
Frees @targets (which should be the return value from
g_resolver_lookup_service() or g_resolver_lookup_service_finish()).
(This is a convenience method; you can also simply free the
results by hand.)- Parameters:
targets
- a #GList of #GSrvTarget
-
getDefault
Gets the default #GResolver. You should unref it when you are done
with it. #GResolver may use its reference count as a hint about how
many threads it should allocate for concurrent DNS resolutions.- Returns:
- the default #GResolver.
-
getTypeID
public static long getTypeID() -
getParentTypeID
public static long getParentTypeID() -
getTypeSize
-
getParentTypeSize
-
getInstanceSize
public static int getInstanceSize()
-