Loading...
Searching...
No Matches
L4Re::Random Struct Reference

Low-bandwidth interface for random number generators. More...

`#include <random>`

Inheritance diagram for L4Re::Random:
Collaboration diagram for L4Re::Random:

## Public Member Functions

long | get_random (l4_size_t size, L4::Ipc::Array< char, unsigned long > *buffer)
| Get a random number.
Public Member Functions inherited from L4::Icu
l4_msgtag_t | bind (unsigned irqnum, L4::Cap< Triggerable > irq, l4_utcb_t *utcb=l4_utcb()) noexcept
| Bind an interrupt line of an interrupt controller to an interrupt object.
l4_msgtag_t | unbind (unsigned irqnum, L4::Cap< Triggerable > irq, l4_utcb_t *utcb=l4_utcb()) noexcept
| Remove binding of an interrupt line from the interrupt controller object.
l4_msgtag_t | info (l4_icu_info_t *info, l4_utcb_t *utcb=l4_utcb()) noexcept
| Get information about the ICU features.
l4_msgtag_t | msi_info (l4_umword_t irqnum, l4_uint64_t source, l4_icu_msi_info_t *msi_info)
| Get MSI info about IRQ.
l4_msgtag_t | mask (unsigned irqnum, l4_umword_t *label=0, l4_timeout_t to=L4_IPC_NEVER, l4_utcb_t *utcb=l4_utcb()) noexcept
| Mask an IRQ line.
l4_msgtag_t | set_mode (unsigned irqnum, l4_umword_t mode, l4_utcb_t *utcb=l4_utcb()) noexcept
| Set interrupt mode.
Public Member Functions inherited from L4::Irq_eoi
l4_msgtag_t | unmask (unsigned irqnum, l4_umword_t *label=0, l4_timeout_t to=L4_IPC_NEVER, l4_utcb_t *utcb=l4_utcb()) noexcept
| Unmask the given interrupt line.

## Additional Inherited Members

Protected Types inherited from L4::Kobject_t< Random, L4::Icu >
typedef Random | Class
| The target interface type (inheriting from Kobject_t).
typedef Typeid::Iface< PROTO_ANY, Random > | __Iface
| The interface description for the derived class.
typedef Typeid::Merge_list< Typeid::Iface_list< __Iface >, typename L4::Icu::__Iface_list > | __Iface_list
| The list of all RPC interfaces provided directly or through inheritance.
Protected Types inherited from L4::Kobject_t< Icu, Irq_eoi, L4_PROTO_IRQ, Type_info::Demand_t< 1 > >
typedef Icu | Class
| The target interface type (inheriting from Kobject_t).
typedef Typeid::Iface< PROTO, Icu > | __Iface
| The interface description for the derived class.
typedef Typeid::Merge_list< Typeid::Iface_list< __Iface >, typename Irq_eoi::__Iface_list > | __Iface_list
| The list of all RPC interfaces provided directly or through inheritance.
Protected Member Functions inherited from L4::Kobject_t< Random, L4::Icu >
L4::Cap< Class > | c () const noexcept
| Get the capability to ourselves.
Protected Member Functions inherited from L4::Kobject_t< Icu, Irq_eoi, L4_PROTO_IRQ, Type_info::Demand_t< 1 > >
L4::Cap< Class > | c () const noexcept
| Get the capability to ourselves.
Static Protected Member Functions inherited from L4::Kobject_t< Random, L4::Icu >
static void | __check_protocols__ () noexcept
| Helper to check for protocol conflicts.
Static Protected Member Functions inherited from L4::Kobject_t< Icu, Irq_eoi, L4_PROTO_IRQ, Type_info::Demand_t< 1 > >
static void | __check_protocols__ () noexcept
| Helper to check for protocol conflicts.

## Detailed Description

Low-bandwidth interface for random number generators.

The interface offers an ICU interface where a client can register an interrupt to get notified when entropy is available. Support for notifications is optional. If a service does not implement notification, it must return 0 for the number of interrupts in the info() call. The notification interrupt must have index 0.

Include File
  #include <l4/re/random>
  random
  Random number generator interface definition.

Definition at line 33 of file random.

## Member Function Documentation

## get_random()

long L4Re::Random::get_random | ( | l4_size_t | size,
|  | L4::Ipc::Array< char, unsigned long > * | buffer )

Get a random number.

Parameters

  | size | Number of bytes of entropy requested.
  [out] | buffer | Buffer containing the random number. Each byte in the buffer contains 8 bits of randomness.

Return values

  >=0 | Actual size of the returned random number in bytes. This may be less than the requested size. The return value may also be 0 if temporarily no entropy is available.
  -L4_EIO | Source of randomness permanently unavailable.
  <0 | IPC error.

This function should never block. It should immediately return as much entropy as is available. If the call returns less than the requested bytes and a notification interrupt was installed, then the service triggers an interrupt as soon as the remaining entropy is available. That means that when an interrupt is triggered, the service must guarantee that the next call to get_random() returns at least the number of missing bytes for the call that initially triggered the notification.

If get_random() is called while a notification is pending, then the behaviour is implementation-defined.

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

- l4/re/random