1.82 <GSocketControlMessage>

Class: <GSocketControlMessage>

It derives from <GObject>.

A <GSocketControlMessage> is a special-purpose utility message that can be sent to or received from a <GSocket>. 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 Gio.Socket.send_message and received with Gio.Socket.receive_message.

To extend the set of control messages 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 GObject.Type type system before calling Gio.Socket.receive_message to read such a message.

Fields

parent-instance
priv

Procedures

Procedure: socket-control-message:deserialize level type data ⇒ %return

Tries to deserialize a socket control message of a given level and type. This will ask all known (to GType) subclasses of <GSocketControlMessage> if they can understand this kind of message and if so deserialize it into a <GSocketControlMessage>.

If there is no implementation for this kind of control message, #f will be returned.

level

Passed: a 32-bit integer.

a socket level

type

Passed: a 32-bit integer.

a socket control message type for the given level

data

Passed: a bytevector, or a list or vector, each an unsigned 8-bit integer.

pointer to the message data

%return

Returned: a <GSocketControlMessage>, or #f.

the deserialized message or #f

size

Not passed: guile-gi gives the length of data.

the size of the data in bytes

Method: socket-control-message:get-level self ⇒ %return
Method: get-level self ⇒ %return

Returns the "level" (i.e. the originating protocol) of the control message. This is often SOL_SOCKET.

self

Passed: a <GSocketControlMessage>.

a <GSocketControlMessage>

%return

Returned: a 32-bit integer.

an integer describing the level

Method: socket-control-message:get-msg-type self ⇒ %return
Method: get-msg-type self ⇒ %return

Returns the protocol specific type of the control message. For instance, for UNIX fd passing this would be SCM_RIGHTS.

self

Passed: a <GSocketControlMessage>.

a <GSocketControlMessage>

%return

Returned: a 32-bit integer.

an integer describing the type of control message

Method: socket-control-message:get-size self ⇒ %return
Method: get-size self ⇒ %return

Returns the space required for the control message, not including headers or alignment.

self

Passed: a <GSocketControlMessage>.

a <GSocketControlMessage>

%return

Returned: an unsigned 64-bit integer.

The number of bytes required.

Method: socket-control-message:serialize self data
Method: serialize self data

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 socket-control-message:get-size on this object.

self

Passed: a <GSocketControlMessage>.

a <GSocketControlMessage>

data

Passed: a foreign pointer, or a bytevector.

A buffer to write data to

Virtual methods

Virtual method: socket-control-message:do-get-level implementor self ⇒ %return

Returns the "level" (i.e. the originating protocol) of the control message. This is often SOL_SOCKET.

To override it in a new class, give register-type #:vfuncs `((get-level . ,procedure)). The procedure is called as (procedure self) ⇒ %return.

implementor

Passed: the class whose implementation to call: <GSocketControlMessage>, or a class that derives from it, or its GType number.

self

Passed: a <GSocketControlMessage>.

a <GSocketControlMessage>

%return

Returned: a 32-bit integer.

an integer describing the level

Virtual method: socket-control-message:do-get-size implementor self ⇒ %return

Returns the space required for the control message, not including headers or alignment.

To override it in a new class, give register-type #:vfuncs `((get-size . ,procedure)). The procedure is called as (procedure self) ⇒ %return.

implementor

Passed: the class whose implementation to call: <GSocketControlMessage>, or a class that derives from it, or its GType number.

self

Passed: a <GSocketControlMessage>.

a <GSocketControlMessage>

%return

Returned: an unsigned 64-bit integer.

The number of bytes required.

Virtual method: socket-control-message:do-get-type implementor self ⇒ %return

gets the protocol specific type of the message.

To override it in a new class, give register-type #:vfuncs `((get-type . ,procedure)). The procedure is called as (procedure self) ⇒ %return.

implementor

Passed: the class whose implementation to call: <GSocketControlMessage>, or a class that derives from it, or its GType number.

self

Passed: a <GSocketControlMessage>.

%return

Returned: a 32-bit integer.

Virtual method: socket-control-message:do-serialize implementor self data

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 socket-control-message:get-size on this object.

To override it in a new class, give register-type #:vfuncs `((serialize . ,procedure)). The procedure is called as (procedure self data).

implementor

Passed: the class whose implementation to call: <GSocketControlMessage>, or a class that derives from it, or its GType number.

self

Passed: a <GSocketControlMessage>.

a <GSocketControlMessage>

data

Passed: a foreign pointer, or a bytevector.

A buffer to write data to