gi-soup-2.4.23: Libsoup bindings
CopyrightWill Thompson Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellNone
LanguageHaskell2010

GI.Soup.Objects.Address

Description

No description available in the introspection data.

Synopsis

Exported types

newtype Address Source #

Memory-managed wrapper type.

Constructors

Address (ManagedPtr Address) 

Instances

Instances details
Eq Address Source # 
Instance details

Defined in GI.Soup.Objects.Address

Methods

(==) :: Address -> Address -> Bool

(/=) :: Address -> Address -> Bool

GObject Address Source # 
Instance details

Defined in GI.Soup.Objects.Address

ManagedPtrNewtype Address Source # 
Instance details

Defined in GI.Soup.Objects.Address

Methods

toManagedPtr :: Address -> ManagedPtr Address

TypedObject Address Source # 
Instance details

Defined in GI.Soup.Objects.Address

Methods

glibType :: IO GType

IsGValue Address Source #

Convert Address to and from GValue with toGValue and fromGValue.

Instance details

Defined in GI.Soup.Objects.Address

Methods

toGValue :: Address -> IO GValue

fromGValue :: GValue -> IO Address

HasParentTypes Address Source # 
Instance details

Defined in GI.Soup.Objects.Address

type ParentTypes Address Source # 
Instance details

Defined in GI.Soup.Objects.Address

type ParentTypes Address = '[Object, SocketConnectable]

class (GObject o, IsDescendantOf Address o) => IsAddress o Source #

Type class for types which can be safely cast to Address, for instance with toAddress.

Instances

Instances details
(GObject o, IsDescendantOf Address o) => IsAddress o Source # 
Instance details

Defined in GI.Soup.Objects.Address

toAddress :: (MonadIO m, IsAddress o) => o -> m Address Source #

Cast to Address, for types for which this is known to be safe. For general casts, use castTo.

Methods

Overloaded methods

equalByIp

addressEqualByIp Source #

Arguments

:: (HasCallStack, MonadIO m, IsAddress a, IsAddress b) 
=> a

addr1: a Address with a resolved IP address

-> b

addr2: another Address with a resolved IP address

-> m Bool

Returns: whether or not addr1 and addr2 have the same IP address.

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

addressEqualByName Source #

Arguments

:: (HasCallStack, MonadIO m, IsAddress a, IsAddress b) 
=> a

addr1: a Address with a resolved name

-> b

addr2: another Address with a resolved name

-> m Bool

Returns: whether or not addr1 and addr2 have the same name

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

addressGetGsockaddr Source #

Arguments

:: (HasCallStack, MonadIO m, IsAddress a) 
=> a

addr: a Address

-> m SocketAddress

Returns: a new SocketAddress

Creates a new SocketAddress corresponding to addr (which is assumed to only have one socket address associated with it).

Since: 2.32

getName

addressGetName Source #

Arguments

:: (HasCallStack, MonadIO m, IsAddress a) 
=> a

addr: a Address

-> m (Maybe Text)

Returns: the hostname, or Nothing if it is not known.

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

addressGetPhysical Source #

Arguments

:: (HasCallStack, MonadIO m, IsAddress a) 
=> a

addr: a Address

-> m (Maybe Text)

Returns: the physical address, or Nothing

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

addressGetPort Source #

Arguments

:: (HasCallStack, MonadIO m, IsAddress a) 
=> a

addr: a Address

-> m Word32

Returns: the port

Returns the port associated with addr.

hashByIp

addressHashByIp Source #

Arguments

:: (HasCallStack, MonadIO m, IsAddress a) 
=> a

addr: a Address

-> m Word32

Returns: the IP-based hash value for addr.

A hash function (for HashTable) that corresponds to addressEqualByIp, qv

Since: 2.26

hashByName

addressHashByName Source #

Arguments

:: (HasCallStack, MonadIO m, IsAddress a) 
=> a

addr: a Address

-> m Word32

Returns: the named-based hash value for addr.

A hash function (for HashTable) that corresponds to addressEqualByName, qv

Since: 2.26

isResolved

addressIsResolved Source #

Arguments

:: (HasCallStack, MonadIO m, IsAddress a) 
=> a

addr: a Address

-> m Bool

Returns: True if addr has been resolved.

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

addressNew Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Text

name: a hostname or physical address

-> Word32

port: a port number

-> m Address

Returns: a Address

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

addressNewAny Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> AddressFamily

family: the address family

-> Word32

port: the port number (usually ADDRESS_ANY_PORT)

-> m (Maybe Address)

Returns: the new Address

Returns a Address corresponding to the "any" address for family (or Nothing if family isn't supported), suitable for using as a listening Socket.

newFromSockaddr

addressNewFromSockaddr Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Ptr ()

sa: a pointer to a sockaddr

-> Int32

len: size of sa

-> m (Maybe Address)

Returns: the new Address

Returns a Address equivalent to sa (or Nothing if sa's address family isn't supported)

resolveAsync

addressResolveAsync Source #

Arguments

:: (HasCallStack, MonadIO m, IsAddress a, IsCancellable b) 
=> a

addr: a Address

-> Maybe MainContext

asyncContext: the MainContext to call callback from

-> Maybe b

cancellable: a Cancellable object, or Nothing

-> AddressCallback

callback: callback to call with the result

-> 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

addressResolveSync Source #

Arguments

:: (HasCallStack, MonadIO m, IsAddress a, IsCancellable b) 
=> a

addr: a Address

-> Maybe b

cancellable: a Cancellable object, or Nothing

-> m Word32

Returns: StatusOk, StatusCantResolve, or StatusCancelled.

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