gi-gio-2.0.32: Gio bindings

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

GI.Gio.Objects.SocketAddress

Contents

- Exported types
- Methods
  - getFamily
  - getNativeSize
  - newFromNative
  - toNative
- Properties
  - family

Description

`GSocketAddress` is the equivalent of `struct sockaddr`) and its subtypes in the BSD sockets API. This is an abstract class; use `InetSocketAddress` for internet sockets, or `UnixSocketAddress` for UNIX domain sockets.

Synopsis

- newtype SocketAddress = SocketAddress (ManagedPtr SocketAddress)
- class (GObject o, IsDescendantOf SocketAddress o) => IsSocketAddress o
- toSocketAddress :: (MonadIO m, IsSocketAddress o) => o -> m SocketAddress
- socketAddressGetFamily :: (HasCallStack, MonadIO m, IsSocketAddress a) => a -> m SocketFamily
- socketAddressGetNativeSize :: (HasCallStack, MonadIO m, IsSocketAddress a) => a -> m Int64
- socketAddressNewFromNative :: (HasCallStack, MonadIO m) => Ptr () -> Word64 -> m SocketAddress
- socketAddressToNative :: (HasCallStack, MonadIO m, IsSocketAddress a) => a -> Ptr () -> Word64 -> m ()
- getSocketAddressFamily :: (MonadIO m, IsSocketAddress o) => o -> m SocketFamily

# Exported types

newtype SocketAddress Source #

Memory-managed wrapper type.

Constructors

SocketAddress (ManagedPtr SocketAddress) |

#### Instances

Instances details

Eq SocketAddress Source # |
Instance details Defined in GI.Gio.Objects.SocketAddress Methods (==) :: SocketAddress -> SocketAddress -> Bool Source # (/=) :: SocketAddress -> SocketAddress -> Bool Source #
GObject SocketAddress Source # |
Instance details Defined in GI.Gio.Objects.SocketAddress
ManagedPtrNewtype SocketAddress Source # |
Instance details Defined in GI.Gio.Objects.SocketAddress Methods toManagedPtr :: SocketAddress -> ManagedPtr SocketAddress Source #
TypedObject SocketAddress Source # |
Instance details Defined in GI.Gio.Objects.SocketAddress Methods glibType :: IO GType Source #
HasParentTypes SocketAddress Source # |
Instance details Defined in GI.Gio.Objects.SocketAddress
IsGValue (Maybe SocketAddress) Source # | Convert `SocketAddress` to and from `GValue`. See `toGValue` and `fromGValue`.
Instance details Defined in GI.Gio.Objects.SocketAddress Methods gvalueGType_ :: IO GType Source # gvalueSet_ :: Ptr GValue -> Maybe SocketAddress -> IO () Source # gvalueGet_ :: Ptr GValue -> IO (Maybe SocketAddress) Source #
type ParentTypes SocketAddress Source # |
Instance details Defined in GI.Gio.Objects.SocketAddress type ParentTypes SocketAddress = '[Object, SocketConnectable]

class (GObject o, IsDescendantOf SocketAddress o) => IsSocketAddress o Source #

Type class for types which can be safely cast to `SocketAddress`, for instance with `toSocketAddress`.

#### Instances

Instances details

(GObject o, IsDescendantOf SocketAddress o) => IsSocketAddress o Source # |
Instance details Defined in GI.Gio.Objects.SocketAddress

toSocketAddress :: (MonadIO m, IsSocketAddress o) => o -> m SocketAddress Source #

Cast to `SocketAddress`, 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

Expand

#### Methods

bindProperty, bindPropertyFull, enumerate, forceFloating, freezeNotify, getv, isFloating, notify, notifyByPspec, proxyEnumerate, ref, refSink, runDispose, stealData, stealQdata, thawNotify, toNative, toString, unref, watchClosure.

#### Getters

getData, getFamily, getNativeSize, getProperty, getQdata.

#### Setters

setData, setDataFull, setProperty.

## getFamily

socketAddressGetFamily Source #

Arguments

:: (HasCallStack, MonadIO m, IsSocketAddress a) |
=> a | `address`: a `SocketAddress`
-> m SocketFamily | Returns: the socket family type of `address`

Gets the socket family type of `address`.

Since: 2.22

## getNativeSize

socketAddressGetNativeSize Source #

Arguments

:: (HasCallStack, MonadIO m, IsSocketAddress a) |
=> a | `address`: a `SocketAddress`
-> m Int64 | Returns: the size of the native struct sockaddr that `address` represents

Gets the size of `address`'s native struct sockaddr. You can use this to allocate memory to pass to `socketAddressToNative`.

Since: 2.22

## newFromNative

socketAddressNewFromNative Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Ptr () | `native`: a pointer to a struct sockaddr
-> Word64 | `len`: the size of the memory location pointed to by `native`
-> m SocketAddress | Returns: a new `SocketAddress` if `native` could successfully be converted, otherwise `Nothing`

Creates a `SocketAddress` subclass corresponding to the native struct sockaddr `native`.

Since: 2.22

## toNative

socketAddressToNative Source #

Arguments

:: (HasCallStack, MonadIO m, IsSocketAddress a) |
=> a | `address`: a `SocketAddress`
-> Ptr () | `dest`: a pointer to a memory location that will contain the native struct sockaddr
-> Word64 | `destlen`: the size of `dest`. Must be at least as large as `socketAddressGetNativeSize`
-> m () | (Can throw `GError`)

Converts a `SocketAddress` to a native struct sockaddr, which can be passed to low-level functions like `connect()` or `bind()`.

If not enough space is available, a `IOErrorEnumNoSpace` error is returned. If the address type is not known on the system then a `IOErrorEnumNotSupported` error is returned.

Since: 2.22

# Properties

## family

The family of the socket address.

Since: 2.22

getSocketAddressFamily :: (MonadIO m, IsSocketAddress o) => o -> m SocketFamily Source #

Get the value of the “`family`” property. When overloading is enabled, this is equivalent to

    get socketAddress #family