Functions to work with different byte orders. More...
Functions to work with different byte orders.
Definition in file byteorder.h.
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... | |
#define | _byteorder_swap(V, T) (byteorder_swap ## T((V))) |
Swaps the byteorder according to the endianness. | |
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. | |
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 | byteorder_bebuftohs (const uint8_t *buf) |
Read a big endian encoded unsigned integer from a buffer into host byte order encoded variable, 16-bit. More... | |
static uint32_t | byteorder_bebuftohl (const uint8_t *buf) |
Read a big endian encoded unsigned integer from a buffer into host byte order encoded variable, 32-bit. More... | |
static uint64_t | byteorder_bebuftohll (const uint8_t *buf) |
Read a big endian encoded unsigned integer from a buffer into host byte order encoded variable, 64-bit. More... | |
static void | byteorder_htobebufs (uint8_t *buf, uint16_t val) |
Write a host byte order encoded unsigned integer as big endian encoded value into a buffer, 16-bit. More... | |
static void | byteorder_htobebufl (uint8_t *buf, uint32_t val) |
Write a host byte order encoded unsigned integer as big endian encoded value into a buffer, 32-bit. More... | |
static void | byteorder_htobebufll (uint8_t *buf, uint64_t val) |
Write a host byte order encoded unsigned integer as big endian encoded value into a buffer, 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... | |
|
inlinestatic |
Read a big endian encoded unsigned integer from a buffer into host byte order encoded variable, 32-bit.
[in] | buf | position in a buffer holding the target value |
Definition at line 520 of file byteorder.h.
|
inlinestatic |
Read a big endian encoded unsigned integer from a buffer into host byte order encoded variable, 64-bit.
[in] | buf | position in a buffer holding the target value |
Definition at line 534 of file byteorder.h.
|
inlinestatic |
Read a big endian encoded unsigned integer from a buffer into host byte order encoded variable, 16-bit.
[in] | buf | position in a buffer holding the target value |
Definition at line 509 of file byteorder.h.
|
inlinestatic |
Convert from big endian to little endian, 32 bit.
[in] | v | The integer in big endian. |
v
converted to little endian. Definition at line 412 of file byteorder.h.
|
inlinestatic |
Convert from big endian to little endian, 64 bit.
[in] | v | The integer in big endian. |
v
converted to little endian. Definition at line 419 of file byteorder.h.
|
inlinestatic |
Convert from big endian to little endian, 16 bit.
[in] | v | The integer in big endian. |
v
converted to little endian. Definition at line 405 of file byteorder.h.
|
inlinestatic |
Write a host byte order encoded unsigned integer as big endian encoded value into a buffer, 32-bit.
[out] | buf | target buffer, must be able to accept 4 bytes |
[in] | val | value written to the buffer, in host byte order |
Definition at line 564 of file byteorder.h.
|
inlinestatic |
Write a host byte order encoded unsigned integer as big endian encoded value into a buffer, 64-bit.
[out] | buf | target buffer, must be able to accept 8 bytes |
[in] | val | value written to the buffer, in host byte order |
Definition at line 578 of file byteorder.h.
|
inlinestatic |
Write a host byte order encoded unsigned integer as big endian encoded value into a buffer, 16-bit.
[out] | buf | target buffer, must be able to accept 2 bytes |
[in] | val | value written to the buffer, in host byte order |
Definition at line 552 of file byteorder.h.
|
inlinestatic |
Convert from host byte order to network byte order, 32 bit.
[in] | v | The integer in host byte order. |
v
converted to network byte order. Definition at line 444 of file byteorder.h.
|
inlinestatic |
Convert from host byte order to network byte order, 64 bit.
[in] | v | The integer in host byte order. |
v
converted to network byte order. Definition at line 451 of file byteorder.h.
|
inlinestatic |
Convert from host byte order to network byte order, 16 bit.
[in] | v | The integer in host byte order. |
v
converted to network byte order. Definition at line 437 of file byteorder.h.
|
inlinestatic |
Convert from little endian to big endian, 32 bit.
[in] | v | The integer in little endian. |
v
converted to big endian. Definition at line 391 of file byteorder.h.
|
inlinestatic |
Convert from little endian to big endian, 64 bit.
[in] | v | The integer in little endian. |
v
converted to big endian. Definition at line 398 of file byteorder.h.
|
inlinestatic |
Convert from little endian to big endian, 16 bit.
[in] | v | The integer in little endian. |
v
converted to big endian. Definition at line 384 of file byteorder.h.
|
inlinestatic |
Convert from network byte order to host byte order, 32 bit.
[in] | v | The integer in network byte order. |
v
converted to host byte order. Definition at line 463 of file byteorder.h.
|
inlinestatic |
Convert from network byte order to host byte order, 64 bit.
[in] | v | The integer in network byte order. |
v
converted to host byte order. Definition at line 468 of file byteorder.h.
|
inlinestatic |
Convert from network byte order to host byte order, 16 bit.
[in] | v | The integer in network byte order. |
v
converted to host byte order. Definition at line 458 of file byteorder.h.
|
inlinestatic |
Swap byte order, 32 bit.
[in] | v | The integer to swap. |
Definition at line 374 of file byteorder.h.
|
inlinestatic |
Swap byte order, 64 bit.
[in] | v | The integer to swap. |
Definition at line 379 of file byteorder.h.
|
inlinestatic |
Swap byte order, 16 bit.
[in] | v | The integer to swap. |
Definition at line 361 of file byteorder.h.
|
inlinestatic |
Convert from host byte order to network byte order, 32 bit.
[in] | v | The integer to convert. |
Definition at line 478 of file byteorder.h.
|
inlinestatic |
Convert from host byte order to network byte order, 64 bit.
[in] | v | The integer to convert. |
Definition at line 483 of file byteorder.h.
|
inlinestatic |
Convert from host byte order to network byte order, 16 bit.
[in] | v | The integer to convert. |
Definition at line 473 of file byteorder.h.
|
inlinestatic |
Convert from network byte order to host byte order, 32 bit.
[in] | v | The integer to convert. |
Definition at line 495 of file byteorder.h.
|
inlinestatic |
Convert from network byte order to host byte order, 64 bit.
[in] | v | The integer to convert. |
Definition at line 502 of file byteorder.h.
|
inlinestatic |
Convert from network byte order to host byte order, 16 bit.
[in] | v | The integer to convert. |
Definition at line 488 of file byteorder.h.