Rev 4261 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4261 | Rev 4756 | ||
---|---|---|---|
Line 44... | Line 44... | ||
44 | #ifdef ARCH_IS_BIG_ENDIAN |
44 | #ifdef ARCH_IS_BIG_ENDIAN |
45 | 45 | ||
46 | // Already in the network byte order. |
46 | // Already in the network byte order. |
47 | 47 | ||
48 | /** Converts the given short number ( 16 bit ) from the host byte order to the network byte order ( big endian ). |
48 | /** Converts the given short number ( 16 bit ) from the host byte order to the network byte order ( big endian ). |
49 | * @param number The number in the host byte order to be converted. |
49 | * @param[in] number The number in the host byte order to be converted. |
50 | * @returns The number in the network byte order. |
50 | * @returns The number in the network byte order. |
51 | */ |
51 | */ |
52 | #define htons( number ) ( number ) |
52 | #define htons( number ) ( number ) |
53 | 53 | ||
54 | /** Converts the given long number ( 32 bit ) from the host byte order to the network byte order ( big endian ). |
54 | /** Converts the given long number ( 32 bit ) from the host byte order to the network byte order ( big endian ). |
55 | * @param number The number in the host byte order to be converted. |
55 | * @param[in] number The number in the host byte order to be converted. |
56 | * @returns The number in the network byte order. |
56 | * @returns The number in the network byte order. |
57 | */ |
57 | */ |
58 | #define htonl( number ) ( number ) |
58 | #define htonl( number ) ( number ) |
59 | 59 | ||
60 | /** Converts the given short number ( 16 bit ) from the network byte order ( big endian ) to the host byte order. |
60 | /** Converts the given short number ( 16 bit ) from the network byte order ( big endian ) to the host byte order. |
61 | * @param number The number in the network byte order to be converted. |
61 | * @param[in] number The number in the network byte order to be converted. |
62 | * @returns The number in the host byte order. |
62 | * @returns The number in the host byte order. |
63 | */ |
63 | */ |
64 | #define ntohs( number ) ( number ) |
64 | #define ntohs( number ) ( number ) |
65 | 65 | ||
66 | /** Converts the given long number ( 32 bit ) from the network byte order ( big endian ) to the host byte order. |
66 | /** Converts the given long number ( 32 bit ) from the network byte order ( big endian ) to the host byte order. |
67 | * @param number The number in the network byte order to be converted. |
67 | * @param[in] number The number in the network byte order to be converted. |
68 | * @returns The number in the host byte order. |
68 | * @returns The number in the host byte order. |
69 | */ |
69 | */ |
70 | #define ntohl( number ) ( number ) |
70 | #define ntohl( number ) ( number ) |
71 | 71 | ||
72 | #else |
72 | #else |
73 | 73 | ||
74 | // Has to be swapped. |
74 | // Has to be swapped. |
75 | 75 | ||
76 | /** Converts the given short number ( 16 bit ) from the host byte order to the network byte order ( big endian ). |
76 | /** Converts the given short number ( 16 bit ) from the host byte order to the network byte order ( big endian ). |
77 | * @param number The number in the host byte order to be converted. |
77 | * @param[in] number The number in the host byte order to be converted. |
78 | * @returns The number in the network byte order. |
78 | * @returns The number in the network byte order. |
79 | */ |
79 | */ |
80 | #define htons( number ) uint16_t_byteorder_swap(( uint16_t )( number )) |
80 | #define htons( number ) uint16_t_byteorder_swap(( uint16_t )( number )) |
81 | 81 | ||
82 | /** Converts the given long number ( 32 bit ) from the host byte order to the network byte order ( big endian ). |
82 | /** Converts the given long number ( 32 bit ) from the host byte order to the network byte order ( big endian ). |
83 | * @param number The number in the host byte order to be converted. |
83 | * @param[in] number The number in the host byte order to be converted. |
84 | * @returns The number in the network byte order. |
84 | * @returns The number in the network byte order. |
85 | */ |
85 | */ |
86 | #define htonl( number ) uint32_t_byteorder_swap( number ) |
86 | #define htonl( number ) uint32_t_byteorder_swap( number ) |
87 | 87 | ||
88 | /** Converts the given short number ( 16 bit ) from the network byte order ( big endian ) to the host byte order. |
88 | /** Converts the given short number ( 16 bit ) from the network byte order ( big endian ) to the host byte order. |
89 | * @param number The number in the network byte order to be converted. |
89 | * @param[in] number The number in the network byte order to be converted. |
90 | * @returns The number in the host byte order. |
90 | * @returns The number in the host byte order. |
91 | */ |
91 | */ |
92 | #define ntohs( number ) uint16_t_byteorder_swap(( uint16_t )( number )) |
92 | #define ntohs( number ) uint16_t_byteorder_swap(( uint16_t )( number )) |
93 | 93 | ||
94 | /** Converts the given long number ( 32 bit ) from the network byte order ( big endian ) to the host byte order. |
94 | /** Converts the given long number ( 32 bit ) from the network byte order ( big endian ) to the host byte order. |
95 | * @param number The number in the network byte order to be converted. |
95 | * @param[in] number The number in the network byte order to be converted. |
96 | * @returns The number in the host byte order. |
96 | * @returns The number in the host byte order. |
97 | */ |
97 | */ |
98 | #define ntohl( number ) uint32_t_byteorder_swap( number ) |
98 | #define ntohl( number ) uint32_t_byteorder_swap( number ) |
99 | 99 | ||
100 | #endif |
100 | #endif |