package ocgtk

  1. Overview
  2. Docs
OCaml bindings for GTK 4

Install

dune-project
 Dependency

Authors

Maintainers

Sources

v0.1-preview2.tar.gz
sha256=4e50fdb5093136a10fc8ffbe388e44cbcb70d52f8afdd48863ec7e22580ff054

doc/ocgtk.gio/Ocgtk_gio/Gio/Wrappers/Resolver/index.html

Module Wrappers.Resolver

type t = [ `resolver | `object_ ] Gobject.obj
val set_timeout : t -> int -> unit

Set the timeout applied to all resolver lookups. See #GResolver:timeout.

val set_default : t -> unit

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.

val lookup_service_finish : t -> [ `async_result ] Gobject.obj -> ([ `srv_target ] Gobject.obj list, GError.t) result

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.

val lookup_service : t -> string -> string -> string -> [ `cancellable | `object_ ] Gobject.obj option -> ([ `srv_target ] Gobject.obj list, GError.t) result

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.

val lookup_records_finish : t -> [ `async_result ] Gobject.obj -> (Gvariant.t list, GError.t) result

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.

val lookup_records : t -> string -> Gio_enums.resolverrecordtype -> [ `cancellable | `object_ ] Gobject.obj option -> (Gvariant.t list, GError.t) result

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.

val lookup_by_name_with_flags_finish : t -> [ `async_result ] Gobject.obj -> ([ `inet_address | `object_ ] Gobject.obj list, GError.t) result

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.

val lookup_by_name_with_flags : t -> string -> Gio_enums.resolvernamelookupflags -> [ `cancellable | `object_ ] Gobject.obj option -> ([ `inet_address | `object_ ] Gobject.obj list, GError.t) result

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.

val lookup_by_name_finish : t -> [ `async_result ] Gobject.obj -> ([ `inet_address | `object_ ] Gobject.obj list, GError.t) result

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.

val lookup_by_name : t -> string -> [ `cancellable | `object_ ] Gobject.obj option -> ([ `inet_address | `object_ ] Gobject.obj list, GError.t) result

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.

val lookup_by_address_finish : t -> [ `async_result ] Gobject.obj -> (string, GError.t) result

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.

val lookup_by_address : t -> [ `inet_address | `object_ ] Gobject.obj -> [ `cancellable | `object_ ] Gobject.obj option -> (string, GError.t) result

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.

val get_timeout : t -> int

Get the timeout applied to all resolver lookups. See #GResolver:timeout.

val on_reload : ?after:bool -> t -> callback:(unit -> unit) -> Gobject.Signal.handler_id