ARM Shanghai IoT Team (Internal) / newMiniTLS-GPL

Fork of MiniTLS-GPL by Donatien Garnier

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers buffer_network.h Source File

buffer_network.h

Go to the documentation of this file.
00001 /*
00002 MiniTLS - A super trimmed down TLS/SSL Library for embedded devices
00003 Author: Donatien Garnier
00004 Copyright (C) 2013-2014 AppNearMe Ltd
00005 
00006 This program is free software; you can redistribute it and/or
00007 modify it under the terms of the GNU General Public License
00008 as published by the Free Software Foundation; either version 2
00009 of the License, or (at your option) any later version.
00010 
00011 This program is distributed in the hope that it will be useful,
00012 but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 GNU General Public License for more details.
00015 
00016 You should have received a copy of the GNU General Public License
00017 along with this program; if not, write to the Free Software
00018 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00019 *//**
00020  * \file buffer_network.h
00021  * \copyright Copyright (c) AppNearMe Ltd 2013
00022  * \author Donatien Garnier
00023  */
00024 
00025 #ifndef BUFFER_NETWORK_H_
00026 #define BUFFER_NETWORK_H_
00027 
00028 #ifdef __cplusplus
00029 extern "C" {
00030 #endif
00031 
00032 #include "core/fwk.h"
00033 
00034 //Helpers for buffers in Big Endian format
00035 
00036 uint8_t buffer_nu8_read(buffer_t* buffer);
00037 uint16_t buffer_nu16_read(buffer_t* buffer);
00038 uint32_t buffer_nu24_read(buffer_t* buffer);
00039 uint32_t buffer_nu32_read(buffer_t* buffer);
00040 uint64_t buffer_nu64_read(buffer_t* buffer);
00041 void buffer_nbytes_read(buffer_t* buffer, uint8_t* data, size_t size);
00042 void buffer_n_discard(buffer_t* buffer, size_t size);
00043 uint8_t* buffer_current_read_position(buffer_t* buffer);
00044 size_t buffer_get_read_offset(buffer_t* buffer);
00045 void buffer_set_read_offset(buffer_t* buffer, size_t off);
00046 
00047 void buffer_nu8_write(buffer_t* buffer, uint8_t hu8);
00048 void buffer_nu16_write(buffer_t* buffer, uint16_t hu16);
00049 void buffer_nu24_write(buffer_t* buffer, uint32_t hu24);
00050 void buffer_nu32_write(buffer_t* buffer, uint32_t hu32);
00051 void buffer_nu64_write(buffer_t* buffer, uint64_t hu64);
00052 void buffer_nbytes_write(buffer_t* buffer, const uint8_t* data, size_t size);
00053 void buffer_n_skip(buffer_t* buffer, size_t size);
00054 uint8_t* buffer_current_write_position(buffer_t* buffer);
00055 
00056 #ifdef __cplusplus
00057 }
00058 #endif
00059 
00060 #endif /* BUFFER_NETWORK_H_ */