From: Arran Cudbard-Bell Date: Sat, 23 Jan 2021 11:59:45 +0000 (+0000) Subject: Fix type ordering, add missing types to FR_TYPE_FIXED_SIZE X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7730c4daf0276bda6f951bf38103c6fe1438ed65;p=thirdparty%2Ffreeradius-server.git Fix type ordering, add missing types to FR_TYPE_FIXED_SIZE --- diff --git a/src/lib/util/types.h b/src/lib/util/types.h index b35f493e2b5..38835300638 100644 --- a/src/lib/util/types.h +++ b/src/lib/util/types.h @@ -18,6 +18,7 @@ /** Types of values contained within an #fr_value_box_t * * These are in a separate header file to avoid circular dependencies. + * DO NOT ADD FUNCTION DECLARATIONS IN THIS FILE. * * @file src/lib/util/types.h * @@ -53,8 +54,6 @@ typedef enum { FR_TYPE_UINT32, //!< 32 Bit unsigned integer. FR_TYPE_UINT64, //!< 64 Bit unsigned integer. - FR_TYPE_SIZE, //!< Unsigned integer capable of representing any memory - //!< address on the local system. FR_TYPE_INT8, //!< 8 Bit signed integer. FR_TYPE_INT16, //!< 16 Bit signed integer. @@ -64,9 +63,12 @@ typedef enum { FR_TYPE_FLOAT32, //!< Single precision floating point. FR_TYPE_FLOAT64, //!< Double precision floating point. + FR_TYPE_DATE, //!< Unix time stamp, always has value >2^31 + FR_TYPE_TIME_DELTA, //!< A period of time measured in nanoseconds. - FR_TYPE_DATE, //!< Unix time stamp, always has value >2^31 + FR_TYPE_SIZE, //!< Unsigned integer capable of representing any memory + //!< address on the local system. FR_TYPE_TLV, //!< Contains nested attributes. FR_TYPE_STRUCT, //!< like TLV, but without T or L, and fixed-width children @@ -86,25 +88,28 @@ typedef enum { * functions that need to deal with all types representing values */ #define FR_TYPE_FIXED_SIZE \ - FR_TYPE_UINT8: \ - case FR_TYPE_UINT16: \ - case FR_TYPE_UINT32: \ - case FR_TYPE_UINT64: \ - case FR_TYPE_SIZE: \ - case FR_TYPE_DATE: \ - case FR_TYPE_IFID: \ - case FR_TYPE_ETHERNET: \ - case FR_TYPE_IPV4_ADDR: \ + FR_TYPE_IPV4_ADDR: \ case FR_TYPE_IPV4_PREFIX: \ case FR_TYPE_IPV6_ADDR: \ case FR_TYPE_IPV6_PREFIX: \ + case FR_TYPE_IFID: \ case FR_TYPE_COMBO_IP_ADDR: \ case FR_TYPE_COMBO_IP_PREFIX: \ + case FR_TYPE_ETHERNET: \ + case FR_TYPE_BOOL: \ + case FR_TYPE_UINT8: \ + case FR_TYPE_UINT16: \ + case FR_TYPE_UINT32: \ + case FR_TYPE_UINT64: \ + case FR_TYPE_INT8: \ + case FR_TYPE_INT16: \ case FR_TYPE_INT32: \ + case FR_TYPE_INT64: \ + case FR_TYPE_FLOAT32: \ + case FR_TYPE_FLOAT64: \ + case FR_TYPE_DATE: \ case FR_TYPE_TIME_DELTA: \ - case FR_TYPE_BOOL: \ - case FR_TYPE_FLOAT64 - + case FR_TYPE_SIZE #define FR_TYPE_INTEGER_EXCEPT_BOOL \ FR_TYPE_UINT8: \ @@ -179,7 +184,7 @@ typedef enum { case FR_TYPE_VALUE_BOX: \ case FR_TYPE_BAD -/** Types which do represent concrete values +/** Types which represent concrete values * */ #define FR_TYPE_VALUE \ @@ -209,12 +214,6 @@ typedef enum { FR_TYPE_STRING: \ case FR_TYPE_DATE -/* - * In value.c, but should likely be here. - */ -bool fr_type_cast(fr_type_t dst, fr_type_t src); -fr_type_t fr_type_promote(fr_type_t a, fr_type_t b); - #ifdef __cplusplus } #endif diff --git a/src/lib/util/value.h b/src/lib/util/value.h index aeeb1ff0b47..7b025941e98 100644 --- a/src/lib/util/value.h +++ b/src/lib/util/value.h @@ -770,6 +770,9 @@ static inline size_t fr_value_box_aprint_quoted(TALLOC_CTX *ctx, char **out, uint32_t fr_value_box_hash_update(fr_value_box_t const *vb, uint32_t hash); /** @} */ +bool fr_type_cast(fr_type_t dst, fr_type_t src); +fr_type_t fr_type_promote(fr_type_t a, fr_type_t b); + #undef _CONST #ifdef __cplusplus