1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 #ifndef _KBUFFER_H
22 #define _KBUFFER_H
23
24 #ifndef TS_SHIFT
25 #define TS_SHIFT 27
26 #endif
27
28 enum kbuffer_endian {
29 KBUFFER_ENDIAN_BIG,
30 KBUFFER_ENDIAN_LITTLE,
31 };
32
33 enum kbuffer_long_size {
34 KBUFFER_LSIZE_4,
35 KBUFFER_LSIZE_8,
36 };
37
38 enum {
39 KBUFFER_TYPE_PADDING = 29,
40 KBUFFER_TYPE_TIME_EXTEND = 30,
41 KBUFFER_TYPE_TIME_STAMP = 31,
42 };
43
44 struct kbuffer;
45
46 struct kbuffer *kbuffer_alloc(enum kbuffer_long_size size, enum kbuffer_endian endian);
47 void kbuffer_free(struct kbuffer *kbuf);
48 int kbuffer_load_subbuffer(struct kbuffer *kbuf, void *subbuffer);
49 void *kbuffer_read_event(struct kbuffer *kbuf, unsigned long long *ts);
50 void *kbuffer_next_event(struct kbuffer *kbuf, unsigned long long *ts);
51 unsigned long long kbuffer_timestamp(struct kbuffer *kbuf);
52
53 void *kbuffer_translate_data(int swap, void *data, unsigned int *size);
54
55 void *kbuffer_read_at_offset(struct kbuffer *kbuf, int offset, unsigned long long *ts);
56
57 int kbuffer_curr_index(struct kbuffer *kbuf);
58
59 int kbuffer_curr_offset(struct kbuffer *kbuf);
60 int kbuffer_curr_size(struct kbuffer *kbuf);
61 int kbuffer_event_size(struct kbuffer *kbuf);
62 int kbuffer_missed_events(struct kbuffer *kbuf);
63 int kbuffer_subbuffer_size(struct kbuffer *kbuf);
64
65 void kbuffer_set_old_format(struct kbuffer *kbuf);
66 int kbuffer_start_of_data(struct kbuffer *kbuf);
67
68
69
70 struct kbuffer_raw_info {
71 int type;
72 int length;
73 unsigned long long delta;
74 void *next;
75 };
76
77
78 struct kbuffer_raw_info *kbuffer_raw_get(struct kbuffer *kbuf, void *subbuf,
79 struct kbuffer_raw_info *info);
80
81 #endif