vfs: check userland buffers before reading them.
[haiku.git] / src / servers / midi / PortDrivers.h
blob1426f0031a159fdd8908de9bb71b5860c2990661
1 /*
2 * Copyright 2003-2009, Haiku, Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
5 * Authors:
6 * Matthijs Hollemans
7 * Jerome Leveque
8 * Philippe Houdoin
9 */
10 #ifndef PORT_DRIVERS_H
11 #define PORT_DRIVERS_H
14 #include <MidiProducer.h>
15 #include <MidiConsumer.h>
17 class MidiPortConsumer : public BMidiLocalConsumer {
18 public:
19 MidiPortConsumer(int fd, const char* path);
21 void Data(uchar* data, size_t length, bool atomic, bigtime_t time);
23 private:
24 int fFileDescriptor;
28 class MidiPortProducer : public BMidiLocalProducer {
29 public:
30 MidiPortProducer(int fd, const char* path = NULL);
31 virtual ~MidiPortProducer(void);
33 int32 GetData(void);
35 private:
36 static int32 _ReaderThread(void* data);
38 int fFileDescriptor;
39 volatile bool fKeepRunning;
40 thread_id fReaderThread;
43 #endif // PORT_DRIVERS_H