00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef ROHC_UTILS_H
00026 #define ROHC_UTILS_H
00027
00028 #include <stdint.h>
00029 #include <stdbool.h>
00030
00031
00032
00033 typedef enum
00034 {
00035 ROHC_TRISTATE_NONE = 0,
00036 ROHC_TRISTATE_YES = 1,
00037 ROHC_TRISTATE_NO = 2,
00038 } rohc_tristate_t;
00039
00040
00041
00042 #define rohc_max(value1, value2) \
00043 ( ((value1) >= (value2)) ? (value1) : (value2) )
00044
00045
00046 #define rohc_min(value1, value2) \
00047 ( ((value1) <= (value2)) ? (value1) : (value2) )
00048
00049
00050 static inline unsigned int rohc_b2u(const bool boolean)
00051 __attribute__((warn_unused_result, const));
00052
00053 uint32_t rohc_ntoh32(const uint32_t net32)
00054 __attribute__((warn_unused_result, const));
00055 uint16_t rohc_ntoh16(const uint16_t net16)
00056 __attribute__((warn_unused_result, const));
00057 uint32_t rohc_hton32(const uint32_t host32)
00058 __attribute__((warn_unused_result, const));
00059 uint16_t rohc_hton16(const uint16_t host16)
00060 __attribute__((warn_unused_result, const));
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071 static inline unsigned int rohc_b2u(const bool boolean)
00072 {
00073 return (boolean ? 1 : 0);
00074 }
00075
00076 #endif
00077