2 * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT License.
5 #ifndef _DEBUG_EVENT_STREAM_H
6 #define _DEBUG_EVENT_STREAM_H
8 #include <SupportDefs.h>
14 struct debug_event_stream_header
{
23 // signature and version
24 #define B_DEBUG_EVENT_STREAM_SIGNATURE "Haiku debug events"
25 #define B_DEBUG_EVENT_STREAM_VERSION 1
30 B_DEBUG_EVENT_STREAM_FLAG_HOST_ENDIAN
= 0x00000001,
31 B_DEBUG_EVENT_STREAM_FLAG_SWAPPED_ENDIAN
= 0x01000000,
33 B_DEBUG_EVENT_STREAM_FLAG_ZIPPED
= 0x00000002
37 class BDebugEventInputStream
{
39 BDebugEventInputStream();
40 ~BDebugEventInputStream();
42 status_t
SetTo(BDataIO
* stream
);
43 status_t
SetTo(const void* data
, size_t size
,
44 bool takeOverOwnership
);
47 status_t
Seek(off_t streamOffset
);
49 ssize_t
ReadNextEvent(uint32
* _event
, uint32
* _cpu
,
51 off_t
* _streamOffset
= NULL
);
55 ssize_t
_Read(void* buffer
, size_t size
);
56 status_t
_GetData(size_t size
);
63 size_t fBufferCapacity
;
65 size_t fBufferPosition
;
66 off_t fStreamPosition
;
71 class BDebugEventOutputStream
{
73 BDebugEventOutputStream();
74 ~BDebugEventOutputStream();
76 status_t
SetTo(BDataIO
* stream
, uint32 flags
,
80 status_t
Write(const void* buffer
, size_t size
);
89 #endif // _DEBUG_EVENT_STREAM_H