]> Git Repo - qemu.git/blame - include/sysemu/rng.h
rng: remove the unused request cancellation code
[qemu.git] / include / sysemu / rng.h
CommitLineData
a9b7b2ad
AL
1/*
2 * QEMU Random Number Generator Backend
3 *
4 * Copyright IBM, Corp. 2012
5 *
6 * Authors:
7 * Anthony Liguori <[email protected]>
8 *
9 * This work is licensed under the terms of the GNU GPL, version 2 or later.
10 * See the COPYING file in the top-level directory.
11 */
12
13#ifndef QEMU_RNG_H
14#define QEMU_RNG_H
15
14cccb61 16#include "qom/object.h"
a9b7b2ad 17#include "qemu-common.h"
a9b7b2ad
AL
18
19#define TYPE_RNG_BACKEND "rng-backend"
20#define RNG_BACKEND(obj) \
21 OBJECT_CHECK(RngBackend, (obj), TYPE_RNG_BACKEND)
22#define RNG_BACKEND_GET_CLASS(obj) \
23 OBJECT_GET_CLASS(RngBackendClass, (obj), TYPE_RNG_BACKEND)
24#define RNG_BACKEND_CLASS(klass) \
25 OBJECT_CLASS_CHECK(RngBackendClass, (klass), TYPE_RNG_BACKEND)
26
27typedef struct RngBackendClass RngBackendClass;
28typedef struct RngBackend RngBackend;
29
30typedef void (EntropyReceiveFunc)(void *opaque,
31 const void *data,
32 size_t size);
33
34struct RngBackendClass
35{
36 ObjectClass parent_class;
37
38 void (*request_entropy)(RngBackend *s, size_t size,
805a2505 39 EntropyReceiveFunc *receive_entropy, void *opaque);
a9b7b2ad
AL
40
41 void (*opened)(RngBackend *s, Error **errp);
42};
43
44struct RngBackend
45{
46 Object parent;
47
48 /*< protected >*/
49 bool opened;
50};
51
52/**
53 * rng_backend_request_entropy:
54 * @s: the backend to request entropy from
55 * @size: the number of bytes of data to request
56 * @receive_entropy: a function to be invoked when entropy is available
57 * @opaque: data that should be passed to @receive_entropy
58 *
59 * This function is used by the front-end to request entropy from an entropy
60 * source. This function can be called multiple times before @receive_entropy
61 * is invoked with different values of @receive_entropy and @opaque. The
42015c9a 62 * backend will queue each request and handle appropriately.
a9b7b2ad
AL
63 *
64 * The backend does not need to pass the full amount of data to @receive_entropy
42015c9a 65 * but will pass a value greater than 0.
a9b7b2ad
AL
66 */
67void rng_backend_request_entropy(RngBackend *s, size_t size,
68 EntropyReceiveFunc *receive_entropy,
69 void *opaque);
a9b7b2ad 70#endif
This page took 0.173414 seconds and 4 git commands to generate.