2018-10-15 00:44:54 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "CharacterDevice.h"
|
|
|
|
|
|
|
|
class RandomDevice final : public CharacterDevice {
|
2018-10-31 23:19:15 +01:00
|
|
|
AK_MAKE_ETERNAL
|
2018-10-15 00:44:54 +02:00
|
|
|
public:
|
|
|
|
RandomDevice();
|
2018-10-25 13:07:59 +02:00
|
|
|
virtual ~RandomDevice() override;
|
2018-10-15 00:44:54 +02:00
|
|
|
|
2019-07-03 21:17:35 +02:00
|
|
|
static u32 random_value();
|
2019-03-18 04:03:44 +01:00
|
|
|
|
2019-01-21 02:33:01 +01:00
|
|
|
private:
|
|
|
|
// ^CharacterDevice
|
2019-07-03 21:17:35 +02:00
|
|
|
virtual ssize_t read(FileDescription&, u8*, ssize_t) override;
|
|
|
|
virtual ssize_t write(FileDescription&, const u8*, ssize_t) override;
|
2019-11-04 14:03:14 +01:00
|
|
|
virtual bool can_read(const FileDescription&) const override;
|
|
|
|
virtual bool can_write(const FileDescription&) const override { return true; }
|
2019-01-21 02:33:01 +01:00
|
|
|
virtual const char* class_name() const override { return "RandomDevice"; }
|
2018-10-15 00:44:54 +02:00
|
|
|
};
|