#ifndef STREAM_H
#define STREAM_H

#include "qom/object.h"

/* stream slave. Used until qdev provides a generic way.  */
#define TYPE_STREAM_SLAVE "stream-slave"

typedef struct StreamSlaveClass StreamSlaveClass;
DECLARE_CLASS_CHECKERS(StreamSlaveClass, STREAM_SLAVE,
                       TYPE_STREAM_SLAVE)
#define STREAM_SLAVE(obj) \
     INTERFACE_CHECK(StreamSlave, (obj), TYPE_STREAM_SLAVE)

typedef struct StreamSlave StreamSlave;

typedef void (*StreamCanPushNotifyFn)(void *opaque);

struct StreamSlaveClass {
    InterfaceClass parent;
    /**
     * can push - determine if a stream slave is capable of accepting at least
     * one byte of data. Returns false if cannot accept. If not implemented, the
     * slave is assumed to always be capable of receiving.
     * @notify: Optional callback that the slave will call when the slave is
     * capable of receiving again. Only called if false is returned.
     * @notify_opaque: opaque data to pass to notify call.
     */
    bool (*can_push)(StreamSlave *obj, StreamCanPushNotifyFn notify,
                     void *notify_opaque);
    /**
     * push - push data to a Stream slave. The number of bytes pushed is
     * returned. If the slave short returns, the master must wait before trying
     * again, the slave may continue to just return 0 waiting for the vm time to
     * advance. The can_push() function can be used to trap the point in time
     * where the slave is ready to receive again, otherwise polling on a QEMU
     * timer will work.
     * @obj: Stream slave to push to
     * @buf: Data to write
     * @len: Maximum number of bytes to write
     * @eop: End of packet flag
     */
    size_t (*push)(StreamSlave *obj, unsigned char *buf, size_t len, bool eop);
};

size_t
stream_push(StreamSlave *sink, uint8_t *buf, size_t len, bool eop);

bool
stream_can_push(StreamSlave *sink, StreamCanPushNotifyFn notify,
                void *notify_opaque);


#endif /* STREAM_H */
