### Class

# Gio SocketControlMessage

since: 2.22

#### Description [src]

    abstract class Gio.SocketControlMessage : GObject.Object
    {
      GSocketControlMessagePrivate* priv
    }

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 `g_socket_send_message()` and received with `g_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 `GType` type system before calling `g_socket_receive_message()` to read such a message.

Available since: 2.22

#### Hierarchy

#### Ancestors

- GObject

#### Descendants

- GIPTosMessage
- GIPv6TclassMessage
- GUnixCredentialsMessage

#### Functions

###### g_socket_control_message_deserialize

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`.

since: 2.22

#### Instance methods

###### g_socket_control_message_get_level

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

since: 2.22

###### g_socket_control_message_get_msg_type

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

since: 2.22

###### g_socket_control_message_get_size

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

since: 2.22

###### g_socket_control_message_serialize

Converts the data in the message to bytes placed in the message.

since: 2.22

##### Methods inherited from GObject (43)

Please see GObject for a full list of methods.

#### Signals

##### Signals inherited from GObject (1)

###### GObject::notify

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

#### Class structure

    struct GioSocketControlMessageClass {
      GObjectClass parent_class;
      gsize (* get_size) (
        GSocketControlMessage* message
      );
      int (* get_level) (
        GSocketControlMessage* message
      );
      int (* get_type) (
        GSocketControlMessage* message
      );
      void (* serialize) (
        GSocketControlMessage* message,
        gpointer data
      );
      GSocketControlMessage* (* deserialize) (
        int level,
        int type,
        gsize size,
        gpointer data
      );
      void (* _g_reserved1) (
    void
      );
      void (* _g_reserved2) (
    void
      );
      void (* _g_reserved3) (
    void
      );
      void (* _g_reserved4) (
    void
      );
      void (* _g_reserved5) (
    void
      );

    }

Class structure for `GSocketControlMessage`.

###### Class members

`parent_class: GObjectClass`

  No description available.

`get_size: gsize (* get_size) ( GSocketControlMessage* message )`

  Gets the size of the message.

`get_level: int (* get_level) ( GSocketControlMessage* message )`

  Gets the protocol of the message.

`get_type: int (* get_type) ( GSocketControlMessage* message )`

  Gets the protocol specific type of the message.

`serialize: void (* serialize) ( GSocketControlMessage* message, gpointer data )`

  Writes out the message data.

`deserialize: GSocketControlMessage* (* deserialize) ( int level, int type, gsize size, gpointer data )`

  Tries to deserialize a message.

`_g_reserved1: void (* _g_reserved1) ( void )`

  No description available.

`_g_reserved2: void (* _g_reserved2) ( void )`

  No description available.

`_g_reserved3: void (* _g_reserved3) ( void )`

  No description available.

`_g_reserved4: void (* _g_reserved4) ( void )`

  No description available.

`_g_reserved5: void (* _g_reserved5) ( void )`

  No description available.

#### Virtual methods

###### Gio.SocketControlMessageClass.get_level

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

since: 2.22

###### Gio.SocketControlMessageClass.get_size

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

since: 2.22

###### Gio.SocketControlMessageClass.get_type

Gets the protocol specific type of the message.

###### Gio.SocketControlMessageClass.serialize

Converts the data in the message to bytes placed in the message.

since: 2.22