Gio.SocketControlMessage¶
- Subclasses:
Methods¶
- Inherited:
- Structs:
class |
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
|
|
|
|
|
|
|
Properties¶
None
Signals¶
- Inherited:
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
parent_instance |
r |
Class Details¶
- class Gio.SocketControlMessage(**kwargs)¶
- Bases:
- Abstract:
Yes
- Structure:
A
GSocketControlMessage
is a special-purpose utility message that can be sent to or received from a [class`Gio`.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 [method`Gio`.Socket.send_message] and received with [method`Gio`.Socket.receive_message].
To extend the set of control message that can be sent, subclass this class and override the
get_size
,get_level
,get_type
andserialize
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 [type`GObject`.Type] type system before calling [method`Gio`.Socket.receive_message] to read such a message.New in version 2.22.
- classmethod deserialize(level, type, data)[source]¶
- Parameters:
- Returns:
the deserialized message or
None
- Return type:
Tries to deserialize a socket control message of a given level and type. This will ask all known (to
GObject.GType
) subclasses ofGio.SocketControlMessage
if they can understand this kind of message and if so deserialize it into aGio.SocketControlMessage
.If there is no implementation for this kind of control message,
None
will be returned.New in version 2.22.
- get_level()[source]¶
- Returns:
an integer describing the level
- Return type:
Returns the “level” (i.e. the originating protocol) of the control message. This is often SOL_SOCKET.
New in version 2.22.
- get_msg_type()[source]¶
- Returns:
an integer describing the type of control message
- Return type:
Returns the protocol specific type of the control message. For instance, for UNIX fd passing this would be SCM_RIGHTS.
New in version 2.22.
- get_size()[source]¶
- Returns:
The number of bytes required.
- Return type:
Returns the space required for the control message, not including headers or alignment.
New in version 2.22.
- serialize(data)[source]¶
- Parameters:
data (
object
) – A buffer to write data to
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
Gio.SocketControlMessage.get_size
() on this object.New in version 2.22.
- do_get_level() virtual¶
- Returns:
an integer describing the level
- Return type:
Returns the “level” (i.e. the originating protocol) of the control message. This is often SOL_SOCKET.
New in version 2.22.
- do_get_size() virtual¶
- Returns:
The number of bytes required.
- Return type:
Returns the space required for the control message, not including headers or alignment.
New in version 2.22.
- do_serialize(data) virtual¶
- Parameters:
data (
object
) – A buffer to write data to
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
Gio.SocketControlMessage.get_size
() on this object.New in version 2.22.