Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | None |
Language | Haskell2010 |
GInetAddress
represents an IPv4 or IPv6 internet address. Use
resolverLookupByName
or
resolverLookupByNameAsync
to look up the GInetAddress
for
a hostname. Use resolverLookupByAddress
or
resolverLookupByAddressAsync
to look up the hostname for a
GInetAddress
.
To actually connect to a remote host, you will need a
InetSocketAddress
(which includes a GInetAddress
as well as a
port number).
Synopsis
- newtype InetAddress = InetAddress (ManagedPtr InetAddress)
- class (GObject o, IsDescendantOf InetAddress o) => IsInetAddress o
- toInetAddress :: (MonadIO m, IsInetAddress o) => o -> m InetAddress
- inetAddressEqual :: (HasCallStack, MonadIO m, IsInetAddress a, IsInetAddress b) => a -> b -> m Bool
- inetAddressGetFamily :: (HasCallStack, MonadIO m, IsInetAddress a) => a -> m SocketFamily
- inetAddressGetIsAny :: (HasCallStack, MonadIO m, IsInetAddress a) => a -> m Bool
- inetAddressGetIsLinkLocal :: (HasCallStack, MonadIO m, IsInetAddress a) => a -> m Bool
- inetAddressGetIsLoopback :: (HasCallStack, MonadIO m, IsInetAddress a) => a -> m Bool
- inetAddressGetIsMcGlobal :: (HasCallStack, MonadIO m, IsInetAddress a) => a -> m Bool
- inetAddressGetIsMcLinkLocal :: (HasCallStack, MonadIO m, IsInetAddress a) => a -> m Bool
- inetAddressGetIsMcNodeLocal :: (HasCallStack, MonadIO m, IsInetAddress a) => a -> m Bool
- inetAddressGetIsMcOrgLocal :: (HasCallStack, MonadIO m, IsInetAddress a) => a -> m Bool
- inetAddressGetIsMcSiteLocal :: (HasCallStack, MonadIO m, IsInetAddress a) => a -> m Bool
- inetAddressGetIsMulticast :: (HasCallStack, MonadIO m, IsInetAddress a) => a -> m Bool
- inetAddressGetIsSiteLocal :: (HasCallStack, MonadIO m, IsInetAddress a) => a -> m Bool
- inetAddressGetNativeSize :: (HasCallStack, MonadIO m, IsInetAddress a) => a -> m CSize
- inetAddressNewAny :: (HasCallStack, MonadIO m) => SocketFamily -> m InetAddress
- inetAddressNewFromBytes :: (HasCallStack, MonadIO m) => Ptr Word8 -> SocketFamily -> m InetAddress
- inetAddressNewFromString :: (HasCallStack, MonadIO m) => Text -> m (Maybe InetAddress)
- inetAddressNewLoopback :: (HasCallStack, MonadIO m) => SocketFamily -> m InetAddress
- inetAddressToString :: (HasCallStack, MonadIO m, IsInetAddress a) => a -> m Text
- constructInetAddressBytes :: (IsInetAddress o, MonadIO m) => Ptr () -> m (GValueConstruct o)
- getInetAddressBytes :: (MonadIO m, IsInetAddress o) => o -> m (Ptr ())
- constructInetAddressFamily :: (IsInetAddress o, MonadIO m) => SocketFamily -> m (GValueConstruct o)
- getInetAddressFamily :: (MonadIO m, IsInetAddress o) => o -> m SocketFamily
- getInetAddressIsAny :: (MonadIO m, IsInetAddress o) => o -> m Bool
- getInetAddressIsLinkLocal :: (MonadIO m, IsInetAddress o) => o -> m Bool
- getInetAddressIsLoopback :: (MonadIO m, IsInetAddress o) => o -> m Bool
- getInetAddressIsMcGlobal :: (MonadIO m, IsInetAddress o) => o -> m Bool
- getInetAddressIsMcLinkLocal :: (MonadIO m, IsInetAddress o) => o -> m Bool
- getInetAddressIsMcNodeLocal :: (MonadIO m, IsInetAddress o) => o -> m Bool
- getInetAddressIsMcOrgLocal :: (MonadIO m, IsInetAddress o) => o -> m Bool
- getInetAddressIsMcSiteLocal :: (MonadIO m, IsInetAddress o) => o -> m Bool
- getInetAddressIsMulticast :: (MonadIO m, IsInetAddress o) => o -> m Bool
- getInetAddressIsSiteLocal :: (MonadIO m, IsInetAddress o) => o -> m Bool
Exported types
newtype InetAddress Source #
Memory-managed wrapper type.
Instances
Eq InetAddress Source # | |
Defined in GI.Gio.Objects.InetAddress (==) :: InetAddress -> InetAddress -> Bool # (/=) :: InetAddress -> InetAddress -> Bool # | |
GObject InetAddress Source # | |
Defined in GI.Gio.Objects.InetAddress | |
ManagedPtrNewtype InetAddress Source # | |
Defined in GI.Gio.Objects.InetAddress | |
TypedObject InetAddress Source # | |
Defined in GI.Gio.Objects.InetAddress | |
HasParentTypes InetAddress Source # | |
Defined in GI.Gio.Objects.InetAddress | |
IsGValue (Maybe InetAddress) Source # | Convert |
Defined in GI.Gio.Objects.InetAddress gvalueGType_ :: IO GType # gvalueSet_ :: Ptr GValue -> Maybe InetAddress -> IO () # gvalueGet_ :: Ptr GValue -> IO (Maybe InetAddress) # | |
type ParentTypes InetAddress Source # | |
Defined in GI.Gio.Objects.InetAddress type ParentTypes InetAddress = '[Object] |
class (GObject o, IsDescendantOf InetAddress o) => IsInetAddress o Source #
Type class for types which can be safely cast to InetAddress
, for instance with toInetAddress
.
Instances
(GObject o, IsDescendantOf InetAddress o) => IsInetAddress o Source # | |
Defined in GI.Gio.Objects.InetAddress |
toInetAddress :: (MonadIO m, IsInetAddress o) => o -> m InetAddress Source #
Cast to InetAddress
, for types for which this is known to be safe. For general casts, use castTo
.
Methods
Click to display all available methods, including inherited ones
Methods
bindProperty, bindPropertyFull, equal, forceFloating, freezeNotify, getv, isFloating, notify, notifyByPspec, ref, refSink, runDispose, stealData, stealQdata, thawNotify, toString, unref, watchClosure.
Getters
getData, getFamily, getIsAny, getIsLinkLocal, getIsLoopback, getIsMcGlobal, getIsMcLinkLocal, getIsMcNodeLocal, getIsMcOrgLocal, getIsMcSiteLocal, getIsMulticast, getIsSiteLocal, getNativeSize, getProperty, getQdata.
Setters
equal
:: (HasCallStack, MonadIO m, IsInetAddress a, IsInetAddress b) | |
=> a |
|
-> b |
|
-> m Bool | Returns: |
Checks if two InetAddress
instances are equal, e.g. the same address.
Since: 2.30
getFamily
:: (HasCallStack, MonadIO m, IsInetAddress a) | |
=> a |
|
-> m SocketFamily | Returns: |
Gets address
's family
Since: 2.22
getIsAny
:: (HasCallStack, MonadIO m, IsInetAddress a) | |
=> a |
|
-> m Bool | Returns: |
Tests whether address
is the "any" address for its family.
Since: 2.22
getIsLinkLocal
inetAddressGetIsLinkLocal Source #
:: (HasCallStack, MonadIO m, IsInetAddress a) | |
=> a |
|
-> m Bool | Returns: |
Tests whether address
is a link-local address (that is, if it
identifies a host on a local network that is not connected to the
Internet).
Since: 2.22
getIsLoopback
inetAddressGetIsLoopback Source #
:: (HasCallStack, MonadIO m, IsInetAddress a) | |
=> a |
|
-> m Bool | Returns: |
Tests whether address
is the loopback address for its family.
Since: 2.22
getIsMcGlobal
inetAddressGetIsMcGlobal Source #
:: (HasCallStack, MonadIO m, IsInetAddress a) | |
=> a |
|
-> m Bool | Returns: |
Tests whether address
is a global multicast address.
Since: 2.22
getIsMcLinkLocal
inetAddressGetIsMcLinkLocal Source #
:: (HasCallStack, MonadIO m, IsInetAddress a) | |
=> a |
|
-> m Bool | Returns: |
Tests whether address
is a link-local multicast address.
Since: 2.22
getIsMcNodeLocal
inetAddressGetIsMcNodeLocal Source #
:: (HasCallStack, MonadIO m, IsInetAddress a) | |
=> a |
|
-> m Bool | Returns: |
Tests whether address
is a node-local multicast address.
Since: 2.22
getIsMcOrgLocal
inetAddressGetIsMcOrgLocal Source #
:: (HasCallStack, MonadIO m, IsInetAddress a) | |
=> a |
|
-> m Bool | Returns: |
Tests whether address
is an organization-local multicast address.
Since: 2.22
getIsMcSiteLocal
inetAddressGetIsMcSiteLocal Source #
:: (HasCallStack, MonadIO m, IsInetAddress a) | |
=> a |
|
-> m Bool | Returns: |
Tests whether address
is a site-local multicast address.
Since: 2.22
getIsMulticast
inetAddressGetIsMulticast Source #
:: (HasCallStack, MonadIO m, IsInetAddress a) | |
=> a |
|
-> m Bool | Returns: |
Tests whether address
is a multicast address.
Since: 2.22
getIsSiteLocal
inetAddressGetIsSiteLocal Source #
:: (HasCallStack, MonadIO m, IsInetAddress a) | |
=> a |
|
-> m Bool | Returns: |
Tests whether address
is a site-local address such as 10.0.0.1
(that is, the address identifies a host on a local network that can
not be reached directly from the Internet, but which may have
outgoing Internet connectivity via a NAT or firewall).
Since: 2.22
getNativeSize
inetAddressGetNativeSize Source #
:: (HasCallStack, MonadIO m, IsInetAddress a) | |
=> a |
|
-> m CSize | Returns: the number of bytes used for the native version of |
Gets the size of the native raw binary address for address
. This
is the size of the data that you get from g_inet_address_to_bytes()
.
Since: 2.22
newAny
:: (HasCallStack, MonadIO m) | |
=> SocketFamily |
|
-> m InetAddress | Returns: a new |
Creates a InetAddress
for the "any" address (unassigned/"don't
care") for family
.
Since: 2.22
newFromBytes
inetAddressNewFromBytes Source #
:: (HasCallStack, MonadIO m) | |
=> Ptr Word8 |
|
-> SocketFamily |
|
-> m InetAddress | Returns: a new |
Creates a new InetAddress
from the given family
and bytes
.
bytes
should be 4 bytes for SocketFamilyIpv4
and 16 bytes for
SocketFamilyIpv6
.
Since: 2.22
newFromString
inetAddressNewFromString Source #
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m (Maybe InetAddress) | Returns: a new |
Parses string
as an IP address and creates a new InetAddress
.
Since: 2.22
newLoopback
inetAddressNewLoopback Source #
:: (HasCallStack, MonadIO m) | |
=> SocketFamily |
|
-> m InetAddress | Returns: a new |
Creates a InetAddress
for the loopback address for family
.
Since: 2.22
toString
:: (HasCallStack, MonadIO m, IsInetAddress a) | |
=> a |
|
-> m Text | Returns: a representation of |
Converts address
to string form.
Since: 2.22
Properties
bytes
The raw address data.
Since: 2.22
constructInetAddressBytes :: (IsInetAddress o, MonadIO m) => Ptr () -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “bytes
” property. This is rarely needed directly, but it is used by new
.
getInetAddressBytes :: (MonadIO m, IsInetAddress o) => o -> m (Ptr ()) Source #
Get the value of the “bytes
” property.
When overloading is enabled, this is equivalent to
get
inetAddress #bytes
family
The address family (IPv4 or IPv6).
Since: 2.22
constructInetAddressFamily :: (IsInetAddress o, MonadIO m) => SocketFamily -> 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
.
getInetAddressFamily :: (MonadIO m, IsInetAddress o) => o -> m SocketFamily Source #
Get the value of the “family
” property.
When overloading is enabled, this is equivalent to
get
inetAddress #family
isAny
Whether this is the "any" address for its family.
See inetAddressGetIsAny
.
Since: 2.22
getInetAddressIsAny :: (MonadIO m, IsInetAddress o) => o -> m Bool Source #
Get the value of the “is-any
” property.
When overloading is enabled, this is equivalent to
get
inetAddress #isAny
isLinkLocal
Whether this is a link-local address.
See inetAddressGetIsLinkLocal
.
Since: 2.22
getInetAddressIsLinkLocal :: (MonadIO m, IsInetAddress o) => o -> m Bool Source #
Get the value of the “is-link-local
” property.
When overloading is enabled, this is equivalent to
get
inetAddress #isLinkLocal
isLoopback
Whether this is the loopback address for its family.
See inetAddressGetIsLoopback
.
Since: 2.22
getInetAddressIsLoopback :: (MonadIO m, IsInetAddress o) => o -> m Bool Source #
Get the value of the “is-loopback
” property.
When overloading is enabled, this is equivalent to
get
inetAddress #isLoopback
isMcGlobal
Whether this is a global multicast address.
See inetAddressGetIsMcGlobal
.
Since: 2.22
getInetAddressIsMcGlobal :: (MonadIO m, IsInetAddress o) => o -> m Bool Source #
Get the value of the “is-mc-global
” property.
When overloading is enabled, this is equivalent to
get
inetAddress #isMcGlobal
isMcLinkLocal
Whether this is a link-local multicast address.
See inetAddressGetIsMcLinkLocal
.
Since: 2.22
getInetAddressIsMcLinkLocal :: (MonadIO m, IsInetAddress o) => o -> m Bool Source #
Get the value of the “is-mc-link-local
” property.
When overloading is enabled, this is equivalent to
get
inetAddress #isMcLinkLocal
isMcNodeLocal
Whether this is a node-local multicast address.
See inetAddressGetIsMcNodeLocal
.
Since: 2.22
getInetAddressIsMcNodeLocal :: (MonadIO m, IsInetAddress o) => o -> m Bool Source #
Get the value of the “is-mc-node-local
” property.
When overloading is enabled, this is equivalent to
get
inetAddress #isMcNodeLocal
isMcOrgLocal
Whether this is an organization-local multicast address.
See inetAddressGetIsMcOrgLocal
.
Since: 2.22
getInetAddressIsMcOrgLocal :: (MonadIO m, IsInetAddress o) => o -> m Bool Source #
Get the value of the “is-mc-org-local
” property.
When overloading is enabled, this is equivalent to
get
inetAddress #isMcOrgLocal
isMcSiteLocal
Whether this is a site-local multicast address.
See inetAddressGetIsMcSiteLocal
.
Since: 2.22
getInetAddressIsMcSiteLocal :: (MonadIO m, IsInetAddress o) => o -> m Bool Source #
Get the value of the “is-mc-site-local
” property.
When overloading is enabled, this is equivalent to
get
inetAddress #isMcSiteLocal
isMulticast
Whether this is a multicast address.
See inetAddressGetIsMulticast
.
Since: 2.22
getInetAddressIsMulticast :: (MonadIO m, IsInetAddress o) => o -> m Bool Source #
Get the value of the “is-multicast
” property.
When overloading is enabled, this is equivalent to
get
inetAddress #isMulticast
isSiteLocal
Whether this is a site-local address.
See inetAddressGetIsLoopback
.
Since: 2.22
getInetAddressIsSiteLocal :: (MonadIO m, IsInetAddress o) => o -> m Bool Source #
Get the value of the “is-site-local
” property.
When overloading is enabled, this is equivalent to
get
inetAddress #isSiteLocal