glibmm: Gio::UnixFDMessage Class Reference

glibmm 2.31.22

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Examples

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Member Functions | Protected Member Functions | Related Functions
Gio::UnixFDMessage Class Reference
Portable Network I/O Functionality

UnixFDMessage — A GSocketControlMessage containing a GUnixFDList. More...

`#include <giomm/unixfdmessage.h>`

Inheritance diagram for Gio::UnixFDMessage:
[legend]

List of all members.

## Public Member Functions
virtual | ~UnixFDMessage ()
GUnixFDMessage* | gobj ()
| Provides access to the underlying C GObject.
const GUnixFDMessage* | gobj () const
| Provides access to the underlying C GObject.
GUnixFDMessage* | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
Glib::RefPtr< UnixFDList > | get_fd_list ()
| Gets the UnixFDList contained in message.
Glib::RefPtr< const UnixFDList > | get_fd_list () const
| Gets the UnixFDList contained in message.
bool | append_fd (int fd)
| Adds a file descriptor to message.
Glib::ArrayHandle< int > | steal_fds ()
| Returns the array of file descriptors that is contained in this object.
Glib::PropertyProxy_ReadOnly < Glib::RefPtr< UnixFDList > > | property_fd_list () const
| The GUnixFDList object to send with the message.
## Static Public Member Functions
static Glib::RefPtr < UnixFDMessage > | create ()
| Creates a new UnixFDMessage containing an empty file descriptor list.
static Glib::RefPtr < UnixFDMessage > | create (const Glib::RefPtr< UnixFDList >& fd_list)
| Creates a new UnixFDMessage containing list.
## Protected Member Functions
| UnixFDMessage ()
| UnixFDMessage (const Glib::RefPtr< UnixFDList >& fd_list)
## Related Functions
(Note that these are not member functions.)
Glib::RefPtr< Gio::UnixFDMessage > | wrap (GUnixFDMessage* object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Detailed Description

UnixFDMessage — A GSocketControlMessage containing a GUnixFDList.

This SocketControlMessage contains a UnixFDList. It may be sent using Gio::Socket::send() and received using Gio::Socket::receive() over UNIX sockets (ie: sockets in the Gio::SOCKET_ADDRESS_UNIX family). The file descriptors are copied between processes by the kernel.

For an easier way to send and receive file descriptors over stream-oriented UNIX sockets, see Gio::UnixConnection::send_fd() and Gio::UnixConnection::receive_fd().

Since glibmm 2.28:

## Constructor & Destructor Documentation

virtual Gio::UnixFDMessage::~UnixFDMessage | ( |  | ) | `[virtual]`

Gio::UnixFDMessage::UnixFDMessage | ( |  | ) | `[protected]`

Gio::UnixFDMessage::UnixFDMessage | ( | const Glib::RefPtr< UnixFDList >& | fd_list | ) | `[explicit, protected]`

## Member Function Documentation

bool Gio::UnixFDMessage::append_fd | ( | int | fd | ) |

Adds a file descriptor to message.

The file descriptor is duplicated using dup(). You keep your copy of the descriptor and the copy contained in message will be closed when message is finalized.

A possible cause of failure is exceeding the per-process or system-wide file descriptor limit.

Since glibmm 2.22:

Parameters:

  fd | A valid open file descriptor.

Returns:
  `true` in case of success, else `false` (and error is set).

static Glib::RefPtr<UnixFDMessage> Gio::UnixFDMessage::create | ( |  | ) | `[static]`

Creates a new UnixFDMessage containing an empty file descriptor list.

Since glibmm 2.22:

Returns:
  A new UnixFDMessage.

static Glib::RefPtr<UnixFDMessage> Gio::UnixFDMessage::create | ( | const Glib::RefPtr< UnixFDList >& | fd_list | ) | `[static]`

Creates a new UnixFDMessage containing list.

Since glibmm 2.24:

Parameters:

  fd_list | A UnixFDList.

Returns:
  A new UnixFDMessage.

Glib::RefPtr<UnixFDList> Gio::UnixFDMessage::get_fd_list | ( |  | ) |

Gets the UnixFDList contained in message.

This function does not return a reference to the caller, but the returned list is valid for the lifetime of message.

Since glibmm 2.24:

Returns:
  The UnixFDList from message.

Glib::RefPtr<const UnixFDList> Gio::UnixFDMessage::get_fd_list | ( |  | ) | const

Gets the UnixFDList contained in message.

This function does not return a reference to the caller, but the returned list is valid for the lifetime of message.

Since glibmm 2.24:

Returns:
  The UnixFDList from message.

GUnixFDMessage* Gio::UnixFDMessage::gobj | ( |  | ) | `[inline]`

Provides access to the underlying C GObject.

Reimplemented from Gio::SocketControlMessage.

const GUnixFDMessage* Gio::UnixFDMessage::gobj | ( |  | ) | const`[inline]`

Provides access to the underlying C GObject.

Reimplemented from Gio::SocketControlMessage.

GUnixFDMessage* Gio::UnixFDMessage::gobj_copy | ( |  | ) |

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

Reimplemented from Gio::SocketControlMessage.

Glib::PropertyProxy_ReadOnly< Glib::RefPtr<UnixFDList> > Gio::UnixFDMessage::property_fd_list | ( |  | ) | const

The GUnixFDList object to send with the message.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::ArrayHandle<int> Gio::UnixFDMessage::steal_fds | ( |  | ) |

Returns the array of file descriptors that is contained in this object.

After this call, the descriptors are no longer contained in message. Further calls will return an empty list (unless more descriptors have been added).

The caller is responsible for closing all of the file descriptors.

Returns:
  An array of file descriptors.

Since glibmm 2.28:

## Friends And Related Function Documentation

Glib::RefPtr< Gio::UnixFDMessage > wrap | ( | GUnixFDMessage * | object,
|  | bool | take_copy = `false`
| ) |  | `[related]`

A Glib::wrap() method for this object.

Parameters:

  object | The C instance.
  take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref.

Returns:
  A C++ instance that wraps this C instance.