gi-gio-2.0.19: Gio bindings

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

Contents

- Exported types
- Methods
  - equal
  - getFamily
  - getIsAny
  - getIsLinkLocal
  - getIsLoopback
  - getIsMcGlobal
  - getIsMcLinkLocal
  - getIsMcNodeLocal
  - getIsMcOrgLocal
  - getIsMcSiteLocal
  - getIsMulticast
  - getIsSiteLocal
  - getNativeSize
  - newAny
  - newFromBytes
  - newFromString
  - newLoopback
  - toString
- Properties
  - bytes
  - family
  - isAny
  - isLinkLocal
  - isLoopback
  - isMcGlobal
  - isMcLinkLocal
  - isMcNodeLocal
  - isMcOrgLocal
  - isMcSiteLocal
  - isMulticast
  - isSiteLocal

Description

`InetAddress` represents an IPv4 or IPv6 internet address. Use `resolverLookupByName` or `resolverLookupByNameAsync` to look up the `InetAddress` for a hostname. Use `resolverLookupByAddress` or `resolverLookupByAddressAsync` to look up the hostname for a `InetAddress`.

To actually connect to a remote host, you will need a `InetSocketAddress` (which includes a `InetAddress` as well as a port number).

Synopsis

- newtype InetAddress = InetAddress (ManagedPtr InetAddress)
- class GObject o => IsInetAddress o
- toInetAddress :: (MonadIO m, IsInetAddress o) => o -> m InetAddress
- noInetAddress :: Maybe 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 Word64
- inetAddressNewAny :: (HasCallStack, MonadIO m) => SocketFamily -> m InetAddress
- inetAddressNewFromBytes :: (HasCallStack, MonadIO m) => Ptr Word8 -> SocketFamily -> m InetAddress
- inetAddressNewFromString :: (HasCallStack, MonadIO m) => Text -> m InetAddress
- inetAddressNewLoopback :: (HasCallStack, MonadIO m) => SocketFamily -> m InetAddress
- inetAddressToString :: (HasCallStack, MonadIO m, IsInetAddress a) => a -> m Text
- constructInetAddressBytes :: IsInetAddress o => Ptr () -> IO (GValueConstruct o)
- getInetAddressBytes :: (MonadIO m, IsInetAddress o) => o -> m (Ptr ())
- constructInetAddressFamily :: IsInetAddress o => SocketFamily -> IO (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.

Constructors

InetAddress (ManagedPtr InetAddress) |

Instances

GObject InetAddress Source # |
Instance details Defined in GI.Gio.Objects.InetAddress Methods gobjectType :: InetAddress -> IO GType Source #
IsObject InetAddress Source # |
Instance details Defined in GI.Gio.Objects.InetAddress
IsInetAddress InetAddress Source # |
Instance details Defined in GI.Gio.Objects.InetAddress

class GObject o => IsInetAddress o Source #

Type class for types which can be safely cast to `InetAddress`, for instance with `toInetAddress`.

Instances

(GObject a, (UnknownAncestorError InetAddress a :: Constraint)) => IsInetAddress a Source # |
Instance details Defined in GI.Gio.Objects.InetAddress
IsInetAddress InetAddress Source # |
Instance details 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`.

noInetAddress :: Maybe InetAddress Source #

A convenience alias for `Nothing` :: `Maybe` `InetAddress`.

# Methods

## equal

inetAddressEqual Source #

Arguments

:: (HasCallStack, MonadIO m, IsInetAddress a, IsInetAddress b) |
=> a | `address`: A `InetAddress`.
-> b | `otherAddress`: Another `InetAddress`.
-> m Bool | Returns: `True` if `address` and `otherAddress` are equal, `False` otherwise.

Checks if two `InetAddress` instances are equal, e.g. the same address.

Since: 2.30

## getFamily

inetAddressGetFamily Source #

Arguments

:: (HasCallStack, MonadIO m, IsInetAddress a) |
=> a | `address`: a `InetAddress`
-> m SocketFamily | Returns: `address`'s family

Gets `address`'s family

Since: 2.22

## getIsAny

inetAddressGetIsAny Source #

Arguments

:: (HasCallStack, MonadIO m, IsInetAddress a) |
=> a | `address`: a `InetAddress`
-> m Bool | Returns: `True` if `address` is the "any" address for its family.

Tests whether `address` is the "any" address for its family.

Since: 2.22

## getIsLinkLocal

inetAddressGetIsLinkLocal Source #

Arguments

:: (HasCallStack, MonadIO m, IsInetAddress a) |
=> a | `address`: a `InetAddress`
-> m Bool | Returns: `True` if `address` is a link-local address.

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 #

Arguments

:: (HasCallStack, MonadIO m, IsInetAddress a) |
=> a | `address`: a `InetAddress`
-> m Bool | Returns: `True` if `address` is the loopback address for its family.

Tests whether `address` is the loopback address for its family.

Since: 2.22

## getIsMcGlobal

inetAddressGetIsMcGlobal Source #

Arguments

:: (HasCallStack, MonadIO m, IsInetAddress a) |
=> a | `address`: a `InetAddress`
-> m Bool | Returns: `True` if `address` is a global multicast address.

Tests whether `address` is a global multicast address.

Since: 2.22

## getIsMcLinkLocal

inetAddressGetIsMcLinkLocal Source #

Arguments

:: (HasCallStack, MonadIO m, IsInetAddress a) |
=> a | `address`: a `InetAddress`
-> m Bool | Returns: `True` if `address` is a link-local multicast address.

Tests whether `address` is a link-local multicast address.

Since: 2.22

## getIsMcNodeLocal

inetAddressGetIsMcNodeLocal Source #

Arguments

:: (HasCallStack, MonadIO m, IsInetAddress a) |
=> a | `address`: a `InetAddress`
-> m Bool | Returns: `True` if `address` is a node-local multicast address.

Tests whether `address` is a node-local multicast address.

Since: 2.22

## getIsMcOrgLocal

inetAddressGetIsMcOrgLocal Source #

Arguments

:: (HasCallStack, MonadIO m, IsInetAddress a) |
=> a | `address`: a `InetAddress`
-> m Bool | Returns: `True` if `address` is an organization-local multicast address.

Tests whether `address` is an organization-local multicast address.

Since: 2.22

## getIsMcSiteLocal

inetAddressGetIsMcSiteLocal Source #

Arguments

:: (HasCallStack, MonadIO m, IsInetAddress a) |
=> a | `address`: a `InetAddress`
-> m Bool | Returns: `True` if `address` is a site-local multicast address.

Tests whether `address` is a site-local multicast address.

Since: 2.22

## getIsMulticast

inetAddressGetIsMulticast Source #

Arguments

:: (HasCallStack, MonadIO m, IsInetAddress a) |
=> a | `address`: a `InetAddress`
-> m Bool | Returns: `True` if `address` is a multicast address.

Tests whether `address` is a multicast address.

Since: 2.22

## getIsSiteLocal

inetAddressGetIsSiteLocal Source #

Arguments

:: (HasCallStack, MonadIO m, IsInetAddress a) |
=> a | `address`: a `InetAddress`
-> m Bool | Returns: `True` if `address` is a site-local address.

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 #

Arguments

:: (HasCallStack, MonadIO m, IsInetAddress a) |
=> a | `address`: a `InetAddress`
-> m Word64 | Returns: the number of bytes used for the native version of `address`.

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

inetAddressNewAny Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> SocketFamily | `family`: the address family
-> m InetAddress | Returns: a new `InetAddress` corresponding to the "any" address for `family`. Free the returned object with `objectUnref`.

Creates a `InetAddress` for the "any" address (unassigned/"don't care") for `family`.

Since: 2.22

## newFromBytes

inetAddressNewFromBytes Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Ptr Word8 | `bytes`: raw address data
-> SocketFamily | `family`: the address family of `bytes`
-> m InetAddress | Returns: a new `InetAddress` corresponding to `family` and `bytes`. Free the returned object with `objectUnref`.

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 #

Arguments

:: (HasCallStack, MonadIO m) |
=> Text | `string`: a string representation of an IP address
-> m InetAddress | Returns: a new `InetAddress` corresponding to `string`, or `Nothing` if `string` could not be parsed. Free the returned object with `objectUnref`.

Parses `string` as an IP address and creates a new `InetAddress`.

Since: 2.22

## newLoopback

inetAddressNewLoopback Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> SocketFamily | `family`: the address family
-> m InetAddress | Returns: a new `InetAddress` corresponding to the loopback address for `family`. Free the returned object with `objectUnref`.

Creates a `InetAddress` for the loopback address for `family`.

Since: 2.22

## toString

inetAddressToString Source #

Arguments

:: (HasCallStack, MonadIO m, IsInetAddress a) |
=> a | `address`: a `InetAddress`
-> m Text | Returns: a representation of `address` as a string, which should be freed after use.

Converts `address` to string form.

Since: 2.22

# Properties

## bytes

No description available in the introspection data.

constructInetAddressBytes :: IsInetAddress o => Ptr () -> IO (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

No description available in the introspection data.

constructInetAddressFamily :: IsInetAddress o => SocketFamily -> IO (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