Libraries:Gtk:Gio:GResolver
Types
T
Inherits from:T provides cancellable synchronous and asynchronous DNS resolution, for hostnames (LookupByAddress, LookupByName and their async variants) and SRV (service) records (LookupService).
Gtk.Gio.GNetworkAddress.T and Gtk.Gio.GNetworkService.T provide wrappers around T functionality that also implement Gtk.Gio.GSocketConnectable.T, making it easy to connect to a remote host/service.
Constants
Nil : T
Functions
ErrorQuark() : Std.Integer.SmallT
FreeAddresses(addresses @ Std.Object.T) : Std.Object.T
Frees addresses (which should be the return value from LookupByName or LookupByNameFinish). (This is a convenience method; you can also simply free the results by hand.)
addresses | a GList of Gtk.Gio.GInetAddress.T |
FreeTargets(targets @ Std.Object.T) : Std.Object.T
Frees targets (which should be the return value from LookupService or LookupServiceFinish). (This is a convenience method; you can also simply free the results by hand.)
targets | a GList of Gtk.Gio.GSrvTarget.T |
GetDefault() : Gtk.Gio.GResolver.T
Gets the default T. You should unref it when you are done with it. T may use its reference count as a hint about how many threads/processes, etc it should allocate for concurrent DNS resolutions.
Returns | the default T. [transfer full] |
GetType() : Gtk.GObject.Type.T
Methods
:LookupByAddress(self @ T, address @ Gtk.Gio.GInetAddress.T, cancellable @ Gtk.Gio.GCancellable.T, error @ Std.Object.T) : Std.String.T
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 Gtk.Gio.GResolverError.T.
If cancellable is non-NULL, it can be used to cancel the operation, in which case error (if non-NULL) will be set to Gtk.Gio.GIOErrorEnum.Cancelled.
resolver | a T |
address | the address to reverse-resolve |
cancellable | a Gtk.Gio.GCancellable.T, or NULL. [allow-none] |
error | return location for a Gtk.Glib.GError.T, or NULL |
Returns | a hostname (either ASCII-only, or in ASCII-encoded form), or NULL on error. |
:LookupByAddressAsync(self @ T, address @ Gtk.Gio.GInetAddress.T, cancellable @ Gtk.Gio.GCancellable.T, callback @ Std.Function.T, user_data) : Std.Object.T
Begins asynchronously reverse-resolving address to determine its associated hostname, and eventually calls callback, which must call LookupByAddressFinish to get the final result.
resolver | a T |
address | the address to reverse-resolve |
cancellable | a Gtk.Gio.GCancellable.T, or NULL. [allow-none] |
callback | callback to call after resolution completes. [scope async] |
user_data | data for callback. [closure] |
:LookupByAddressFinish(self @ T, result @ Gtk.Gio.GAsyncResult.T, error @ Std.Object.T) : Std.String.T
Retrieves the result of a previous call to LookupByAddressAsync.
If the DNS resolution failed, error (if non-NULL) will be set to a value from Gtk.Gio.GResolverError.T. If the operation was cancelled, error will be set to Gtk.Gio.GIOErrorEnum.Cancelled.
resolver | a T |
result | the result passed to your Gtk.Gio.GAsyncReadyCallback |
error | return location for a Gtk.Glib.GError.T, or NULL |
Returns | a hostname (either ASCII-only, or in ASCII-encoded form), or NULL on error. |
:LookupByName(self @ T, hostname @ Std.String.T, cancellable @ Gtk.Gio.GCancellable.T, error @ Std.Object.T) : Std.Object.T
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, LookupByName will return a GList of Gtk.Gio.GInetAddress.T, 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. Gtk.Gio.GSocketListener.AddAddress.
If the DNS resolution fails, error (if non-NULL) will be set to a value from Gtk.Gio.GResolverError.T.
If cancellable is non-NULL, it can be used to cancel the operation, in which case error (if non-NULL) will be set to Gtk.Gio.GIOErrorEnum.Cancelled.
If you are planning to connect to a socket on the resolved IP address, it may be easier to create a Gtk.Gio.GNetworkAddress.T and use its Gtk.Gio.GSocketConnectable.T interface.
resolver | a T |
hostname | the hostname to look up |
cancellable | a Gtk.Gio.GCancellable.T, or NULL. [allow-none] |
error | return location for a Gtk.Glib.GError.T, or NULL |
Returns | a GList of Gtk.Gio.GInetAddress.T, or NULL on error. You must unref each of the addresses and free the list when you are done with it. (You can use FreeAddresses to do this.). [element-type GInetAddress][transfer full] |
:LookupByNameAsync(self @ T, hostname @ Std.String.T, cancellable @ Gtk.Gio.GCancellable.T, callback @ Std.Function.T, user_data) : Std.Object.T
Begins asynchronously resolving hostname to determine its associated IP address(es), and eventually calls callback, which must call LookupByNameFinish to get the result. See LookupByName for more details.
resolver | a T |
hostname | the hostname to look up the address of |
cancellable | a Gtk.Gio.GCancellable.T, or NULL. [allow-none] |
callback | callback to call after resolution completes. [scope async] |
user_data | data for callback. [closure] |
:LookupByNameFinish(self @ T, result @ Gtk.Gio.GAsyncResult.T, error @ Std.Object.T) : Std.Object.T
Retrieves the result of a call to LookupByNameAsync.
If the DNS resolution failed, error (if non-NULL) will be set to a value from Gtk.Gio.GResolverError.T. If the operation was cancelled, error will be set to Gtk.Gio.GIOErrorEnum.Cancelled.
resolver | a T |
result | the result passed to your Gtk.Gio.GAsyncReadyCallback |
error | return location for a Gtk.Glib.GError.T, or NULL |
Returns | a GList of Gtk.Gio.GInetAddress.T, or NULL on error. See LookupByName for more details. [element-type GInetAddress][transfer full] |
:LookupService(self @ T, service @ Std.String.T, protocol @ Std.String.T, domain @ Std.String.T, cancellable @ Gtk.Gio.GCancellable.T, error @ Std.Object.T) : Std.Object.T
Synchronously performs a DNS SRV lookup for the given service and protocol in the given domain and returns an array of Gtk.Gio.GSrvTarget.T. 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, LookupService will return a GList of Gtk.Gio.GSrvTarget.T, 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 Gtk.Gio.GResolverError.T.
If cancellable is non-NULL, it can be used to cancel the operation, in which case error (if non-NULL) will be set to Gtk.Gio.GIOErrorEnum.Cancelled.
If you are planning to connect to the service, it is usually easier to create a Gtk.Gio.GNetworkService.T and use its Gtk.Gio.GSocketConnectable.T interface.
resolver | a T |
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 in |
cancellable | a Gtk.Gio.GCancellable.T, or NULL. [allow-none] |
error | return location for a Gtk.Glib.GError.T, or NULL |
Returns | a GList of Gtk.Gio.GSrvTarget.T, or NULL on error. You must free each of the targets and the list when you are done with it. (You can use FreeTargets to do this.). [element-type GSrvTarget][transfer full] |
:LookupServiceAsync(self @ T, service @ Std.String.T, protocol @ Std.String.T, domain @ Std.String.T, cancellable @ Gtk.Gio.GCancellable.T, callback @ Std.Function.T, user_data) : Std.Object.T
Begins asynchronously performing a DNS SRV lookup for the given service and protocol in the given domain, and eventually calls callback, which must call LookupServiceFinish to get the final result. See LookupService for more details.
resolver | a T |
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 in |
cancellable | a Gtk.Gio.GCancellable.T, or NULL. [allow-none] |
callback | callback to call after resolution completes. [scope async] |
user_data | data for callback. [closure] |
:LookupServiceFinish(self @ T, result @ Gtk.Gio.GAsyncResult.T, error @ Std.Object.T) : Std.Object.T
Retrieves the result of a previous call to LookupServiceAsync.
If the DNS resolution failed, error (if non-NULL) will be set to a value from Gtk.Gio.GResolverError.T. If the operation was cancelled, error will be set to Gtk.Gio.GIOErrorEnum.Cancelled.
resolver | a T |
result | the result passed to your Gtk.Gio.GAsyncReadyCallback |
error | return location for a Gtk.Glib.GError.T, or NULL |
Returns | a GList of Gtk.Gio.GSrvTarget.T, or NULL on error. See LookupService for more details. [element-type GSrvTarget][transfer full] |
:Priv(self @ T) : Std.Object.T
:SetDefault(self @ T) : Std.Object.T
Sets resolver to be the application's default resolver (reffing resolver, and unreffing the previous default resolver, if any). Future calls to GetDefault 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 T 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.
resolver | the new default T |