| Copyright | Will Thompson, Iñaki García Etxebarria and Jonas Platte |
|---|---|
| License | LGPL-2.1 |
| Maintainer | Iñaki García Etxebarria (garetxe@gmail.com) |
| Safe Haskell | None |
| Language | Haskell2010 |
GI.Gio.Objects.Resolver
Contents
Description
Resolver provides cancellable synchronous and asynchronous DNS
resolution, for hostnames (resolverLookupByAddress,
resolverLookupByName and their async variants) and SRV
(service) records (resolverLookupService).
NetworkAddress and NetworkService provide wrappers around
Resolver functionality that also implement SocketConnectable,
making it easy to connect to a remote host/service.
- newtype Resolver = Resolver (ManagedPtr Resolver)
- class GObject o => IsResolver o
- toResolver :: IsResolver o => o -> IO Resolver
- noResolver :: Maybe Resolver
- resolverGetDefault :: (HasCallStack, MonadIO m) => m Resolver
- data ResolverLookupByAddressMethodInfo
- resolverLookupByAddress :: (HasCallStack, MonadIO m, IsResolver a, IsInetAddress b, IsCancellable c) => a -> b -> Maybe c -> m Text
- data ResolverLookupByAddressAsyncMethodInfo
- resolverLookupByAddressAsync :: (HasCallStack, MonadIO m, IsResolver a, IsInetAddress b, IsCancellable c) => a -> b -> Maybe c -> Maybe AsyncReadyCallback -> m ()
- data ResolverLookupByAddressFinishMethodInfo
- resolverLookupByAddressFinish :: (HasCallStack, MonadIO m, IsResolver a, IsAsyncResult b) => a -> b -> m Text
- data ResolverLookupByNameMethodInfo
- resolverLookupByName :: (HasCallStack, MonadIO m, IsResolver a, IsCancellable b) => a -> Text -> Maybe b -> m [InetAddress]
- data ResolverLookupByNameAsyncMethodInfo
- resolverLookupByNameAsync :: (HasCallStack, MonadIO m, IsResolver a, IsCancellable b) => a -> Text -> Maybe b -> Maybe AsyncReadyCallback -> m ()
- data ResolverLookupByNameFinishMethodInfo
- resolverLookupByNameFinish :: (HasCallStack, MonadIO m, IsResolver a, IsAsyncResult b) => a -> b -> m [InetAddress]
- data ResolverLookupRecordsMethodInfo
- resolverLookupRecords :: (HasCallStack, MonadIO m, IsResolver a, IsCancellable b) => a -> Text -> ResolverRecordType -> Maybe b -> m [GVariant]
- data ResolverLookupRecordsAsyncMethodInfo
- resolverLookupRecordsAsync :: (HasCallStack, MonadIO m, IsResolver a, IsCancellable b) => a -> Text -> ResolverRecordType -> Maybe b -> Maybe AsyncReadyCallback -> m ()
- data ResolverLookupRecordsFinishMethodInfo
- resolverLookupRecordsFinish :: (HasCallStack, MonadIO m, IsResolver a, IsAsyncResult b) => a -> b -> m [GVariant]
- data ResolverLookupServiceMethodInfo
- resolverLookupService :: (HasCallStack, MonadIO m, IsResolver a, IsCancellable b) => a -> Text -> Text -> Text -> Maybe b -> m [SrvTarget]
- data ResolverLookupServiceAsyncMethodInfo
- resolverLookupServiceAsync :: (HasCallStack, MonadIO m, IsResolver a, IsCancellable b) => a -> Text -> Text -> Text -> Maybe b -> Maybe AsyncReadyCallback -> m ()
- data ResolverLookupServiceFinishMethodInfo
- resolverLookupServiceFinish :: (HasCallStack, MonadIO m, IsResolver a, IsAsyncResult b) => a -> b -> m [SrvTarget]
- data ResolverSetDefaultMethodInfo
- resolverSetDefault :: (HasCallStack, MonadIO m, IsResolver a) => a -> m ()
- type C_ResolverReloadCallback = Ptr () -> Ptr () -> IO ()
- type ResolverReloadCallback = IO ()
- data ResolverReloadSignalInfo
- afterResolverReload :: (GObject a, MonadIO m) => a -> ResolverReloadCallback -> m SignalHandlerId
- genClosure_ResolverReload :: ResolverReloadCallback -> IO Closure
- mk_ResolverReloadCallback :: C_ResolverReloadCallback -> IO (FunPtr C_ResolverReloadCallback)
- noResolverReloadCallback :: Maybe ResolverReloadCallback
- onResolverReload :: (GObject a, MonadIO m) => a -> ResolverReloadCallback -> m SignalHandlerId
- wrap_ResolverReloadCallback :: ResolverReloadCallback -> Ptr () -> Ptr () -> IO ()
Exported types
Constructors
| Resolver (ManagedPtr Resolver) |
Instances
| GObject Resolver Source # | |
| IsObject Resolver Source # | |
| IsResolver Resolver Source # | |
| ((~) * info (ResolveResolverMethod t Resolver), MethodInfo * info Resolver p) => IsLabel t (Resolver -> p) Source # | |
| ((~) * info (ResolveResolverMethod t Resolver), MethodInfo * info Resolver p) => IsLabelProxy t (Resolver -> p) Source # | |
| HasAttributeList * Resolver Source # | |
| type AttributeList Resolver Source # | |
| type SignalList Resolver Source # | |
class GObject o => IsResolver o Source #
Instances
| (GObject a, UnknownAncestorError Constraint Resolver a) => IsResolver a Source # | |
| IsResolver Resolver Source # | |
toResolver :: IsResolver o => o -> IO Resolver Source #
Methods
getDefault
Arguments
| :: (HasCallStack, MonadIO m) | |
| => m Resolver | Returns: the default |
lookupByAddress
data ResolverLookupByAddressMethodInfo Source #
Instances
| ((~) * signature (b -> Maybe c -> m Text), MonadIO m, IsResolver a, IsInetAddress b, IsCancellable c) => MethodInfo * ResolverLookupByAddressMethodInfo a signature Source # | |
resolverLookupByAddress Source #
Arguments
| :: (HasCallStack, MonadIO m, IsResolver a, IsInetAddress b, IsCancellable c) | |
| => a |
|
| -> b |
|
| -> Maybe c |
|
| -> m Text | Returns: a hostname (either ASCII-only, or in ASCII-encoded
form), or |
Synchronously reverse-resolves address to determine its
associated hostname.
If the DNS resolution fails, error (if non-Nothing) will be set to
a value from ResolverError.
If cancellable is non-Nothing, it can be used to cancel the
operation, in which case error (if non-Nothing) will be set to
IOErrorEnumCancelled.
Since: 2.22
lookupByAddressAsync
data ResolverLookupByAddressAsyncMethodInfo Source #
Instances
| ((~) * signature (b -> Maybe c -> Maybe AsyncReadyCallback -> m ()), MonadIO m, IsResolver a, IsInetAddress b, IsCancellable c) => MethodInfo * ResolverLookupByAddressAsyncMethodInfo a signature Source # | |
resolverLookupByAddressAsync Source #
Arguments
| :: (HasCallStack, MonadIO m, IsResolver a, IsInetAddress b, IsCancellable c) | |
| => a |
|
| -> b |
|
| -> Maybe c |
|
| -> Maybe AsyncReadyCallback |
|
| -> m () |
Begins asynchronously reverse-resolving address to determine its
associated hostname, and eventually calls callback, which must
call resolverLookupByAddressFinish to get the final result.
Since: 2.22
lookupByAddressFinish
data ResolverLookupByAddressFinishMethodInfo Source #
Instances
| ((~) * signature (b -> m Text), MonadIO m, IsResolver a, IsAsyncResult b) => MethodInfo * ResolverLookupByAddressFinishMethodInfo a signature Source # | |
resolverLookupByAddressFinish Source #
Arguments
| :: (HasCallStack, MonadIO m, IsResolver a, IsAsyncResult b) | |
| => a |
|
| -> b |
|
| -> m Text | Returns: a hostname (either ASCII-only, or in ASCII-encoded
form), or |
Retrieves the result of a previous call to
resolverLookupByAddressAsync.
If the DNS resolution failed, error (if non-Nothing) will be set to
a value from ResolverError. If the operation was cancelled,
error will be set to IOErrorEnumCancelled.
Since: 2.22
lookupByName
data ResolverLookupByNameMethodInfo Source #
Instances
| ((~) * signature (Text -> Maybe b -> m [InetAddress]), MonadIO m, IsResolver a, IsCancellable b) => MethodInfo * ResolverLookupByNameMethodInfo a signature Source # | |
Arguments
| :: (HasCallStack, MonadIO m, IsResolver a, IsCancellable b) | |
| => a |
|
| -> Text |
|
| -> Maybe b |
|
| -> m [InetAddress] | Returns: a non-empty |
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 inetAddressNewFromString).
On success, resolverLookupByName will return a non-empty List of
InetAddress, 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. socketListenerAddAddress.
If the DNS resolution fails, error (if non-Nothing) will be set to a
value from ResolverError and Nothing will be returned.
If cancellable is non-Nothing, it can be used to cancel the
operation, in which case error (if non-Nothing) will be set to
IOErrorEnumCancelled.
If you are planning to connect to a socket on the resolved IP
address, it may be easier to create a NetworkAddress and use its
SocketConnectable interface.
Since: 2.22
lookupByNameAsync
data ResolverLookupByNameAsyncMethodInfo Source #
Instances
| ((~) * signature (Text -> Maybe b -> Maybe AsyncReadyCallback -> m ()), MonadIO m, IsResolver a, IsCancellable b) => MethodInfo * ResolverLookupByNameAsyncMethodInfo a signature Source # | |
resolverLookupByNameAsync Source #
Arguments
| :: (HasCallStack, MonadIO m, IsResolver a, IsCancellable b) | |
| => a |
|
| -> Text |
|
| -> Maybe b |
|
| -> Maybe AsyncReadyCallback |
|
| -> m () |
Begins asynchronously resolving hostname to determine its
associated IP address(es), and eventually calls callback, which
must call resolverLookupByNameFinish to get the result.
See resolverLookupByName for more details.
Since: 2.22
lookupByNameFinish
data ResolverLookupByNameFinishMethodInfo Source #
Instances
| ((~) * signature (b -> m [InetAddress]), MonadIO m, IsResolver a, IsAsyncResult b) => MethodInfo * ResolverLookupByNameFinishMethodInfo a signature Source # | |
resolverLookupByNameFinish Source #
Arguments
| :: (HasCallStack, MonadIO m, IsResolver a, IsAsyncResult b) | |
| => a |
|
| -> b |
|
| -> m [InetAddress] | Returns: a |
Retrieves the result of a call to
resolverLookupByNameAsync.
If the DNS resolution failed, error (if non-Nothing) will be set to
a value from ResolverError. If the operation was cancelled,
error will be set to IOErrorEnumCancelled.
Since: 2.22
lookupRecords
data ResolverLookupRecordsMethodInfo Source #
Instances
| ((~) * signature (Text -> ResolverRecordType -> Maybe b -> m [GVariant]), MonadIO m, IsResolver a, IsCancellable b) => MethodInfo * ResolverLookupRecordsMethodInfo a signature Source # | |
resolverLookupRecords Source #
Arguments
| :: (HasCallStack, MonadIO m, IsResolver a, IsCancellable b) | |
| => a |
|
| -> Text |
|
| -> ResolverRecordType |
|
| -> Maybe b |
|
| -> m [GVariant] | Returns: a non-empty |
Synchronously performs a DNS record lookup for the given rrname and returns
a list of records as GVariant tuples. See ResolverRecordType for
information on what the records contain for each recordType.
If the DNS resolution fails, error (if non-Nothing) will be set to
a value from ResolverError and Nothing will be returned.
If cancellable is non-Nothing, it can be used to cancel the
operation, in which case error (if non-Nothing) will be set to
IOErrorEnumCancelled.
Since: 2.34
lookupRecordsAsync
data ResolverLookupRecordsAsyncMethodInfo Source #
Instances
| ((~) * signature (Text -> ResolverRecordType -> Maybe b -> Maybe AsyncReadyCallback -> m ()), MonadIO m, IsResolver a, IsCancellable b) => MethodInfo * ResolverLookupRecordsAsyncMethodInfo a signature Source # | |
resolverLookupRecordsAsync Source #
Arguments
| :: (HasCallStack, MonadIO m, IsResolver a, IsCancellable b) | |
| => a |
|
| -> Text |
|
| -> ResolverRecordType |
|
| -> Maybe b |
|
| -> Maybe AsyncReadyCallback |
|
| -> m () |
Begins asynchronously performing a DNS lookup for the given
rrname, and eventually calls callback, which must call
resolverLookupRecordsFinish to get the final result. See
resolverLookupRecords for more details.
Since: 2.34
lookupRecordsFinish
data ResolverLookupRecordsFinishMethodInfo Source #
Instances
| ((~) * signature (b -> m [GVariant]), MonadIO m, IsResolver a, IsAsyncResult b) => MethodInfo * ResolverLookupRecordsFinishMethodInfo a signature Source # | |
resolverLookupRecordsFinish Source #
Arguments
| :: (HasCallStack, MonadIO m, IsResolver a, IsAsyncResult b) | |
| => a |
|
| -> b |
|
| -> m [GVariant] | Returns: a non-empty |
Retrieves the result of a previous call to
resolverLookupRecordsAsync. Returns a non-empty list of records as
GVariant tuples. See ResolverRecordType for information on what the
records contain.
If the DNS resolution failed, error (if non-Nothing) will be set to
a value from ResolverError. If the operation was cancelled,
error will be set to IOErrorEnumCancelled.
Since: 2.34
lookupService
data ResolverLookupServiceMethodInfo Source #
Instances
| ((~) * signature (Text -> Text -> Text -> Maybe b -> m [SrvTarget]), MonadIO m, IsResolver a, IsCancellable b) => MethodInfo * ResolverLookupServiceMethodInfo a signature Source # | |
resolverLookupService Source #
Arguments
| :: (HasCallStack, MonadIO m, IsResolver a, IsCancellable b) | |
| => a |
|
| -> Text |
|
| -> Text |
|
| -> Text |
|
| -> Maybe b |
|
| -> m [SrvTarget] | Returns: a non-empty |
Synchronously performs a DNS SRV lookup for the given service and
protocol in the given domain and returns an array of SrvTarget.
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, resolverLookupService will return a non-empty List of
SrvTarget, 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-Nothing) will be set to
a value from ResolverError and Nothing will be returned.
If cancellable is non-Nothing, it can be used to cancel the
operation, in which case error (if non-Nothing) will be set to
IOErrorEnumCancelled.
If you are planning to connect to the service, it is usually easier
to create a NetworkService and use its SocketConnectable
interface.
Since: 2.22
lookupServiceAsync
data ResolverLookupServiceAsyncMethodInfo Source #
Instances
| ((~) * signature (Text -> Text -> Text -> Maybe b -> Maybe AsyncReadyCallback -> m ()), MonadIO m, IsResolver a, IsCancellable b) => MethodInfo * ResolverLookupServiceAsyncMethodInfo a signature Source # | |
resolverLookupServiceAsync Source #
Arguments
| :: (HasCallStack, MonadIO m, IsResolver a, IsCancellable b) | |
| => a |
|
| -> Text |
|
| -> Text |
|
| -> Text |
|
| -> Maybe b |
|
| -> Maybe AsyncReadyCallback |
|
| -> m () |
Begins asynchronously performing a DNS SRV lookup for the given
service and protocol in the given domain, and eventually calls
callback, which must call resolverLookupServiceFinish to
get the final result. See resolverLookupService for more
details.
Since: 2.22
lookupServiceFinish
data ResolverLookupServiceFinishMethodInfo Source #
Instances
| ((~) * signature (b -> m [SrvTarget]), MonadIO m, IsResolver a, IsAsyncResult b) => MethodInfo * ResolverLookupServiceFinishMethodInfo a signature Source # | |
resolverLookupServiceFinish Source #
Arguments
| :: (HasCallStack, MonadIO m, IsResolver a, IsAsyncResult b) | |
| => a |
|
| -> b |
|
| -> m [SrvTarget] | Returns: a non-empty |
Retrieves the result of a previous call to
resolverLookupServiceAsync.
If the DNS resolution failed, error (if non-Nothing) will be set to
a value from ResolverError. If the operation was cancelled,
error will be set to IOErrorEnumCancelled.
Since: 2.22
setDefault
data ResolverSetDefaultMethodInfo Source #
Instances
| ((~) * signature (m ()), MonadIO m, IsResolver a) => MethodInfo * ResolverSetDefaultMethodInfo a signature Source # | |
Arguments
| :: (HasCallStack, MonadIO m, IsResolver a) | |
| => a |
|
| -> m () |
Sets resolver to be the application's default resolver (reffing
resolver, and unreffing the previous default resolver, if any).
Future calls to resolverGetDefault 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 Resolver 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.
Since: 2.22
Signals
reload
type ResolverReloadCallback = IO () Source #
afterResolverReload :: (GObject a, MonadIO m) => a -> ResolverReloadCallback -> m SignalHandlerId Source #
mk_ResolverReloadCallback :: C_ResolverReloadCallback -> IO (FunPtr C_ResolverReloadCallback) Source #
onResolverReload :: (GObject a, MonadIO m) => a -> ResolverReloadCallback -> m SignalHandlerId Source #
wrap_ResolverReloadCallback :: ResolverReloadCallback -> Ptr () -> Ptr () -> IO () Source #