]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Make the actual fr_value_box_to_network_dbuff() visible (#3435)
authorJames Jones <jejones3141@gmail.com>
Wed, 6 May 2020 22:28:09 +0000 (17:28 -0500)
committerGitHub <noreply@github.com>
Wed, 6 May 2020 22:28:09 +0000 (17:28 -0500)
We also get rid of the internal protocol's dbuff wrapper around
fr_value_box_to_network(); we leave fr_value_box_to_network()
(itself now a wrapper around the dbuff version) in place so we can
move other protocols to dbuff one at a time.

src/lib/util/value.c
src/lib/util/value.h
src/protocols/internal/encode.c

index e6dc331bbddfa89ead8a44939de10997aa5d62f6..23fdee138f687d526c551a0e325acd3f249970dc 100644 (file)
@@ -94,7 +94,6 @@ static_assert(SIZEOF_MEMBER(fr_value_box_t, vb_float32) == 4,
 static_assert(SIZEOF_MEMBER(fr_value_box_t, vb_float64) == 8,
              "vb_float64 has unexpected length");
 
-static ssize_t fr_value_box_to_network_dbuff(size_t *need, fr_dbuff_t *dbuff, fr_value_box_t const *value);
 
 /** Map data types to names representing those types
  */
@@ -1042,7 +1041,7 @@ ssize_t fr_value_box_to_network(size_t *need, uint8_t *dst, size_t dst_len, fr_v
        return fr_value_box_to_network_dbuff(need, &FR_DBUFF_TMP(dst, dst_len), value);
 }
 
-static ssize_t fr_value_box_to_network_dbuff(size_t *need, fr_dbuff_t *dbuff, fr_value_box_t const *value)
+ssize_t fr_value_box_to_network_dbuff(size_t *need, fr_dbuff_t *dbuff, fr_value_box_t const *value)
 {
        size_t min, max;
 
index 8c9c1cfe284d14425a121af0b25c5bf5faa775c9..e2197d7c7b2c34c9a977aff9f652189d8cc035b2 100644 (file)
@@ -37,6 +37,7 @@ typedef struct value_box fr_value_box_t;
 
 #include <freeradius-devel/build.h>
 #include <freeradius-devel/missing.h>
+#include <freeradius-devel/util/dbuff.h>
 #include <freeradius-devel/util/debug.h>
 #include <freeradius-devel/util/dict.h>
 #include <freeradius-devel/util/inet.h>
@@ -542,6 +543,8 @@ size_t              fr_value_box_network_length(fr_value_box_t *value);
 
 ssize_t                fr_value_box_to_network(size_t *need, uint8_t *out, size_t outlen, fr_value_box_t const *value);
 
+ssize_t                fr_value_box_to_network_dbuff(size_t *need, fr_dbuff_t *dbuff, fr_value_box_t const *value);
+
 /** Special value to indicate fr_value_box_from_network experienced a general error
  */
 #define FR_VALUE_BOX_NET_ERROR SSIZE_MIN
index 063f9fe2231540a90e1871b40b425227b204fbca..c508d6b5c1ff4210d3541518a8d17ffc709f44e0 100644 (file)
@@ -36,7 +36,6 @@
 
 #include <talloc.h>
 
-static ssize_t fr_value_box_to_network_dbuff(size_t *need, fr_dbuff_t *dbuff, fr_value_box_t const *value);
 static ssize_t fr_internal_encode_pair_dbuff(fr_dbuff_t *dbuff, fr_cursor_t *cursor, void *encoder_ctx);
 
 /** We use the same header for all types
@@ -274,21 +273,6 @@ static ssize_t internal_encode(fr_dbuff_t *dbuff,
        return value_end - enc_field;
 }
 
-/** Encode a single value box, serializing its contents in generic network format
- *
- * @note this is a dbuff-oriented layer around fr_value_box_to_network(); once
- * dbuffs become the convention, this layer should no longer be necessary.
- */
-static ssize_t fr_value_box_to_network_dbuff(size_t *need, fr_dbuff_t *dbuff, fr_value_box_t const *value)
-{
-       ssize_t result;
-
-       result = fr_value_box_to_network(need, dbuff->p, fr_dbuff_remaining(dbuff), value);
-       if (result < 0) return result;
-       fr_dbuff_advance(dbuff, result);
-       return result;
-}
-
 /** Encode a data structure into an internal attribute
  *
  * This will become the main entry point when we switch fully to dbuff.