]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
no need to say it's a tag "num".
authorAlan T. DeKok <aland@freeradius.org>
Sun, 16 Feb 2025 20:10:25 +0000 (15:10 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Sun, 16 Feb 2025 20:20:16 +0000 (15:20 -0500)
it's an enum, and that's good enough

src/protocols/der/base.c
src/protocols/der/decode.c
src/protocols/der/der.h
src/protocols/der/encode.c

index ef525a994750b0899bcd6e67ba6cc48f821b4d57..c81f4ff8abe73f6b63bda80e866a5f3b6b6c51aa 100644 (file)
@@ -134,7 +134,7 @@ static const bool *fr_type_to_der_tags[] = {
  *             @param[in] tag The der tag to check.
  *             @return true if the type can be encoded as the given tag.
  */
-bool fr_type_to_der_tag_valid(fr_type_t type, fr_der_tag_num_t tag)
+bool fr_type_to_der_tag_valid(fr_type_t type, fr_der_tag_t tag)
 {
        return fr_type_to_der_tags[type][tag];
 }
@@ -223,7 +223,7 @@ static int dict_flag_has_default(fr_dict_attr_t **da_p, UNUSED char const *value
 static int dict_flag_der_type(fr_dict_attr_t **da_p, char const *value, UNUSED fr_dict_flag_parser_rule_t const *rules)
 {
        fr_der_attr_flags_t *flags = fr_dict_attr_ext(*da_p, FR_DICT_ATTR_EXT_PROTOCOL_SPECIFIC);
-       fr_der_tag_num_t     der_type;
+       fr_der_tag_t     der_type;
 
        der_type = fr_table_value_by_str(tag_name_to_number, value, UINT8_MAX);
        if (der_type == UINT8_MAX) {
@@ -239,7 +239,7 @@ static int dict_flag_der_type(fr_dict_attr_t **da_p, char const *value, UNUSED f
 static int dict_flag_sequence_of(fr_dict_attr_t **da_p, char const *value, UNUSED fr_dict_flag_parser_rule_t const *rules)
 {
        fr_der_attr_flags_t *flags = fr_dict_attr_ext(*da_p, FR_DICT_ATTR_EXT_PROTOCOL_SPECIFIC);
-       fr_der_tag_num_t     type;
+       fr_der_tag_t     type;
 
        type = fr_table_value_by_str(tag_name_to_number, value, UINT8_MAX);
        if (type == UINT8_MAX) {
@@ -256,7 +256,7 @@ static int dict_flag_sequence_of(fr_dict_attr_t **da_p, char const *value, UNUSE
 static int dict_flag_set_of(fr_dict_attr_t **da_p, char const *value, UNUSED fr_dict_flag_parser_rule_t const *rules)
 {
        fr_der_attr_flags_t *flags = fr_dict_attr_ext(*da_p, FR_DICT_ATTR_EXT_PROTOCOL_SPECIFIC);
-       fr_der_tag_num_t     type;
+       fr_der_tag_t     type;
 
        type = fr_table_value_by_str(tag_name_to_number, value, UINT8_MAX);
        if (type == UINT8_MAX) {
@@ -413,7 +413,7 @@ static bool type_parse(fr_type_t *type_p,fr_dict_attr_t **da_p, char const *name
        static size_t der_tag_table_len = NUM_ELEMENTS(der_tag_table);
 
        fr_der_attr_flags_t     *flags = fr_dict_attr_ext(*da_p, FR_DICT_ATTR_EXT_PROTOCOL_SPECIFIC);
-       fr_der_tag_num_t        der_type;
+       fr_der_tag_t    der_type;
        fr_type_t               fr_type;
 
        /*
@@ -475,7 +475,7 @@ static bool type_parse(fr_type_t *type_p,fr_dict_attr_t **da_p, char const *name
        return true;
 }
 
-static const fr_der_tag_num_t fr_type_to_der_tag_defaults[FR_TYPE_MAX + 1] = {
+static const fr_der_tag_t fr_type_to_der_tag_defaults[FR_TYPE_MAX + 1] = {
        [FR_TYPE_BOOL]          = FR_DER_TAG_BOOLEAN,
        [FR_TYPE_UINT8]         = FR_DER_TAG_INTEGER,
        [FR_TYPE_UINT16]        = FR_DER_TAG_INTEGER,
@@ -493,7 +493,7 @@ static const fr_der_tag_num_t fr_type_to_der_tag_defaults[FR_TYPE_MAX + 1] = {
        [FR_TYPE_GROUP]         = FR_DER_TAG_SEQUENCE,
 };
 
-fr_der_tag_num_t fr_type_to_der_tag_default(fr_type_t type)
+fr_der_tag_t fr_type_to_der_tag_default(fr_type_t type)
 {
        return fr_type_to_der_tag_defaults[type];
 }
index 469ec96235e1364914017cf57798f85b8e682a65..0d54e454b5e9cac8f87bcb6a1577fd6d00c070ef 100644 (file)
@@ -1108,7 +1108,7 @@ static ssize_t fr_der_decode_set(TALLOC_CTX *ctx, fr_pair_list_t *out, fr_dict_a
                /*
                 *      This is a set-of, meaning there are restrictions on the types which can be present
                 */
-               fr_der_tag_num_t restriction_type = fr_der_flag_set_of(parent);
+               fr_der_tag_t restriction_type = fr_der_flag_set_of(parent);
 
                while (fr_dbuff_remaining(&our_in) > 0) {
                        fr_dbuff_marker_t current_value_marker;
index a0a1a4d1531634f0ca9a2d7073cf473204094ad4..52e57b3c5441050f3ac2abd51f3af0887b37c7a9 100644 (file)
@@ -31,7 +31,7 @@ typedef enum {
        FR_DER_TAG_CHOICE           = 0x23,        //!< A choice of types. Techically not a DER tag, but used to represent a choice.
 
        FR_DER_TAG_MAX          = UINT8_MAX
-} fr_der_tag_num_t;
+} fr_der_tag_t;
 
 typedef enum {
        FR_DER_TAG_PRIMITIVE   = 0x00,       //!< This is a leaf value, it contains no children.
@@ -68,9 +68,9 @@ typedef enum {
 typedef struct {
        uint8_t                 tagnum;
        fr_der_tag_class_t      class;
-       fr_der_tag_num_t        der_type;
-       fr_der_tag_num_t        sequence_of;
-       fr_der_tag_num_t        set_of;
+       fr_der_tag_t            der_type;
+       fr_der_tag_t            sequence_of;
+       fr_der_tag_t            set_of;
        int64_t                 max;
        bool                    is_sequence_of;
        bool                    is_set_of;
@@ -105,8 +105,8 @@ static inline fr_der_attr_flags_t const *fr_der_attr_flags(fr_dict_attr_t const
 /*
  *     base.c
  */
-fr_der_tag_num_t fr_type_to_der_tag_default(fr_type_t type);
-bool   fr_type_to_der_tag_valid(fr_type_t type, fr_der_tag_num_t tag);
+fr_der_tag_t fr_type_to_der_tag_default(fr_type_t type);
+bool   fr_type_to_der_tag_valid(fr_type_t type, fr_der_tag_t tag);
 
 int    fr_der_global_init(void);
 void   fr_der_global_free(void);
index fef74a901172235468cc535bf1fa10684fb3638d..535f9b1e963cee8f5a4b0c228ed90139b1a21cd7 100644 (file)
@@ -89,7 +89,7 @@ static ssize_t fr_der_encode_string(fr_dbuff_t *dbuff, fr_dcursor_t *cursor, fr_
 
 static ssize_t fr_der_encode_len(fr_dbuff_t *dbuff, fr_dbuff_marker_t *length_start) CC_HINT(nonnull);
 static inline CC_HINT(always_inline) ssize_t
-       fr_der_encode_tag(fr_dbuff_t *dbuff, fr_der_tag_num_t tag_num, fr_der_tag_class_t tag_class,
+       fr_der_encode_tag(fr_dbuff_t *dbuff, fr_der_tag_t tag_num, fr_der_tag_class_t tag_class,
                          fr_der_tag_constructed_t constructed) CC_HINT(nonnull);
 static ssize_t encode_value(fr_dbuff_t *dbuff, fr_da_stack_t *da_stack, unsigned int depth, fr_dcursor_t *cursor,
                            void *encode_ctx);
@@ -1660,7 +1660,7 @@ static ssize_t fr_der_encode_len(fr_dbuff_t *dbuff, fr_dbuff_marker_t *length_st
  * @return             The number of bytes written to the buffer
  */
 static inline CC_HINT(always_inline) ssize_t
-       fr_der_encode_tag(fr_dbuff_t *dbuff, fr_der_tag_num_t tag_num, fr_der_tag_class_t tag_class,
+       fr_der_encode_tag(fr_dbuff_t *dbuff, fr_der_tag_t tag_num, fr_der_tag_class_t tag_class,
                          fr_der_tag_constructed_t constructed)
 {
        fr_dbuff_t      our_dbuff = FR_DBUFF(dbuff);
@@ -1689,7 +1689,7 @@ static ssize_t encode_value(fr_dbuff_t *dbuff, UNUSED fr_da_stack_t *da_stack, U
        fr_dbuff_t           our_dbuff = FR_DBUFF(dbuff);
        fr_dbuff_marker_t    marker;
        fr_der_tag_encode_t *tag_encode;
-       fr_der_tag_num_t     tag_num;
+       fr_der_tag_t     tag_num;
        fr_der_tag_class_t   tag_class;
        fr_der_encode_ctx_t *uctx = encode_ctx;
        ssize_t              slen = 0;