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 |
- newtype Address = Address (ManagedPtr Address)
- class GObject o => IsAddress o
- toAddress :: IsAddress o => o -> IO Address
- noAddress :: Maybe Address
- data AddressEqualByIpMethodInfo
- addressEqualByIp :: (HasCallStack, MonadIO m, IsAddress a, IsAddress b) => a -> b -> m Bool
- data AddressEqualByNameMethodInfo
- addressEqualByName :: (HasCallStack, MonadIO m, IsAddress a, IsAddress b) => a -> b -> m Bool
- data AddressGetGsockaddrMethodInfo
- addressGetGsockaddr :: (HasCallStack, MonadIO m, IsAddress a) => a -> m SocketAddress
- data AddressGetNameMethodInfo
- addressGetName :: (HasCallStack, MonadIO m, IsAddress a) => a -> m (Maybe Text)
- data AddressGetPhysicalMethodInfo
- addressGetPhysical :: (HasCallStack, MonadIO m, IsAddress a) => a -> m (Maybe Text)
- data AddressGetPortMethodInfo
- addressGetPort :: (HasCallStack, MonadIO m, IsAddress a) => a -> m Word32
- data AddressHashByIpMethodInfo
- addressHashByIp :: (HasCallStack, MonadIO m, IsAddress a) => a -> m Word32
- data AddressHashByNameMethodInfo
- addressHashByName :: (HasCallStack, MonadIO m, IsAddress a) => a -> m Word32
- data AddressIsResolvedMethodInfo
- 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)
- data AddressResolveAsyncMethodInfo
- addressResolveAsync :: (HasCallStack, MonadIO m, IsAddress a, IsCancellable b) => a -> Maybe MainContext -> Maybe b -> AddressCallback -> m ()
- data AddressResolveSyncMethodInfo
- addressResolveSync :: (HasCallStack, MonadIO m, IsAddress a, IsCancellable b) => a -> Maybe b -> m Word32
- data AddressFamilyPropertyInfo
- addressFamily :: AttrLabelProxy "family"
- constructAddressFamily :: IsAddress o => AddressFamily -> IO (GValueConstruct o)
- getAddressFamily :: (MonadIO m, IsAddress o) => o -> m AddressFamily
- data AddressNamePropertyInfo
- addressName :: AttrLabelProxy "name"
- constructAddressName :: IsAddress o => Text -> IO (GValueConstruct o)
- getAddressName :: (MonadIO m, IsAddress o) => o -> m (Maybe Text)
- data AddressPhysicalPropertyInfo
- addressPhysical :: AttrLabelProxy "physical"
- getAddressPhysical :: (MonadIO m, IsAddress o) => o -> m (Maybe Text)
- data AddressPortPropertyInfo
- addressPort :: AttrLabelProxy "port"
- constructAddressPort :: IsAddress o => Int32 -> IO (GValueConstruct o)
- getAddressPort :: (MonadIO m, IsAddress o) => o -> m Int32
- data AddressProtocolPropertyInfo
- addressProtocol :: AttrLabelProxy "protocol"
- constructAddressProtocol :: IsAddress o => Text -> IO (GValueConstruct o)
- getAddressProtocol :: (MonadIO m, IsAddress o) => o -> m (Maybe Text)
- data AddressSockaddrPropertyInfo
- addressSockaddr :: AttrLabelProxy "sockaddr"
- constructAddressSockaddr :: IsAddress o => Ptr () -> IO (GValueConstruct o)
- getAddressSockaddr :: (MonadIO m, IsAddress o) => o -> m (Ptr ())
Exported types
GObject Address Source # | |
IsSocketConnectable Address Source # | |
IsObject Address Source # | |
IsAddress Address Source # | |
((~) * info (ResolveAddressMethod t Address), MethodInfo * info Address p) => IsLabel t (Address -> p) Source # | |
((~) * info (ResolveAddressMethod t Address), MethodInfo * info Address p) => IsLabelProxy t (Address -> p) Source # | |
HasAttributeList * Address Source # | |
type AttributeList Address Source # | |
type SignalList Address Source # | |
Methods
equalByIp
data AddressEqualByIpMethodInfo Source #
((~) * signature (b -> m Bool), MonadIO m, IsAddress a, IsAddress b) => MethodInfo * AddressEqualByIpMethodInfo a signature Source # | |
:: (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
data AddressEqualByNameMethodInfo Source #
((~) * signature (b -> m Bool), MonadIO m, IsAddress a, IsAddress b) => MethodInfo * AddressEqualByNameMethodInfo a signature Source # | |
:: (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
data AddressGetGsockaddrMethodInfo Source #
((~) * signature (m SocketAddress), MonadIO m, IsAddress a) => MethodInfo * AddressGetGsockaddrMethodInfo a signature Source # | |
:: (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
data AddressGetNameMethodInfo Source #
((~) * signature (m (Maybe Text)), MonadIO m, IsAddress a) => MethodInfo * AddressGetNameMethodInfo a signature Source # | |
:: (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
data AddressGetPhysicalMethodInfo Source #
((~) * signature (m (Maybe Text)), MonadIO m, IsAddress a) => MethodInfo * AddressGetPhysicalMethodInfo a signature Source # | |
:: (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
data AddressGetPortMethodInfo Source #
((~) * signature (m Word32), MonadIO m, IsAddress a) => MethodInfo * AddressGetPortMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsAddress a) | |
=> a |
|
-> m Word32 | Returns: the port |
Returns the port associated with addr
.
hashByIp
data AddressHashByIpMethodInfo Source #
((~) * signature (m Word32), MonadIO m, IsAddress a) => MethodInfo * AddressHashByIpMethodInfo a signature Source # | |
:: (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
data AddressHashByNameMethodInfo Source #
((~) * signature (m Word32), MonadIO m, IsAddress a) => MethodInfo * AddressHashByNameMethodInfo a signature Source # | |
:: (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
data AddressIsResolvedMethodInfo Source #
((~) * signature (m Bool), MonadIO m, IsAddress a) => MethodInfo * AddressIsResolvedMethodInfo a signature Source # | |
:: (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 'GI.Soup.Objects.Address.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
data AddressResolveAsyncMethodInfo Source #
((~) * signature (Maybe MainContext -> Maybe b -> AddressCallback -> m ()), MonadIO m, IsAddress a, IsCancellable b) => MethodInfo * AddressResolveAsyncMethodInfo a signature Source # | |
:: (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
data AddressResolveSyncMethodInfo Source #
((~) * signature (Maybe b -> m Word32), MonadIO m, IsAddress a, IsCancellable b) => MethodInfo * AddressResolveSyncMethodInfo a signature Source # | |
:: (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
data AddressFamilyPropertyInfo Source #
addressFamily :: AttrLabelProxy "family" Source #
constructAddressFamily :: IsAddress o => AddressFamily -> IO (GValueConstruct o) Source #
getAddressFamily :: (MonadIO m, IsAddress o) => o -> m AddressFamily Source #
name
data AddressNamePropertyInfo Source #
addressName :: AttrLabelProxy "name" Source #
constructAddressName :: IsAddress o => Text -> IO (GValueConstruct o) Source #
physical
data AddressPhysicalPropertyInfo Source #
addressPhysical :: AttrLabelProxy "physical" Source #
port
data AddressPortPropertyInfo Source #
addressPort :: AttrLabelProxy "port" Source #
constructAddressPort :: IsAddress o => Int32 -> IO (GValueConstruct o) Source #
protocol
data AddressProtocolPropertyInfo Source #
addressProtocol :: AttrLabelProxy "protocol" Source #
constructAddressProtocol :: IsAddress o => Text -> IO (GValueConstruct o) Source #
sockaddr
data AddressSockaddrPropertyInfo Source #
addressSockaddr :: AttrLabelProxy "sockaddr" Source #
constructAddressSockaddr :: IsAddress o => Ptr () -> IO (GValueConstruct o) Source #