crashpad::NotifyServer::Interface Class Referenceabstract

An interface that the different request messages that are a part of the `notify` Mach subsystem can be dispatched to. More...

`#include "util/mach/notify_server.h"`

Inheritance diagram for crashpad::NotifyServer::Interface:

## Public Member Functions

virtual kern_return_t | DoMachNotifyPortDeleted (notify_port_t notify, mach_port_name_t name, const mach_msg_trailer_t *trailer)=0
| Handles port-deleted notifications sent by `mach_notify_port_deleted()`. More...
virtual kern_return_t | DoMachNotifyPortDestroyed (notify_port_t notify, mach_port_t rights, const mach_msg_trailer_t *trailer, bool *destroy_request)=0
| Handles port-destroyed notifications sent by `mach_notify_port_destroyed()`. More...
virtual kern_return_t | DoMachNotifyNoSenders (notify_port_t notify, mach_port_mscount_t mscount, const mach_msg_trailer_t *trailer)=0
| Handles no-senders notifications sent by `mach_notify_no_senders()`. More...
virtual kern_return_t | DoMachNotifySendOnce (notify_port_t notify, const mach_msg_trailer_t *trailer)=0
| Handles send-once notifications sent by `mach_notify_send_once()`. More...
virtual kern_return_t | DoMachNotifyDeadName (notify_port_t notify, mach_port_name_t name, const mach_msg_trailer_t *trailer)=0
| Handles dead-name notifications sent by `mach_notify_dead_name()`. More...

## Detailed Description

An interface that the different request messages that are a part of the `notify` Mach subsystem can be dispatched to.

Default implementations of all methods are available in the DefaultInterface class.

## Member Function Documentation

## DoMachNotifyDeadName()

virtual kern_return_t crashpad::NotifyServer::Interface::DoMachNotifyDeadName | ( | notify_port_t | notify,
|  | mach_port_name_t | name,
|  | const mach_msg_trailer_t * | trailer
| ) |  |

pure virtual

Handles dead-name notifications sent by `mach_notify_dead_name()`.

A dead-name notification is generated when a port with a dead-name notification request is destroyed and the right becomes a dead name.

This behaves equivalently to a `do_mach_notify_dead_name()` function used with `notify_server()`.

Parameters

  [in] | notify | The Mach port that the notification was sent to.
  [in] | name | The dead name. Although this is transferred as a `mach_port_name_t` and not a `mach_port_t`, the callee assumes an additional reference to this port when this method is called. See the note below.
  [in] | trailer | The trailer received with the notification message.

Note
  When a dead-name notification is generated, the user reference count of the dead name is incremented. A send right with one reference that becomes a dead name will have one dead-name reference, and the dead-name notification will add another dead-name reference, for a total of 2. DoMachNotifyDeadName() implementations must take care to deallocate this extra reference. There is no destroy_request parameter to simplify this operation because dead-name notifications carry a port name only (name is of type `mach_port_name_t`) without transferring port rights, and are thus not complex Mach messages.

Implemented in crashpad::NotifyServer::DefaultInterface.

## DoMachNotifyNoSenders()

virtual kern_return_t crashpad::NotifyServer::Interface::DoMachNotifyNoSenders | ( | notify_port_t | notify,
|  | mach_port_mscount_t | mscount,
|  | const mach_msg_trailer_t * | trailer
| ) |  |

pure virtual

Handles no-senders notifications sent by `mach_notify_no_senders()`.

A no-senders notification is generated when a receive right with a no-senders notification request loses its last corresponding send right.

This behaves equivalently to a `do_mach_notify_no_senders()` function used with `notify_server()`.

Parameters

  [in] | notify | The Mach port that the notification was sent to.
  [in] | mscount | The value of the sender-less port’s make-send count at the time the notification was generated.
  [in] | trailer | The trailer received with the notification message.

Implemented in crashpad::NotifyServer::DefaultInterface.

## DoMachNotifyPortDeleted()

virtual kern_return_t crashpad::NotifyServer::Interface::DoMachNotifyPortDeleted | ( | notify_port_t | notify,
|  | mach_port_name_t | name,
|  | const mach_msg_trailer_t * | trailer
| ) |  |

pure virtual

Handles port-deleted notifications sent by `mach_notify_port_deleted()`.

A port-deleted notification is generated when a port with a dead-name notification request is destroyed and the port name becomes available for reuse.

This behaves equivalently to a `do_mach_notify_port_deleted()` function used with `notify_server()`.

Parameters

  [in] | notify | The Mach port that the notification was sent to.
  [in] | name | The name that formerly referenced the deleted port. When this method is called, name no longer corresponds to the port that has been deleted, and may be reused for another purpose.
  [in] | trailer | The trailer received with the notification message.

Implemented in crashpad::NotifyServer::DefaultInterface.

## DoMachNotifyPortDestroyed()

virtual kern_return_t crashpad::NotifyServer::Interface::DoMachNotifyPortDestroyed | ( | notify_port_t | notify,
|  | mach_port_t | rights,
|  | const mach_msg_trailer_t * | trailer,
|  | bool * | destroy_request
| ) |  |

pure virtual

Handles port-destroyed notifications sent by `mach_notify_port_destroyed()`.

A port-destroyed notification is generated when a receive right with a port-destroyed notification request is destroyed. Rather than destroying the receive right, it is transferred via this notification’s rights parameter.

This behaves equivalently to a `do_mach_notify_port_destroyed()` function used with `notify_server()`.

Parameters

  [in] | notify | The Mach port that the notification was sent to.
  [in] | rights | A receive right for the port that would have been destroyed. The callee takes ownership of this port, however, if the callee does not wish to take ownership, it may set destroy_request to `true`.
  [in] | trailer | The trailer received with the notification message.
  [out] | destroy_request | `true` if the request message is to be destroyed even when this method returns success. See MachMessageServer::Interface.

Implemented in crashpad::NotifyServer::DefaultInterface.

## DoMachNotifySendOnce()

virtual kern_return_t crashpad::NotifyServer::Interface::DoMachNotifySendOnce | ( | notify_port_t | notify,
|  | const mach_msg_trailer_t * | trailer
| ) |  |

pure virtual

Handles send-once notifications sent by `mach_notify_send_once()`.

A send-once notification is generated when a send-once right is destroyed without being used.

This behaves equivalently to a `do_mach_notify_send_once()` function used with `notify_server()`.

Parameters

  [in] | notify | The Mach port that the notification was sent to.
  [in] | trailer | The trailer received with the notification message.

Note
  Unlike the other notifications in the `notify` subsystem, send-once notifications are not generated as a result of a notification request, but are generated any time a send-once right is destroyed rather than being used. The notification is sent via the send-once right to its receiver. These notifications are more useful for clients, not servers. Send-once notifications are normally handled by MIG-generated client routines, which make send-once rights for their reply ports and interpret send-once notifications as a signal that there will be no reply. Although not expected to be primarily useful for servers, this method is provided because send-once notifications are defined as a part of the `notify` subsystem.

Implemented in crashpad::NotifyServer::DefaultInterface.

The documentation for this class was generated from the following file:

- util/mach/notify_server.h