csp_endian.h
Go to the documentation of this file.
1 /*
2 Cubesat Space Protocol - A small network-layer protocol designed for Cubesats
3 Copyright (C) 2012 GomSpace ApS (http://www.gomspace.com)
4 Copyright (C) 2012 AAUSAT3 Project (http://aausat3.space.aau.dk)
5 
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
10 
11 This library 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 GNU
14 Lesser General Public License for more details.
15 
16 You should have received a copy of the GNU Lesser General Public
17 License along with this library; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20 
27 #ifndef _CSP_ENDIAN_H_
28 #define _CSP_ENDIAN_H_
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 #include <stdint.h>
35 
40 uint16_t csp_hton16(uint16_t h16);
41 
46 uint16_t csp_ntoh16(uint16_t n16);
47 
52 uint32_t csp_hton32(uint32_t h32);
53 
58 uint32_t csp_ntoh32(uint32_t n32);
59 
64 uint64_t csp_hton64(uint64_t h64);
65 
70 uint64_t csp_ntoh64(uint64_t n64);
71 
76 uint16_t csp_htobe16(uint16_t h16);
77 
82 uint16_t csp_htole16(uint16_t h16);
83 
88 uint16_t csp_betoh16(uint16_t be16);
89 
94 uint16_t csp_letoh16(uint16_t le16);
95 
100 uint32_t csp_htobe32(uint32_t h32);
101 
106 uint32_t csp_htole32(uint32_t h32);
107 
112 uint32_t csp_betoh32(uint32_t be32);
113 
118 uint32_t csp_letoh32(uint32_t le32);
119 
124 uint64_t csp_htobe64(uint64_t h64);
125 
130 uint64_t csp_htole64(uint64_t h64);
131 
136 uint64_t csp_betoh64(uint64_t be64);
137 
142 uint64_t csp_letoh64(uint64_t le64);
143 
149 float csp_htonflt(float f);
150 
156 float csp_ntohflt(float f);
157 
163 double csp_htondbl(double d);
164 
170 double csp_ntohdbl(double d);
171 
172 #ifdef __cplusplus
173 } /* extern "C" */
174 #endif
175 
176 #endif // _CSP_ENDIAN_H_
177 
178 /* @} */
uint32_t csp_betoh32(uint32_t be32)
Convert 32-bit integer from big endian byte order to host byte order.
uint16_t csp_htole16(uint16_t h16)
Convert 16-bit integer from host byte order to little endian byte order.
uint64_t csp_letoh64(uint64_t le64)
Convert 64-bit integer from little endian byte order to host byte order.
uint32_t csp_ntoh32(uint32_t n32)
Convert 32-bit integer from host byte order to host byte order.
uint64_t csp_betoh64(uint64_t be64)
Convert 64-bit integer from big endian byte order to host byte order.
uint64_t csp_hton64(uint64_t h64)
Convert 64-bit integer from host byte order to network byte order.
uint64_t csp_htole64(uint64_t h64)
Convert 64-bit integer from host byte order to little endian byte order.
uint32_t csp_hton32(uint32_t h32)
Convert 32-bit integer from host byte order to network byte order.
double csp_htondbl(double d)
Convert double from host to network byte order.
uint16_t csp_ntoh16(uint16_t n16)
Convert 16-bit integer from host byte order to host byte order.
uint16_t csp_hton16(uint16_t h16)
Convert 16-bit integer from host byte order to network byte order.
double csp_ntohdbl(double d)
Convert double from network to host order.
uint64_t csp_htobe64(uint64_t h64)
Convert 64-bit integer from host byte order to big endian byte order.
uint16_t csp_betoh16(uint16_t be16)
Convert 16-bit integer from big endian byte order to little endian byte order.
uint64_t csp_ntoh64(uint64_t n64)
Convert 64-bit integer from host byte order to host byte order.
uint16_t csp_letoh16(uint16_t le16)
Convert 16-bit integer from little endian byte order to host byte order.
uint16_t csp_htobe16(uint16_t h16)
Convert 16-bit integer from host byte order to big endian byte order.
uint32_t csp_htole32(uint32_t h32)
Convert 32-bit integer from little endian byte order to host byte order.
uint32_t csp_htobe32(uint32_t h32)
Convert 32-bit integer from host byte order to big endian byte order.
float csp_ntohflt(float f)
Convert float from network to host byte order.
uint32_t csp_letoh32(uint32_t le32)
Convert 32-bit integer from little endian byte order to host byte order.
float csp_htonflt(float f)
Convert float from host to network byte order.