# CO_ENDIAN
[COMMON]

Endianness conversion functions. More...

Collaboration diagram for CO_ENDIAN:

## 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.

## Detailed Description

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

## Function Documentation

__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.

Parameters:

  `[in]` | val16 | The 16 bit value to swap.

Returns:
  The 16 bit swapped value.

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.

Parameters:

  `[in]` | val32 | The 32 bits value to swap.

Returns:
  The 32 bit swapped value.

Definition at line 55 of file co_endian.h.

Referenced by co_htonl(), and co_htowl().