Endianness conversion functions. More...
|
Modules | |
| Endianness (Network) | |
Endianness conversion functions for Network data. | |
| Endianness (WLAN) | |
Endianness conversion functions for WLAN data. | |
Functions | |
| __INLINE uint32_t | co_bswap32 (uint32_t val32) |
| Swap bytes of a 32 bits value. | |
| __INLINE uint16_t | co_bswap16 (uint16_t val16) |
| Swap bytes of a 16 bits value. | |
Endianness conversion functions.
This set of functions converts values between the local system and a external one. It is inspired from the htonl-like functions from the standard C library.
Exemple:
struct eth_header *header = get_header(); // get pointer on Eth II packet header uint16_t eth_id; // will contain the type of the packet eth_id = co_ntohs(header->eth_id); // retrieve the type with correct endianness
| __INLINE uint16_t co_bswap16 | ( | uint16_t | val16 | ) |
Swap bytes of a 16 bits value.
The swap is done in every case. Should not be called directly.
| [in] | val16 | The 16 bit value to swap. |
Definition at line 69 of file co_endian.h.
Referenced by co_htons(), and co_htows().
| __INLINE uint32_t co_bswap32 | ( | uint32_t | val32 | ) |
Swap bytes of a 32 bits value.
The swap is done in every case. Should not be called directly.
| [in] | val32 | The 32 bits value to swap. |
Definition at line 55 of file co_endian.h.
Referenced by co_htonl(), and co_htowl().
1.6.1