gi-gio-2.0.12: Gio bindings

CopyrightWill Thompson, Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria (garetxe@gmail.com)
Safe HaskellNone
LanguageHaskell2010

GI.Gio.Objects.UnixSocketAddress

Contents

Description

Support for UNIX-domain (also known as local) sockets.

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 IOErrorEnumNotSupported errors. You can use unixSocketAddressAbstractNamesSupported to see if abstract names are supported.

Note that <gio/gunixsocketaddress.h> belongs to the UNIX-specific GIO interfaces, thus you have to use the gio-unix-2.0.pc pkg-config file when using it.

Synopsis

Exported types

Methods

abstractNamesSupported

unixSocketAddressAbstractNamesSupported Source #

Arguments

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

Returns: True if supported, False otherwise

Checks if abstract UNIX domain socket names are supported.

Since: 2.22

getAddressType

unixSocketAddressGetAddressType Source #

Gets address's type.

Since: 2.26

getIsAbstract

unixSocketAddressGetIsAbstract Source #

Arguments

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

address: a InetSocketAddress

-> m Bool

Returns: True if the address is abstract, False otherwise

Tests if address is abstract.

Since: 2.22

getPath

unixSocketAddressGetPath Source #

Arguments

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

address: a InetSocketAddress

-> m Text

Returns: the path for address

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

unixSocketAddressGetPathLen Source #

Arguments

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

address: a InetSocketAddress

-> m Word64

Returns: the length of the path

Gets the length of address's path.

For details, see unixSocketAddressGetPath.

Since: 2.22

new

unixSocketAddressNew Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Text

path: the socket path

-> m UnixSocketAddress

Returns: a new UnixSocketAddress

Creates a new UnixSocketAddress for path.

To create abstract socket addresses, on systems that support that, use unixSocketAddressNewAbstract.

Since: 2.22

newAbstract

newWithType

unixSocketAddressNewWithType Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> [Int8]

path: the name

-> UnixSocketAddressType

type: a UnixSocketAddressType

-> m UnixSocketAddress

Returns: a new UnixSocketAddress

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

data UnixSocketAddressAbstractPropertyInfo Source #

Instances

AttrInfo UnixSocketAddressAbstractPropertyInfo Source # 
type AttrOrigin UnixSocketAddressAbstractPropertyInfo Source # 
type AttrLabel UnixSocketAddressAbstractPropertyInfo Source # 
type AttrGetType UnixSocketAddressAbstractPropertyInfo Source # 
type AttrBaseTypeConstraint UnixSocketAddressAbstractPropertyInfo Source # 
type AttrSetTypeConstraint UnixSocketAddressAbstractPropertyInfo Source # 
type AttrAllowedOps UnixSocketAddressAbstractPropertyInfo Source # 

addressType

data UnixSocketAddressAddressTypePropertyInfo Source #

Instances

AttrInfo UnixSocketAddressAddressTypePropertyInfo Source # 
type AttrOrigin UnixSocketAddressAddressTypePropertyInfo Source # 
type AttrLabel UnixSocketAddressAddressTypePropertyInfo Source # 
type AttrGetType UnixSocketAddressAddressTypePropertyInfo Source # 
type AttrBaseTypeConstraint UnixSocketAddressAddressTypePropertyInfo Source # 
type AttrSetTypeConstraint UnixSocketAddressAddressTypePropertyInfo Source # 
type AttrAllowedOps UnixSocketAddressAddressTypePropertyInfo Source # 

path

data UnixSocketAddressPathPropertyInfo Source #

Instances

AttrInfo UnixSocketAddressPathPropertyInfo Source # 
type AttrOrigin UnixSocketAddressPathPropertyInfo Source # 
type AttrLabel UnixSocketAddressPathPropertyInfo Source # 
type AttrGetType UnixSocketAddressPathPropertyInfo Source # 
type AttrBaseTypeConstraint UnixSocketAddressPathPropertyInfo Source # 
type AttrSetTypeConstraint UnixSocketAddressPathPropertyInfo Source # 
type AttrAllowedOps UnixSocketAddressPathPropertyInfo Source # 

pathAsArray

data UnixSocketAddressPathAsArrayPropertyInfo Source #

Instances

AttrInfo UnixSocketAddressPathAsArrayPropertyInfo Source # 
type AttrOrigin UnixSocketAddressPathAsArrayPropertyInfo Source # 
type AttrLabel UnixSocketAddressPathAsArrayPropertyInfo Source # 
type AttrGetType UnixSocketAddressPathAsArrayPropertyInfo Source # 
type AttrBaseTypeConstraint UnixSocketAddressPathAsArrayPropertyInfo Source # 
type AttrSetTypeConstraint UnixSocketAddressPathAsArrayPropertyInfo Source # 
type AttrAllowedOps UnixSocketAddressPathAsArrayPropertyInfo Source #