change some parameters in the library to meet the needs of the website httpbin.org

Fork of MiniTLS-GPL by Donatien Garnier

Committer:
MiniTLS
Date:
Mon Jun 09 14:57:54 2014 +0000
Revision:
2:527a66d0a1a9
Change name to MiniTLS and added doc

Who changed what in which revision?

UserRevisionLine numberNew contents of line
MiniTLS 2:527a66d0a1a9 1 /*
MiniTLS 2:527a66d0a1a9 2 MiniTLS - A super trimmed down TLS/SSL Library for embedded devices
MiniTLS 2:527a66d0a1a9 3 Author: Donatien Garnier
MiniTLS 2:527a66d0a1a9 4 Copyright (C) 2013-2014 AppNearMe Ltd
MiniTLS 2:527a66d0a1a9 5
MiniTLS 2:527a66d0a1a9 6 This program is free software; you can redistribute it and/or
MiniTLS 2:527a66d0a1a9 7 modify it under the terms of the GNU General Public License
MiniTLS 2:527a66d0a1a9 8 as published by the Free Software Foundation; either version 2
MiniTLS 2:527a66d0a1a9 9 of the License, or (at your option) any later version.
MiniTLS 2:527a66d0a1a9 10
MiniTLS 2:527a66d0a1a9 11 This program is distributed in the hope that it will be useful,
MiniTLS 2:527a66d0a1a9 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
MiniTLS 2:527a66d0a1a9 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
MiniTLS 2:527a66d0a1a9 14 GNU General Public License for more details.
MiniTLS 2:527a66d0a1a9 15
MiniTLS 2:527a66d0a1a9 16 You should have received a copy of the GNU General Public License
MiniTLS 2:527a66d0a1a9 17 along with this program; if not, write to the Free Software
MiniTLS 2:527a66d0a1a9 18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
MiniTLS 2:527a66d0a1a9 19 *//**
MiniTLS 2:527a66d0a1a9 20 * \file buffer.h
MiniTLS 2:527a66d0a1a9 21 * \copyright Copyright (c) AppNearMe Ltd 2013
MiniTLS 2:527a66d0a1a9 22 * \author Donatien Garnier
MiniTLS 2:527a66d0a1a9 23 */
MiniTLS 2:527a66d0a1a9 24
MiniTLS 2:527a66d0a1a9 25 #ifndef BUFFER_H_
MiniTLS 2:527a66d0a1a9 26 #define BUFFER_H_
MiniTLS 2:527a66d0a1a9 27
MiniTLS 2:527a66d0a1a9 28 #ifdef __cplusplus
MiniTLS 2:527a66d0a1a9 29 extern "C" {
MiniTLS 2:527a66d0a1a9 30 #endif
MiniTLS 2:527a66d0a1a9 31
MiniTLS 2:527a66d0a1a9 32 #include "core/fwk.h"
MiniTLS 2:527a66d0a1a9 33
MiniTLS 2:527a66d0a1a9 34 typedef struct __buffer
MiniTLS 2:527a66d0a1a9 35 {
MiniTLS 2:527a66d0a1a9 36 uint8_t* bufdata;
MiniTLS 2:527a66d0a1a9 37 size_t size;
MiniTLS 2:527a66d0a1a9 38
MiniTLS 2:527a66d0a1a9 39 uint8_t* start;
MiniTLS 2:527a66d0a1a9 40 size_t first_byte_length; //In bits
MiniTLS 2:527a66d0a1a9 41
MiniTLS 2:527a66d0a1a9 42 uint8_t* end;
MiniTLS 2:527a66d0a1a9 43 size_t last_byte_length; //In bits
MiniTLS 2:527a66d0a1a9 44
MiniTLS 2:527a66d0a1a9 45 struct __buffer* next;
MiniTLS 2:527a66d0a1a9 46
MiniTLS 2:527a66d0a1a9 47 } buffer_t;
MiniTLS 2:527a66d0a1a9 48
MiniTLS 2:527a66d0a1a9 49 void buffer_init(buffer_t* pBuf, uint8_t* bufdata, size_t size);
MiniTLS 2:527a66d0a1a9 50
MiniTLS 2:527a66d0a1a9 51 void buffer_byref(buffer_t* pBuf, uint8_t* bufdata, size_t length); //New buffer by ref on a size_t array, no malloc (useful on PIC for instance)
MiniTLS 2:527a66d0a1a9 52
MiniTLS 2:527a66d0a1a9 53 buffer_t* buffer_new(size_t size); //malloc
MiniTLS 2:527a66d0a1a9 54
MiniTLS 2:527a66d0a1a9 55 uint8_t* buffer_data(buffer_t* pBuf);
MiniTLS 2:527a66d0a1a9 56
MiniTLS 2:527a66d0a1a9 57 void buffer_reset(buffer_t* pBuf);
MiniTLS 2:527a66d0a1a9 58
MiniTLS 2:527a66d0a1a9 59 size_t buffer_size(buffer_t* pBuf);
MiniTLS 2:527a66d0a1a9 60
MiniTLS 2:527a66d0a1a9 61 size_t buffer_length(buffer_t* pBuf);
MiniTLS 2:527a66d0a1a9 62
MiniTLS 2:527a66d0a1a9 63 size_t buffer_space(buffer_t* pBuf);
MiniTLS 2:527a66d0a1a9 64
MiniTLS 2:527a66d0a1a9 65 bool buffer_empty(buffer_t* pBuf);
MiniTLS 2:527a66d0a1a9 66
MiniTLS 2:527a66d0a1a9 67 void buffer_set_length(buffer_t* pBuf, size_t length);
MiniTLS 2:527a66d0a1a9 68
MiniTLS 2:527a66d0a1a9 69 size_t buffer_last_byte_length(buffer_t* pBuf);
MiniTLS 2:527a66d0a1a9 70
MiniTLS 2:527a66d0a1a9 71 void buffer_set_last_byte_length(buffer_t* pBuf, size_t length);
MiniTLS 2:527a66d0a1a9 72
MiniTLS 2:527a66d0a1a9 73 size_t buffer_bits_count(buffer_t* pBuf);
MiniTLS 2:527a66d0a1a9 74
MiniTLS 2:527a66d0a1a9 75 void buffer_write_byte(buffer_t* pBuf, uint8_t b);
MiniTLS 2:527a66d0a1a9 76
MiniTLS 2:527a66d0a1a9 77 void buffer_write_bit(buffer_t* pBuf, uint8_t b);
MiniTLS 2:527a66d0a1a9 78
MiniTLS 2:527a66d0a1a9 79 #if 0
MiniTLS 2:527a66d0a1a9 80 size_t buffer_read_byte(buffer_t* pBuf, uint8_t b);
MiniTLS 2:527a66d0a1a9 81
MiniTLS 2:527a66d0a1a9 82 size_t buffer_read_bit(buffer_t* pBuf, uint8_t b);
MiniTLS 2:527a66d0a1a9 83 #endif
MiniTLS 2:527a66d0a1a9 84
MiniTLS 2:527a66d0a1a9 85 buffer_t* buffer_next(buffer_t* pBuf);
MiniTLS 2:527a66d0a1a9 86
MiniTLS 2:527a66d0a1a9 87 void buffer_set_next(buffer_t* pBuf, buffer_t* pNextBuf);
MiniTLS 2:527a66d0a1a9 88
MiniTLS 2:527a66d0a1a9 89 void buffer_append(buffer_t* pBuf, buffer_t* pAppBuf);
MiniTLS 2:527a66d0a1a9 90
MiniTLS 2:527a66d0a1a9 91 void buffer_unlink(buffer_t* pBuf, buffer_t* pLinkedBuf);
MiniTLS 2:527a66d0a1a9 92
MiniTLS 2:527a66d0a1a9 93 size_t buffer_total_size(buffer_t* pBuf);
MiniTLS 2:527a66d0a1a9 94
MiniTLS 2:527a66d0a1a9 95 size_t buffer_total_length(buffer_t* pBuf);
MiniTLS 2:527a66d0a1a9 96
MiniTLS 2:527a66d0a1a9 97 void buffer_set_total_length(buffer_t* pBuf, size_t length);
MiniTLS 2:527a66d0a1a9 98
MiniTLS 2:527a66d0a1a9 99 void buffer_free(buffer_t* pBuf);
MiniTLS 2:527a66d0a1a9 100
MiniTLS 2:527a66d0a1a9 101 //Debug
MiniTLS 2:527a66d0a1a9 102 void buffer_dump(buffer_t* pBuf);
MiniTLS 2:527a66d0a1a9 103
MiniTLS 2:527a66d0a1a9 104 #ifdef __cplusplus
MiniTLS 2:527a66d0a1a9 105 }
MiniTLS 2:527a66d0a1a9 106 #endif
MiniTLS 2:527a66d0a1a9 107
MiniTLS 2:527a66d0a1a9 108 #endif /* BUFFER_H_ */