summaryrefslogtreecommitdiffstats
path: root/rtrlib/lib/convert_byte_order_private.h
blob: 839f82b76d734844fee52409d0f71fc6df5fc03d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*
 * This file is part of RTRlib.
 *
 * This file is subject to the terms and conditions of the MIT license.
 * See the file LICENSE in the top level directory for more details.
 *
 * Website: http://rtrlib.realmv6.org/
 */

#ifndef LRTR_CONVERT_BYTE_ORDER_PRIVATE_H
#define LRTR_CONVERT_BYTE_ORDER_PRIVATE_H

#include <inttypes.h>

/**
 * @brief Target byte order for conversion.
 */
enum target_byte_order {
	TO_NETWORK_BYTE_ORDER,
	TO_HOST_HOST_BYTE_ORDER,
};

/**
 * Converts the passed short value to the given target byte order.
 * @param[in] tbo Target byte order.
 * @param[in] value Input (uint16_t) for conversion.
 * @result Converted uint16_t value.
 */
uint16_t lrtr_convert_short(const enum target_byte_order tbo, const uint16_t value);

/**
 * Converts the passed long value to the given target byte order.
 * @param[in] tbo Target byte order.
 * @param[in] value Input (uint32_t) for conversion.
 * @result Converted uint32_t value.
 */
uint32_t lrtr_convert_long(const enum target_byte_order tbo, const uint32_t value);

#endif /* LRTR_CONVERT_BYTE_ORDER_H */