Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
No description available in the introspection data.
Synopsis
- newtype Address = Address (ManagedPtr Address)
- class (GObject o, IsDescendantOf Address o) => IsAddress o
- toAddress :: (MonadIO m, IsAddress o) => o -> m Address
- addressEqualByIp :: (HasCallStack, MonadIO m, IsAddress a, IsAddress b) => a -> b -> m Bool
- addressEqualByName :: (HasCallStack, MonadIO m, IsAddress a, IsAddress b) => a -> b -> m Bool
- addressGetGsockaddr :: (HasCallStack, MonadIO m, IsAddress a) => a -> m SocketAddress
- addressGetName :: (HasCallStack, MonadIO m, IsAddress a) => a -> m (Maybe Text)
- addressGetPhysical :: (HasCallStack, MonadIO m, IsAddress a) => a -> m (Maybe Text)
- addressGetPort :: (HasCallStack, MonadIO m, IsAddress a) => a -> m Word32
- addressHashByIp :: (HasCallStack, MonadIO m, IsAddress a) => a -> m Word32
- addressHashByName :: (HasCallStack, MonadIO m, IsAddress a) => a -> m Word32
- addressIsResolved :: (HasCallStack, MonadIO m, IsAddress a) => a -> m Bool
- addressNew :: (HasCallStack, MonadIO m) => Text -> Word32 -> m Address
- addressNewAny :: (HasCallStack, MonadIO m) => AddressFamily -> Word32 -> m (Maybe Address)
- addressNewFromSockaddr :: (HasCallStack, MonadIO m) => Ptr () -> Int32 -> m (Maybe Address)
- addressResolveAsync :: (HasCallStack, MonadIO m, IsAddress a, IsCancellable b) => a -> Maybe MainContext -> Maybe b -> AddressCallback -> m ()
- addressResolveSync :: (HasCallStack, MonadIO m, IsAddress a, IsCancellable b) => a -> Maybe b -> m Word32
- constructAddressFamily :: (IsAddress o, MonadIO m) => AddressFamily -> m (GValueConstruct o)
- getAddressFamily :: (MonadIO m, IsAddress o) => o -> m AddressFamily
- constructAddressName :: (IsAddress o, MonadIO m) => Text -> m (GValueConstruct o)
- getAddressName :: (MonadIO m, IsAddress o) => o -> m (Maybe Text)
- getAddressPhysical :: (MonadIO m, IsAddress o) => o -> m (Maybe Text)
- constructAddressPort :: (IsAddress o, MonadIO m) => Int32 -> m (GValueConstruct o)
- getAddressPort :: (MonadIO m, IsAddress o) => o -> m Int32
- constructAddressProtocol :: (IsAddress o, MonadIO m) => Text -> m (GValueConstruct o)
- getAddressProtocol :: (MonadIO m, IsAddress o) => o -> m (Maybe Text)
- constructAddressSockaddr :: (IsAddress o, MonadIO m) => Ptr () -> m (GValueConstruct o)
- getAddressSockaddr :: (MonadIO m, IsAddress o) => o -> m (Ptr ())
Exported types
Memory-managed wrapper type.
Instances
Eq Address Source # | |
GObject Address Source # | |
Defined in GI.Soup.Objects.Address | |
ManagedPtrNewtype Address Source # | |
Defined in GI.Soup.Objects.Address toManagedPtr :: Address -> ManagedPtr Address # | |
TypedObject Address Source # | |
Defined in GI.Soup.Objects.Address | |
HasParentTypes Address Source # | |
Defined in GI.Soup.Objects.Address | |
IsGValue (Maybe Address) Source # | Convert |
Defined in GI.Soup.Objects.Address | |
type ParentTypes Address Source # | |
Defined in GI.Soup.Objects.Address |
class (GObject o, IsDescendantOf Address o) => IsAddress o Source #
Instances
(GObject o, IsDescendantOf Address o) => IsAddress o Source # | |
Defined in GI.Soup.Objects.Address |
Methods
Click to display all available methods, including inherited ones
Methods
bindProperty, bindPropertyFull, enumerate, equalByIp, equalByName, forceFloating, freezeNotify, getv, hashByIp, hashByName, isFloating, isResolved, notify, notifyByPspec, proxyEnumerate, ref, refSink, resolveAsync, resolveSync, runDispose, stealData, stealQdata, thawNotify, toString, unref, watchClosure.
Getters
getData, getGsockaddr, getName, getPhysical, getPort, getProperty, getQdata.
Setters
equalByIp
:: (HasCallStack, MonadIO m, IsAddress a, IsAddress b) | |
=> a |
|
-> b |
|
-> m Bool | Returns: whether or not |
Tests if addr1
and addr2
have the same IP address. This method
can be used with addressHashByIp
to create a
HashTable
that hashes on IP address.
This would be used to distinguish hosts in situations where different virtual hosts on the same IP address should be considered the same. Eg, if "www.example.com" and "www.example.net" have the same IP address, then a single connection can be used to talk to either of them.
See also addressEqualByName
, which compares by name
rather than by IP address.
Since: 2.26
equalByName
:: (HasCallStack, MonadIO m, IsAddress a, IsAddress b) | |
=> a |
|
-> b |
|
-> m Bool | Returns: whether or not |
Tests if addr1
and addr2
have the same "name". This method can be
used with addressHashByName
to create a HashTable
that
hashes on address "names".
Comparing by name normally means comparing the addresses by their hostnames. But if the address was originally created using an IP address literal, then it will be compared by that instead.
In particular, if "www.example.com" has the IP address 10.0.0.1,
and addr1
was created with the name "www.example.com" and addr2
was created with the name "10.0.0.1", then they will compare as
unequal for purposes of addressEqualByName
.
This would be used to distinguish hosts in situations where different virtual hosts on the same IP address should be considered different. Eg, for purposes of HTTP authentication or cookies, two hosts with the same IP address but different names are considered to be different hosts.
See also addressEqualByIp
, which compares by IP address
rather than by name.
Since: 2.26
getGsockaddr
:: (HasCallStack, MonadIO m, IsAddress a) | |
=> a |
|
-> m SocketAddress | Returns: a new |
Creates a new SocketAddress
corresponding to addr
(which is assumed
to only have one socket address associated with it).
Since: 2.32
getName
:: (HasCallStack, MonadIO m, IsAddress a) | |
=> a |
|
-> m (Maybe Text) | Returns: the hostname, or |
Returns the hostname associated with addr
.
This method is not thread-safe; if you call it while addr
is being
resolved in another thread, it may return garbage. You can use
addressIsResolved
to safely test whether or not an address
is resolved before fetching its name or address.
getPhysical
:: (HasCallStack, MonadIO m, IsAddress a) | |
=> a |
|
-> m (Maybe Text) | Returns: the physical address, or |
Returns the physical address associated with addr
as a string.
(Eg, "127.0.0.1"). If the address is not yet known, returns Nothing
.
This method is not thread-safe; if you call it while addr
is being
resolved in another thread, it may return garbage. You can use
addressIsResolved
to safely test whether or not an address
is resolved before fetching its name or address.
getPort
:: (HasCallStack, MonadIO m, IsAddress a) | |
=> a |
|
-> m Word32 | Returns: the port |
Returns the port associated with addr
.
hashByIp
:: (HasCallStack, MonadIO m, IsAddress a) | |
=> a |
|
-> m Word32 | Returns: the IP-based hash value for |
A hash function (for HashTable
) that corresponds to
addressEqualByIp
, qv
Since: 2.26
hashByName
:: (HasCallStack, MonadIO m, IsAddress a) | |
=> a |
|
-> m Word32 | Returns: the named-based hash value for |
A hash function (for HashTable
) that corresponds to
addressEqualByName
, qv
Since: 2.26
isResolved
:: (HasCallStack, MonadIO m, IsAddress a) | |
=> a |
|
-> m Bool | Returns: |
Tests if addr
has already been resolved. Unlike the other
Address
"get" methods, this is safe to call when addr
might
be being resolved in another thread.
new
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> Word32 |
|
-> m Address | Returns: a |
Creates a Address
from name
and port
. The Address
's IP
address may not be available right away; the caller can call
addressResolveAsync
or addressResolveSync
to
force a DNS resolution.
newAny
:: (HasCallStack, MonadIO m) | |
=> AddressFamily |
|
-> Word32 |
|
-> m (Maybe Address) | Returns: the new |
newFromSockaddr
resolveAsync
:: (HasCallStack, MonadIO m, IsAddress a, IsCancellable b) | |
=> a |
|
-> Maybe MainContext |
|
-> Maybe b |
|
-> AddressCallback |
|
-> m () |
Asynchronously resolves the missing half of addr
(its IP address
if it was created with addressNew
, or its hostname if it
was created with addressNewFromSockaddr
or
addressNewAny
.)
If cancellable
is non-Nothing
, it can be used to cancel the
resolution. callback
will still be invoked in this case, with a
status of StatusCancelled
.
It is safe to call this more than once on a given address, from the
same thread, with the same asyncContext
(and doing so will not
result in redundant DNS queries being made). But it is not safe to
call from multiple threads, or with different asyncContexts
, or
mixed with calls to addressResolveSync
.
resolveSync
:: (HasCallStack, MonadIO m, IsAddress a, IsCancellable b) | |
=> a |
|
-> Maybe b |
|
-> m Word32 | Returns: |
Synchronously resolves the missing half of addr
, as with
addressResolveAsync
.
If cancellable
is non-Nothing
, it can be used to cancel the
resolution. addressResolveSync
will then return a status
of StatusCancelled
.
It is safe to call this more than once, even from different
threads, but it is not safe to mix calls to
addressResolveSync
with calls to
addressResolveAsync
on the same address.
Properties
family
No description available in the introspection data.
constructAddressFamily :: (IsAddress o, MonadIO m) => AddressFamily -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “family
” property. This is rarely needed directly, but it is used by new
.
getAddressFamily :: (MonadIO m, IsAddress o) => o -> m AddressFamily Source #
Get the value of the “family
” property.
When overloading is enabled, this is equivalent to
get
address #family
name
No description available in the introspection data.
constructAddressName :: (IsAddress o, MonadIO m) => Text -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “name
” property. This is rarely needed directly, but it is used by new
.
getAddressName :: (MonadIO m, IsAddress o) => o -> m (Maybe Text) Source #
Get the value of the “name
” property.
When overloading is enabled, this is equivalent to
get
address #name
physical
No description available in the introspection data.
getAddressPhysical :: (MonadIO m, IsAddress o) => o -> m (Maybe Text) Source #
Get the value of the “physical
” property.
When overloading is enabled, this is equivalent to
get
address #physical
port
No description available in the introspection data.
constructAddressPort :: (IsAddress o, MonadIO m) => Int32 -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “port
” property. This is rarely needed directly, but it is used by new
.
getAddressPort :: (MonadIO m, IsAddress o) => o -> m Int32 Source #
Get the value of the “port
” property.
When overloading is enabled, this is equivalent to
get
address #port
protocol
No description available in the introspection data.
constructAddressProtocol :: (IsAddress o, MonadIO m) => Text -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “protocol
” property. This is rarely needed directly, but it is used by new
.
getAddressProtocol :: (MonadIO m, IsAddress o) => o -> m (Maybe Text) Source #
Get the value of the “protocol
” property.
When overloading is enabled, this is equivalent to
get
address #protocol
sockaddr
No description available in the introspection data.
constructAddressSockaddr :: (IsAddress o, MonadIO m) => Ptr () -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “sockaddr
” property. This is rarely needed directly, but it is used by new
.
getAddressSockaddr :: (MonadIO m, IsAddress o) => o -> m (Ptr ()) Source #
Get the value of the “sockaddr
” property.
When overloading is enabled, this is equivalent to
get
address #sockaddr