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.SocketControlMessage
Description
A GSocketControlMessage
is a special-purpose utility message that
can be sent to or received from a Socket
. These types of
messages are often called ‘ancillary data’.
The message can represent some sort of special instruction to or information from the socket or can represent a special kind of transfer to the peer (for example, sending a file descriptor over a UNIX socket).
These messages are sent with socketSendMessage
and received
with socketReceiveMessage
.
To extend the set of control message that can be sent, subclass this
class and override the get_size
, get_level
, get_type
and serialize
methods.
To extend the set of control messages that can be received, subclass
this class and implement the deserialize
method. Also, make sure your
class is registered with the [typegObject
.Type] type system before calling
socketReceiveMessage
to read such a message.
Since: 2.22
Synopsis
- newtype SocketControlMessage = SocketControlMessage (ManagedPtr SocketControlMessage)
- class (GObject o, IsDescendantOf SocketControlMessage o) => IsSocketControlMessage o
- toSocketControlMessage :: (MonadIO m, IsSocketControlMessage o) => o -> m SocketControlMessage
- type family ResolveSocketControlMessageMethod (t :: Symbol) o where ...
- socketControlMessageDeserialize :: (HasCallStack, MonadIO m) => Int32 -> Int32 -> ByteString -> m (Maybe SocketControlMessage)
- data SocketControlMessageGetLevelMethodInfo
- socketControlMessageGetLevel :: (HasCallStack, MonadIO m, IsSocketControlMessage a) => a -> m Int32
- data SocketControlMessageGetMsgTypeMethodInfo
- socketControlMessageGetMsgType :: (HasCallStack, MonadIO m, IsSocketControlMessage a) => a -> m Int32
- data SocketControlMessageGetSizeMethodInfo
- socketControlMessageGetSize :: (HasCallStack, MonadIO m, IsSocketControlMessage a) => a -> m CSize
- data SocketControlMessageSerializeMethodInfo
- socketControlMessageSerialize :: (HasCallStack, MonadIO m, IsSocketControlMessage a) => a -> Ptr () -> m ()
Exported types
newtype SocketControlMessage Source #
Memory-managed wrapper type.
Constructors
SocketControlMessage (ManagedPtr SocketControlMessage) |
Instances
class (GObject o, IsDescendantOf SocketControlMessage o) => IsSocketControlMessage o Source #
Type class for types which can be safely cast to SocketControlMessage
, for instance with toSocketControlMessage
.
Instances
(GObject o, IsDescendantOf SocketControlMessage o) => IsSocketControlMessage o Source # | |
Defined in GI.Gio.Objects.SocketControlMessage |
toSocketControlMessage :: (MonadIO m, IsSocketControlMessage o) => o -> m SocketControlMessage Source #
Cast to SocketControlMessage
, 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, forceFloating, freezeNotify, getv, isFloating, notify, notifyByPspec, ref, refSink, runDispose, serialize, stealData, stealQdata, thawNotify, unref, watchClosure.
Getters
getData, getLevel, getMsgType, getProperty, getQdata, getSize.
Setters
type family ResolveSocketControlMessageMethod (t :: Symbol) o where ... Source #
Equations
deserialize
socketControlMessageDeserialize Source #
Arguments
:: (HasCallStack, MonadIO m) | |
=> Int32 |
|
-> Int32 |
|
-> ByteString |
|
-> m (Maybe SocketControlMessage) | Returns: the deserialized message or |
Tries to deserialize a socket control message of a given
level
and type
. This will ask all known (to GType) subclasses
of SocketControlMessage
if they can understand this kind
of message and if so deserialize it into a SocketControlMessage
.
If there is no implementation for this kind of control message, Nothing
will be returned.
Since: 2.22
getLevel
data SocketControlMessageGetLevelMethodInfo Source #
Instances
(signature ~ m Int32, MonadIO m, IsSocketControlMessage a) => OverloadedMethod SocketControlMessageGetLevelMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.SocketControlMessage Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SocketControlMessageGetLevelMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.SocketControlMessage Methods |
socketControlMessageGetLevel Source #
Arguments
:: (HasCallStack, MonadIO m, IsSocketControlMessage a) | |
=> a |
|
-> m Int32 | Returns: an integer describing the level |
Returns the "level" (i.e. the originating protocol) of the control message. This is often SOL_SOCKET.
Since: 2.22
getMsgType
data SocketControlMessageGetMsgTypeMethodInfo Source #
Instances
(signature ~ m Int32, MonadIO m, IsSocketControlMessage a) => OverloadedMethod SocketControlMessageGetMsgTypeMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.SocketControlMessage Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SocketControlMessageGetMsgTypeMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.SocketControlMessage Methods |
socketControlMessageGetMsgType Source #
Arguments
:: (HasCallStack, MonadIO m, IsSocketControlMessage a) | |
=> a |
|
-> m Int32 | Returns: an integer describing the type of control message |
Returns the protocol specific type of the control message. For instance, for UNIX fd passing this would be SCM_RIGHTS.
Since: 2.22
getSize
data SocketControlMessageGetSizeMethodInfo Source #
Instances
(signature ~ m CSize, MonadIO m, IsSocketControlMessage a) => OverloadedMethod SocketControlMessageGetSizeMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.SocketControlMessage Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SocketControlMessageGetSizeMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.SocketControlMessage Methods |
socketControlMessageGetSize Source #
Arguments
:: (HasCallStack, MonadIO m, IsSocketControlMessage a) | |
=> a |
|
-> m CSize | Returns: The number of bytes required. |
Returns the space required for the control message, not including headers or alignment.
Since: 2.22
serialize
data SocketControlMessageSerializeMethodInfo Source #
Instances
(signature ~ (Ptr () -> m ()), MonadIO m, IsSocketControlMessage a) => OverloadedMethod SocketControlMessageSerializeMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.SocketControlMessage Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SocketControlMessageSerializeMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.SocketControlMessage Methods |
socketControlMessageSerialize Source #
Arguments
:: (HasCallStack, MonadIO m, IsSocketControlMessage a) | |
=> a |
|
-> Ptr () |
|
-> m () |
Converts the data in the message to bytes placed in the message.
data
is guaranteed to have enough space to fit the size
returned by socketControlMessageGetSize
on this
object.
Since: 2.22