| Copyright | Will Thompson and Iñaki García Etxebarria |
|---|---|
| License | LGPL-2.1 |
| Maintainer | Iñaki García Etxebarria |
| Safe Haskell | None |
| Language | Haskell2010 |
GI.Gio.Objects.UnixSocketAddress
Description
Support for UNIX-domain (also known as local) sockets, corresponding to
struct sockaddr_un.
UNIX domain sockets are generally visible in the filesystem.
However, some systems support abstract socket names which are not
visible in the filesystem and not affected by the filesystem
permissions, visibility, etc. Currently this is only supported
under Linux. If you attempt to use abstract sockets on other
systems, function calls may return G_IO_ERROR_NOT_SUPPORTED
errors. You can use unixSocketAddressAbstractNamesSupported
to see if abstract names are supported.
Since GLib 2.72, GUnixSocketAddress is available on all platforms. It
requires underlying system support (such as Windows 10 with AF_UNIX) at
run time.
Before GLib 2.72, <gio/gunixsocketaddress.h> belonged to the UNIX-specific
GIO interfaces, thus you had to use the gio-unix-2.0.pc pkg-config file
when using it. This is no longer necessary since GLib 2.72.
Synopsis
- newtype UnixSocketAddress = UnixSocketAddress (ManagedPtr UnixSocketAddress)
- class (GObject o, IsDescendantOf UnixSocketAddress o) => IsUnixSocketAddress o
- toUnixSocketAddress :: (MonadIO m, IsUnixSocketAddress o) => o -> m UnixSocketAddress
- type family ResolveUnixSocketAddressMethod (t :: Symbol) o where ...
- unixSocketAddressAbstractNamesSupported :: (HasCallStack, MonadIO m) => m Bool
- data UnixSocketAddressGetAddressTypeMethodInfo
- unixSocketAddressGetAddressType :: (HasCallStack, MonadIO m, IsUnixSocketAddress a) => a -> m UnixSocketAddressType
- data UnixSocketAddressGetIsAbstractMethodInfo
- unixSocketAddressGetIsAbstract :: (HasCallStack, MonadIO m, IsUnixSocketAddress a) => a -> m Bool
- data UnixSocketAddressGetPathMethodInfo
- unixSocketAddressGetPath :: (HasCallStack, MonadIO m, IsUnixSocketAddress a) => a -> m Text
- data UnixSocketAddressGetPathLenMethodInfo
- unixSocketAddressGetPathLen :: (HasCallStack, MonadIO m, IsUnixSocketAddress a) => a -> m CSize
- unixSocketAddressNew :: (HasCallStack, MonadIO m) => Text -> m UnixSocketAddress
- unixSocketAddressNewAbstract :: (HasCallStack, MonadIO m) => [Int8] -> m UnixSocketAddress
- unixSocketAddressNewWithType :: (HasCallStack, MonadIO m) => [Int8] -> UnixSocketAddressType -> m UnixSocketAddress
- data UnixSocketAddressAbstractPropertyInfo
- constructUnixSocketAddressAbstract :: (IsUnixSocketAddress o, MonadIO m) => Bool -> m (GValueConstruct o)
- getUnixSocketAddressAbstract :: (MonadIO m, IsUnixSocketAddress o) => o -> m Bool
- unixSocketAddressAbstract :: AttrLabelProxy "abstract"
- data UnixSocketAddressAddressTypePropertyInfo
- constructUnixSocketAddressAddressType :: (IsUnixSocketAddress o, MonadIO m) => UnixSocketAddressType -> m (GValueConstruct o)
- getUnixSocketAddressAddressType :: (MonadIO m, IsUnixSocketAddress o) => o -> m UnixSocketAddressType
- unixSocketAddressAddressType :: AttrLabelProxy "addressType"
- data UnixSocketAddressPathPropertyInfo
- constructUnixSocketAddressPath :: (IsUnixSocketAddress o, MonadIO m) => Text -> m (GValueConstruct o)
- getUnixSocketAddressPath :: (MonadIO m, IsUnixSocketAddress o) => o -> m Text
- unixSocketAddressPath :: AttrLabelProxy "path"
- data UnixSocketAddressPathAsArrayPropertyInfo
- constructUnixSocketAddressPathAsArray :: (IsUnixSocketAddress o, MonadIO m) => ByteString -> m (GValueConstruct o)
- getUnixSocketAddressPathAsArray :: (MonadIO m, IsUnixSocketAddress o) => o -> m (Maybe ByteString)
- unixSocketAddressPathAsArray :: AttrLabelProxy "pathAsArray"
Exported types
newtype UnixSocketAddress Source #
Memory-managed wrapper type.
Constructors
| UnixSocketAddress (ManagedPtr UnixSocketAddress) |
Instances
class (GObject o, IsDescendantOf UnixSocketAddress o) => IsUnixSocketAddress o Source #
Type class for types which can be safely cast to UnixSocketAddress, for instance with toUnixSocketAddress.
Instances
| (GObject o, IsDescendantOf UnixSocketAddress o) => IsUnixSocketAddress o Source # | |
Defined in GI.Gio.Objects.UnixSocketAddress | |
toUnixSocketAddress :: (MonadIO m, IsUnixSocketAddress o) => o -> m UnixSocketAddress Source #
Cast to UnixSocketAddress, 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, enumerate, forceFloating, freezeNotify, getv, isFloating, notify, notifyByPspec, proxyEnumerate, ref, refSink, runDispose, stealData, stealQdata, thawNotify, toNative, toString, unref, watchClosure.
Getters
getAddressType, getData, getFamily, getIsAbstract, getNativeSize, getPath, getPathLen, getProperty, getQdata.
Setters
type family ResolveUnixSocketAddressMethod (t :: Symbol) o where ... Source #
Equations
abstractNamesSupported
unixSocketAddressAbstractNamesSupported Source #
Arguments
| :: (HasCallStack, MonadIO m) | |
| => m Bool |
Checks if abstract UNIX domain socket names are supported.
Since: 2.22
getAddressType
data UnixSocketAddressGetAddressTypeMethodInfo Source #
Instances
| (signature ~ m UnixSocketAddressType, MonadIO m, IsUnixSocketAddress a) => OverloadedMethod UnixSocketAddressGetAddressTypeMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.UnixSocketAddress Methods overloadedMethod :: a -> signature # | |
| OverloadedMethodInfo UnixSocketAddressGetAddressTypeMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.UnixSocketAddress Methods | |
unixSocketAddressGetAddressType Source #
Arguments
| :: (HasCallStack, MonadIO m, IsUnixSocketAddress a) | |
| => a |
|
| -> m UnixSocketAddressType | Returns: a |
Gets address's type.
Since: 2.26
getIsAbstract
data UnixSocketAddressGetIsAbstractMethodInfo Source #
Instances
| (signature ~ m Bool, MonadIO m, IsUnixSocketAddress a) => OverloadedMethod UnixSocketAddressGetIsAbstractMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.UnixSocketAddress Methods overloadedMethod :: a -> signature # | |
| OverloadedMethodInfo UnixSocketAddressGetIsAbstractMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.UnixSocketAddress Methods | |
unixSocketAddressGetIsAbstract Source #
Arguments
| :: (HasCallStack, MonadIO m, IsUnixSocketAddress a) | |
| => a |
|
| -> m Bool |
getPath
data UnixSocketAddressGetPathMethodInfo Source #
Instances
| (signature ~ m Text, MonadIO m, IsUnixSocketAddress a) => OverloadedMethod UnixSocketAddressGetPathMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.UnixSocketAddress Methods overloadedMethod :: a -> signature # | |
| OverloadedMethodInfo UnixSocketAddressGetPathMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.UnixSocketAddress Methods | |
unixSocketAddressGetPath Source #
Arguments
| :: (HasCallStack, MonadIO m, IsUnixSocketAddress a) | |
| => a |
|
| -> m Text | Returns: the path for |
Gets address's path, or for abstract sockets the "name".
Guaranteed to be zero-terminated, but an abstract socket
may contain embedded zeros, and thus you should use
unixSocketAddressGetPathLen to get the true length
of this string.
Since: 2.22
getPathLen
data UnixSocketAddressGetPathLenMethodInfo Source #
Instances
| (signature ~ m CSize, MonadIO m, IsUnixSocketAddress a) => OverloadedMethod UnixSocketAddressGetPathLenMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.UnixSocketAddress Methods overloadedMethod :: a -> signature # | |
| OverloadedMethodInfo UnixSocketAddressGetPathLenMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.UnixSocketAddress Methods | |
unixSocketAddressGetPathLen Source #
Arguments
| :: (HasCallStack, MonadIO m, IsUnixSocketAddress a) | |
| => a |
|
| -> m CSize | Returns: the length of the path |
new
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Text |
|
| -> m UnixSocketAddress | Returns: a new |
Creates a new UnixSocketAddress for path.
To create abstract socket addresses, on systems that support that,
use unixSocketAddressNewAbstract.
Since: 2.22
newAbstract
unixSocketAddressNewAbstract Source #
Arguments
| :: (HasCallStack, MonadIO m) | |
| => [Int8] |
|
| -> m UnixSocketAddress | Returns: a new |
Deprecated: Use unixSocketAddressNewWithType.
Creates a new UnixSocketAddressTypeAbstractPadded
UnixSocketAddress for path.
newWithType
unixSocketAddressNewWithType Source #
Arguments
| :: (HasCallStack, MonadIO m) | |
| => [Int8] |
|
| -> UnixSocketAddressType |
|
| -> m UnixSocketAddress | Returns: a new |
Creates a new UnixSocketAddress of type type with name path.
If type is UnixSocketAddressTypePath, this is equivalent to
calling unixSocketAddressNew.
If type is UnixSocketAddressTypeAnonymous, path and pathLen will be
ignored.
If pathType is UnixSocketAddressTypeAbstract, then pathLen
bytes of path will be copied to the socket's path, and only those
bytes will be considered part of the name. (If pathLen is -1,
then path is assumed to be NUL-terminated.) For example, if path
was "test", then calling socketAddressGetNativeSize on the
returned socket would return 7 (2 bytes of overhead, 1 byte for the
abstract-socket indicator byte, and 4 bytes for the name "test").
If pathType is UnixSocketAddressTypeAbstractPadded, then
pathLen bytes of path will be copied to the socket's path, the
rest of the path will be padded with 0 bytes, and the entire
zero-padded buffer will be considered the name. (As above, if
pathLen is -1, then path is assumed to be NUL-terminated.) In
this case, socketAddressGetNativeSize will always return
the full size of a struct sockaddr_un, although
unixSocketAddressGetPathLen will still return just the
length of path.
UnixSocketAddressTypeAbstract is preferred over
UnixSocketAddressTypeAbstractPadded for new programs. Of course,
when connecting to a server created by another process, you must
use the appropriate type corresponding to how that process created
its listening socket.
Since: 2.26
Properties
abstract
Whether or not this is an abstract address
data UnixSocketAddressAbstractPropertyInfo Source #
Instances
constructUnixSocketAddressAbstract :: (IsUnixSocketAddress o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct with valid value for the “abstract” property. This is rarely needed directly, but it is used by new.
getUnixSocketAddressAbstract :: (MonadIO m, IsUnixSocketAddress o) => o -> m Bool Source #
Get the value of the “abstract” property.
When overloading is enabled, this is equivalent to
get unixSocketAddress #abstract
unixSocketAddressAbstract :: AttrLabelProxy "abstract" Source #
addressType
The type of Unix socket address.
Since: 2.22
data UnixSocketAddressAddressTypePropertyInfo Source #
Instances
| AttrInfo UnixSocketAddressAddressTypePropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.UnixSocketAddress Associated Types
Methods attrGet :: AttrBaseTypeConstraint UnixSocketAddressAddressTypePropertyInfo o => o -> IO (AttrGetType UnixSocketAddressAddressTypePropertyInfo) # attrSet :: (AttrBaseTypeConstraint UnixSocketAddressAddressTypePropertyInfo o, AttrSetTypeConstraint UnixSocketAddressAddressTypePropertyInfo b) => o -> b -> IO () # attrClear :: AttrBaseTypeConstraint UnixSocketAddressAddressTypePropertyInfo o => o -> IO () # attrConstruct :: (AttrBaseTypeConstraint UnixSocketAddressAddressTypePropertyInfo o, AttrSetTypeConstraint UnixSocketAddressAddressTypePropertyInfo b) => b -> IO (GValueConstruct o) # attrTransfer :: (AttrBaseTypeConstraint UnixSocketAddressAddressTypePropertyInfo o, AttrTransferTypeConstraint UnixSocketAddressAddressTypePropertyInfo b) => Proxy o -> b -> IO (AttrTransferType UnixSocketAddressAddressTypePropertyInfo) # | |||||||||||||||||||||||||||||||||
| type AttrAllowedOps UnixSocketAddressAddressTypePropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.UnixSocketAddress | |||||||||||||||||||||||||||||||||
| type AttrBaseTypeConstraint UnixSocketAddressAddressTypePropertyInfo Source # | |||||||||||||||||||||||||||||||||
| type AttrGetType UnixSocketAddressAddressTypePropertyInfo Source # | |||||||||||||||||||||||||||||||||
| type AttrLabel UnixSocketAddressAddressTypePropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.UnixSocketAddress | |||||||||||||||||||||||||||||||||
| type AttrOrigin UnixSocketAddressAddressTypePropertyInfo Source # | |||||||||||||||||||||||||||||||||
| type AttrSetTypeConstraint UnixSocketAddressAddressTypePropertyInfo Source # | |||||||||||||||||||||||||||||||||
| type AttrTransferType UnixSocketAddressAddressTypePropertyInfo Source # | |||||||||||||||||||||||||||||||||
| type AttrTransferTypeConstraint UnixSocketAddressAddressTypePropertyInfo Source # | |||||||||||||||||||||||||||||||||
constructUnixSocketAddressAddressType :: (IsUnixSocketAddress o, MonadIO m) => UnixSocketAddressType -> m (GValueConstruct o) Source #
Construct a GValueConstruct with valid value for the “address-type” property. This is rarely needed directly, but it is used by new.
getUnixSocketAddressAddressType :: (MonadIO m, IsUnixSocketAddress o) => o -> m UnixSocketAddressType Source #
Get the value of the “address-type” property.
When overloading is enabled, this is equivalent to
get unixSocketAddress #addressType
unixSocketAddressAddressType :: AttrLabelProxy "addressType" Source #
path
Unix socket path.
Since: 2.22
data UnixSocketAddressPathPropertyInfo Source #
Instances
| AttrInfo UnixSocketAddressPathPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.UnixSocketAddress Associated Types
Methods attrGet :: AttrBaseTypeConstraint UnixSocketAddressPathPropertyInfo o => o -> IO (AttrGetType UnixSocketAddressPathPropertyInfo) # attrSet :: (AttrBaseTypeConstraint UnixSocketAddressPathPropertyInfo o, AttrSetTypeConstraint UnixSocketAddressPathPropertyInfo b) => o -> b -> IO () # attrClear :: AttrBaseTypeConstraint UnixSocketAddressPathPropertyInfo o => o -> IO () # attrConstruct :: (AttrBaseTypeConstraint UnixSocketAddressPathPropertyInfo o, AttrSetTypeConstraint UnixSocketAddressPathPropertyInfo b) => b -> IO (GValueConstruct o) # attrTransfer :: (AttrBaseTypeConstraint UnixSocketAddressPathPropertyInfo o, AttrTransferTypeConstraint UnixSocketAddressPathPropertyInfo b) => Proxy o -> b -> IO (AttrTransferType UnixSocketAddressPathPropertyInfo) # | |||||||||||||||||||||||||||||||||
| type AttrAllowedOps UnixSocketAddressPathPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.UnixSocketAddress | |||||||||||||||||||||||||||||||||
| type AttrBaseTypeConstraint UnixSocketAddressPathPropertyInfo Source # | |||||||||||||||||||||||||||||||||
| type AttrGetType UnixSocketAddressPathPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.UnixSocketAddress | |||||||||||||||||||||||||||||||||
| type AttrLabel UnixSocketAddressPathPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.UnixSocketAddress | |||||||||||||||||||||||||||||||||
| type AttrOrigin UnixSocketAddressPathPropertyInfo Source # | |||||||||||||||||||||||||||||||||
| type AttrSetTypeConstraint UnixSocketAddressPathPropertyInfo Source # | |||||||||||||||||||||||||||||||||
| type AttrTransferType UnixSocketAddressPathPropertyInfo Source # | |||||||||||||||||||||||||||||||||
| type AttrTransferTypeConstraint UnixSocketAddressPathPropertyInfo Source # | |||||||||||||||||||||||||||||||||
constructUnixSocketAddressPath :: (IsUnixSocketAddress o, MonadIO m) => Text -> m (GValueConstruct o) Source #
Construct a GValueConstruct with valid value for the “path” property. This is rarely needed directly, but it is used by new.
getUnixSocketAddressPath :: (MonadIO m, IsUnixSocketAddress o) => o -> m Text Source #
Get the value of the “path” property.
When overloading is enabled, this is equivalent to
get unixSocketAddress #path
unixSocketAddressPath :: AttrLabelProxy "path" Source #
pathAsArray
Unix socket path, as a byte array.
Since: 2.22
data UnixSocketAddressPathAsArrayPropertyInfo Source #
Instances
| AttrInfo UnixSocketAddressPathAsArrayPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.UnixSocketAddress Associated Types
Methods attrGet :: AttrBaseTypeConstraint UnixSocketAddressPathAsArrayPropertyInfo o => o -> IO (AttrGetType UnixSocketAddressPathAsArrayPropertyInfo) # attrSet :: (AttrBaseTypeConstraint UnixSocketAddressPathAsArrayPropertyInfo o, AttrSetTypeConstraint UnixSocketAddressPathAsArrayPropertyInfo b) => o -> b -> IO () # attrClear :: AttrBaseTypeConstraint UnixSocketAddressPathAsArrayPropertyInfo o => o -> IO () # attrConstruct :: (AttrBaseTypeConstraint UnixSocketAddressPathAsArrayPropertyInfo o, AttrSetTypeConstraint UnixSocketAddressPathAsArrayPropertyInfo b) => b -> IO (GValueConstruct o) # attrTransfer :: (AttrBaseTypeConstraint UnixSocketAddressPathAsArrayPropertyInfo o, AttrTransferTypeConstraint UnixSocketAddressPathAsArrayPropertyInfo b) => Proxy o -> b -> IO (AttrTransferType UnixSocketAddressPathAsArrayPropertyInfo) # | |||||||||||||||||||||||||||||||||
| type AttrAllowedOps UnixSocketAddressPathAsArrayPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.UnixSocketAddress | |||||||||||||||||||||||||||||||||
| type AttrBaseTypeConstraint UnixSocketAddressPathAsArrayPropertyInfo Source # | |||||||||||||||||||||||||||||||||
| type AttrGetType UnixSocketAddressPathAsArrayPropertyInfo Source # | |||||||||||||||||||||||||||||||||
| type AttrLabel UnixSocketAddressPathAsArrayPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.UnixSocketAddress | |||||||||||||||||||||||||||||||||
| type AttrOrigin UnixSocketAddressPathAsArrayPropertyInfo Source # | |||||||||||||||||||||||||||||||||
| type AttrSetTypeConstraint UnixSocketAddressPathAsArrayPropertyInfo Source # | |||||||||||||||||||||||||||||||||
| type AttrTransferType UnixSocketAddressPathAsArrayPropertyInfo Source # | |||||||||||||||||||||||||||||||||
| type AttrTransferTypeConstraint UnixSocketAddressPathAsArrayPropertyInfo Source # | |||||||||||||||||||||||||||||||||
constructUnixSocketAddressPathAsArray :: (IsUnixSocketAddress o, MonadIO m) => ByteString -> m (GValueConstruct o) Source #
Construct a GValueConstruct with valid value for the “path-as-array” property. This is rarely needed directly, but it is used by new.
getUnixSocketAddressPathAsArray :: (MonadIO m, IsUnixSocketAddress o) => o -> m (Maybe ByteString) Source #
Get the value of the “path-as-array” property.
When overloading is enabled, this is equivalent to
get unixSocketAddress #pathAsArray
unixSocketAddressPathAsArray :: AttrLabelProxy "pathAsArray" Source #