1#ifndef STREAM_H
2#define STREAM_H
3
4#include "qemu-common.h"
5#include "qom/object.h"
6
7
8#define TYPE_STREAM_SLAVE "stream-slave"
9
10#define STREAM_SLAVE_CLASS(klass) \
11 OBJECT_CLASS_CHECK(StreamSlaveClass, (klass), TYPE_STREAM_SLAVE)
12#define STREAM_SLAVE_GET_CLASS(obj) \
13 OBJECT_GET_CLASS(StreamSlaveClass, (obj), TYPE_STREAM_SLAVE)
14#define STREAM_SLAVE(obj) \
15 INTERFACE_CHECK(StreamSlave, (obj), TYPE_STREAM_SLAVE)
16
17typedef struct StreamSlave {
18 Object Parent;
19} StreamSlave;
20
21typedef void (*StreamCanPushNotifyFn)(void *opaque);
22
23typedef struct StreamSlaveClass {
24 InterfaceClass parent;
25
26
27
28
29
30
31
32
33 bool (*can_push)(StreamSlave *obj, StreamCanPushNotifyFn notify,
34 void *notify_opaque);
35
36
37
38
39
40
41
42
43
44
45
46 size_t (*push)(StreamSlave *obj, unsigned char *buf, size_t len);
47} StreamSlaveClass;
48
49size_t
50stream_push(StreamSlave *sink, uint8_t *buf, size_t len);
51
52bool
53stream_can_push(StreamSlave *sink, StreamCanPushNotifyFn notify,
54 void *notify_opaque);
55
56
57#endif
58