# Endianness (Network)
[CO_ENDIAN]

Endianness conversion functions for Network data. More...

Collaboration diagram for Endianness (Network):

## Functions
__INLINE uint32_t | co_htonl (uint32_t hostlong)
| Convert host to network long word.
__INLINE uint16_t | co_htons (uint16_t hostshort)
| Convert host to network short word.
__INLINE uint32_t | co_ntohl (uint32_t netlong)
| Convert network to host long word.
__INLINE uint16_t | co_ntohs (uint16_t netshort)
| Convert network to host short word.

## Detailed Description

Endianness conversion functions for Network data.

Converts values between the local system and big-endian network data (e.g. IP, Ethernet, but NOT WLAN).

The host term in the descriptions of these functions refers to the local system, i.e. application or embedded system. Therefore, these functions will behave differently depending on which side they are used. The reason of this terminology is to keep the same name than the standard C function.

Behavior will depends on the endianness of the host:

- little endian: swap bytes;
- big endian: identity function.

## Function Documentation

__INLINE uint32_t co_htonl | ( | uint32_t | hostlong | ) |

Convert host to network long word.

Parameters:

  `[in]` | hostlong | Long word value to convert.

Returns:
  The converted long word.

Definition at line 103 of file co_endian.h.

References co_bswap32().

Referenced by co_ntohl().

__INLINE uint16_t co_htons | ( | uint16_t | hostshort | ) |

Convert host to network short word.

Parameters:

  `[in]` | hostshort | Short word value to convert.

Returns:
  The converted short word.

Definition at line 120 of file co_endian.h.

References co_bswap16().

Referenced by co_ntohs(), rxu_cntrl_mac2eth_update(), and txu_cntrl_amsdu_hdr_append().

__INLINE uint32_t co_ntohl | ( | uint32_t | netlong | ) |

Convert network to host long word.

Parameters:

  `[in]` | netlong | Long word value to convert.

Returns:
  The converted long word.

Definition at line 137 of file co_endian.h.

References co_htonl().

__INLINE uint16_t co_ntohs | ( | uint16_t | netshort | ) |

Convert network to host short word.

Parameters:

  `[in]` | netshort | Short word value to convert.

Returns:
  The converted short word.

Definition at line 150 of file co_endian.h.

References co_htons().

Referenced by me_sta_add_req_handler(), mm_set_vif_state_cfm_handler(), txu_cntrl_llc_hdr_append(), txu_cntrl_mac_hdr_append(), txu_cntrl_sec_hdr_append(), txu_cntrl_sechdr_len_compute(), and txu_cntrl_umacdesc_prep().