]> git.cryptolib.org Git - arm-crypto-lib.git/blob - test_src/circularbytebuffer.h
clearification of keysize descriptor stuff
[arm-crypto-lib.git] / test_src / circularbytebuffer.h
1 /* circularbytebuffer.h */
2 /*
3     This file is part of the ARM-circularbytebuffer.
4     Copyright (C) 2009  Daniel Otte (daniel.otte@rub.de)
5
6     This program is free software: you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation, either version 3 of the License, or
9     (at your option) any later version.
10
11     This program is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15
16     You should have received a copy of the GNU General Public License
17     along with this program.  If not, see <http://www.gnu.org/licenses/>.
18 */
19 /**
20  * \file     circularbytebuffer.h
21  * \email    daniel.otte@rub.de
22  * \author   Daniel Otte 
23  * \date     2009-07-24
24  * \license  GPLv3 or later
25  * \ingroup  circularbytebuffer
26  * \brief    declaration for circular byte buffer
27  */
28  
29 #ifndef CIRCULARBYTEBUFFER_H_
30 #define CIRCULARBYTEBUFFER_H_
31
32 #include <stdint.h>
33 #include <stdlib.h>
34  
35  typedef struct {
36          uint32_t buffer_size;
37          uint32_t fillcount;
38          uint8_t* buffer;
39          uint8_t* head;
40          uint8_t* tail;
41          uint8_t* top;
42 } circularbytebuffer_t;
43
44
45 #if CIRCULARBYTEBUFFER_NO_MALLOC==0
46 uint8_t circularbytebuffer_init(uint32_t buffersize, circularbytebuffer_t* cb);
47 #endif
48 #if CIRCULARBYTEBUFFER_NO_INIT2==0
49 void    circularbytebuffer_init2(uint32_t buffersize, circularbytebuffer_t* cb, void* buffer);
50 #endif
51 uint16_t circularbytebuffer_get_lifo(circularbytebuffer_t* cb);
52 uint16_t circularbytebuffer_get_fifo(circularbytebuffer_t* cb);
53 uint8_t  circularbytebuffer_append(uint8_t, circularbytebuffer_t* cb);
54 uint8_t  circularbytebuffer_push(uint8_t, circularbytebuffer_t* cb);
55 uint32_t circularbytebuffer_cnt(circularbytebuffer_t* cb);
56 void circularbytebuffer_free(circularbytebuffer_t* cb);
57
58 #endif /* CIRCULARBYTEBUFFER_H_ */