repo.or.cz
/
scuttle.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Merge branches 'master' and 'mob' of http://repo.or.cz/r/scuttle
[scuttle.git]
/
include
/
bytequeue.h
blob
e489f0c6caec89763164399b37ac37375f7c3cb4
1
2
#ifndef _BYTEQUEUE_H_
3
#define _BYTEQUEUE_H_
4
5
#include <common.h>
6
7
#ifndef BYTEQUEUE_DEFAULT_BLOCK_SIZE
8
#define BYTEQUEUE_DEFAULT_BLOCK_SIZE 1024
9
//consider changing to 4096
10
#endif
11
12
class
ByteQueue
13
{
14
char
*
d
;
15
uint32_t
s
,
rs
;
16
public
:
17
ByteQueue
();
18
~
ByteQueue
();
19
20
uint32_t
size
()
21
{
22
return
s
;
23
}
24
uint32_t
append
(
const char
*
data
,
uint32_t
size
);
25
uint32_t
append
(
const
ByteQueue
&
queue
);
26
char
*
data
()
27
{
28
return
d
;
29
}
30
void
clean
()
31
{
32
s
=
rs
=
0
;
33
if
(
d
)
free
(
d
);
34
d
=
NULL
;
35
}
36
};
37
38
39
40
41
#endif