blob: cc864c47d1a1ec169ab6ad389ca0a6ffa8ac50dc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
/**
* Buffering Central
* (C) 2009 Jack Lloyd
*
* Distributed under the terms of the Botan license
*/
#ifndef BOTAN_BUFFERED_OPTION_H__
#define BOTAN_BUFFERED_OPTION_H__
#include <botan/types.h>
#include <tr1/functional>
#include <vector>
namespace Botan {
class BOTAN_DLL Buffered_Operation
{
public:
typedef std::tr1::function<void (const byte[], size_t)> callback_fn;
void write(const byte input[], size_t input_size);
void final();
void reset();
size_t current_position() const { return buffer_pos; }
Buffered_Operation(callback_fn main_block,
callback_fn final_block,
size_t main_buf_mod,
size_t final_minimum = 0);
private:
callback_fn main_fn, final_fn;
size_t final_minimum, main_block_mod;
std::vector<byte> buffer;
size_t buffer_pos;
};
}
#endif
|