The friendly Operating System for the Internet of Things
byteorder.h File Reference

Functions to work with different byte orders. More...

Detailed Description

#include <stdint.h>
+ Include dependency graph for byteorder.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

union  le_uint16_t
 A 16 bit integer in little endian. More...
 
union  le_uint32_t
 A 32 bit integer in little endian. More...
 
union  le_uint64_t
 A 64 bit integer in little endian. More...
 
union  be_uint16_t
 A 16 bit integer in big endian aka network byte order. More...
 
union  be_uint32_t
 A 32 bit integer in big endian aka network byte order. More...
 
union  be_uint64_t
 A 64 bit integer in big endian aka network byte order. More...
 

Macros

#define _byteorder_swap(V, T)   (byteorder_swap##T((V)))
 Swaps the byteorder according to the endianess.
 

Typedefs

typedef be_uint16_t network_uint16_t
 A 16 bit integer in network byte order.
 
typedef be_uint32_t network_uint32_t
 A 32 bit integer in network byte order.
 
typedef be_uint64_t network_uint64_t
 A 64 bit integer in network byte order.
 

Functions

static be_uint16_t byteorder_ltobs (le_uint16_t v)
 Convert from little endian to big endian, 16 bit. More...
 
static be_uint32_t byteorder_ltobl (le_uint32_t v)
 Convert from little endian to big endian, 32 bit. More...
 
static be_uint64_t byteorder_ltobll (le_uint64_t v)
 Convert from little endian to big endian, 64 bit. More...
 
static le_uint16_t byteorder_btols (be_uint16_t v)
 Convert from big endian to little endian, 16 bit. More...
 
static le_uint32_t byteorder_btoll (be_uint32_t v)
 Convert from big endian to little endian, 32 bit. More...
 
static le_uint64_t byteorder_btolll (be_uint64_t v)
 Convert from big endian to little endian, 64 bit. More...
 
static network_uint16_t byteorder_htons (uint16_t v)
 Convert from host byte order to network byte order, 16 bit. More...
 
static network_uint32_t byteorder_htonl (uint32_t v)
 Convert from host byte order to network byte order, 32 bit. More...
 
static network_uint64_t byteorder_htonll (uint64_t v)
 Convert from host byte order to network byte order, 64 bit. More...
 
static uint16_t byteorder_ntohs (network_uint16_t v)
 Convert from network byte order to host byte order, 16 bit. More...
 
static uint32_t byteorder_ntohl (network_uint32_t v)
 Convert from network byte order to host byte order, 32 bit. More...
 
static uint64_t byteorder_ntohll (network_uint64_t v)
 Convert from network byte order to host byte order, 64 bit. More...
 
static uint16_t byteorder_swaps (uint16_t v)
 Swap byte order, 16 bit. More...
 
static uint32_t byteorder_swapl (uint32_t v)
 Swap byte order, 32 bit. More...
 
static uint64_t byteorder_swapll (uint64_t v)
 Swap byte order, 64 bit. More...
 
static uint16_t HTONS (uint16_t v)
 Convert from host byte order to network byte order, 16 bit. More...
 
static uint32_t HTONL (uint32_t v)
 Convert from host byte order to network byte order, 32 bit. More...
 
static uint64_t HTONLL (uint64_t v)
 Convert from host byte order to network byte order, 64 bit. More...
 
static uint16_t NTOHS (uint16_t v)
 Convert from network byte order to host byte order, 16 bit. More...
 
static uint32_t NTOHL (uint32_t v)
 Convert from network byte order to host byte order, 32 bit. More...
 
static uint64_t NTOHLL (uint64_t v)
 Convert from network byte order to host byte order, 64 bit. More...