]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
s/fr_cursor/fr_dcursor/ in dhcpv6/base.c
authorNick Porter <nick@portercomputing.co.uk>
Sat, 9 Jan 2021 15:41:07 +0000 (15:41 +0000)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 21 Jan 2021 23:05:49 +0000 (23:05 +0000)
src/protocols/dhcpv6/base.c
src/protocols/dhcpv6/dhcpv6.h

index 90d99dee134e254dda585c01eb0437af85adc80c..e526e9017eb34cf1feed12f3d0ae251a73997857 100644 (file)
@@ -632,7 +632,7 @@ bool fr_dhcpv6_verify(uint8_t const *packet, size_t packet_len, fr_dhcpv6_decode
 /** Decode a DHCPv6 packet
  *
  */
-ssize_t        fr_dhcpv6_decode(TALLOC_CTX *ctx, uint8_t const *packet, size_t packet_len, fr_cursor_t *cursor)
+ssize_t        fr_dhcpv6_decode(TALLOC_CTX *ctx, uint8_t const *packet, size_t packet_len, fr_dcursor_t *cursor)
 {
        ssize_t                 slen;
        uint8_t const           *p, *end;
@@ -649,7 +649,7 @@ ssize_t     fr_dhcpv6_decode(TALLOC_CTX *ctx, uint8_t const *packet, size_t packet_l
 
        vp->vp_uint32 = packet[0];
        vp->type = VT_DATA;
-       fr_cursor_append(cursor, vp);
+       fr_dcursor_append(cursor, vp);
 
        switch (packet[0]) {
        case FR_DHCPV6_RELAY_FORWARD:
@@ -667,14 +667,14 @@ ssize_t   fr_dhcpv6_decode(TALLOC_CTX *ctx, uint8_t const *packet, size_t packet_l
                if (fr_value_box_from_network(vp, &vp->data, vp->da->type, NULL, packet + 1, 1, true) < 0) {
                        goto fail;
                }
-               fr_cursor_append(cursor, vp);
+               fr_dcursor_append(cursor, vp);
 
                vp = fr_pair_afrom_da(ctx, attr_relay_link_address);
                if (!vp) goto fail;
                if (fr_value_box_from_network(vp, &vp->data, vp->da->type, NULL, packet + 2, 16, true) < 0) {
                        goto fail;
                }
-               fr_cursor_append(cursor, vp);
+               fr_dcursor_append(cursor, vp);
 
                vp = fr_pair_afrom_da(ctx, attr_relay_peer_address);
                if (!vp) goto fail;
@@ -682,7 +682,7 @@ ssize_t     fr_dhcpv6_decode(TALLOC_CTX *ctx, uint8_t const *packet, size_t packet_l
                        goto fail;
                }
 
-               fr_cursor_append(cursor, vp);
+               fr_dcursor_append(cursor, vp);
 
                p = packet + DHCPV6_RELAY_HDR_LEN;
                goto decode_options;
@@ -697,8 +697,8 @@ ssize_t     fr_dhcpv6_decode(TALLOC_CTX *ctx, uint8_t const *packet, size_t packet_l
        vp = fr_pair_afrom_da(ctx, attr_transaction_id);
        if (!vp) {
        fail:
-               fr_cursor_head(cursor);
-               fr_cursor_free_list(cursor);
+               fr_dcursor_head(cursor);
+               fr_dcursor_free_list(cursor);
                return -1;
        }
 
@@ -708,7 +708,7 @@ ssize_t     fr_dhcpv6_decode(TALLOC_CTX *ctx, uint8_t const *packet, size_t packet_l
        (void) fr_pair_value_memdup(vp, packet + 1, 3, false);
 
        vp->type = VT_DATA;
-       fr_cursor_append(cursor, vp);
+       fr_dcursor_append(cursor, vp);
 
        p = packet + 4;
 
@@ -723,8 +723,8 @@ decode_options:
        while (p < end) {
                slen = fr_dhcpv6_decode_option(ctx, cursor, dict_dhcpv6, p, (end - p), &packet_ctx);
                if (slen < 0) {
-                       fr_cursor_head(cursor);
-                       fr_cursor_free_list(cursor);
+                       fr_dcursor_head(cursor);
+                       fr_dcursor_free_list(cursor);
                        talloc_free(packet_ctx.tmp_ctx);
                        return slen;
                }
@@ -734,8 +734,8 @@ decode_options:
                 *      all kinds of bad things happen.
                 */
                 if (!fr_cond_assert(slen <= (end - p))) {
-                        fr_cursor_head(cursor);
-                        fr_cursor_free_list(cursor);
+                        fr_dcursor_head(cursor);
+                        fr_dcursor_free_list(cursor);
                         talloc_free(packet_ctx.tmp_ctx);
                         return -1;
                 }
@@ -781,7 +781,7 @@ ssize_t     fr_dhcpv6_encode(fr_dbuff_t *dbuff, uint8_t const *original, size_t leng
        fr_pair_t               *vp;
        fr_dict_attr_t const    *root;
        ssize_t                 slen;
-       fr_cursor_t             cursor;
+       fr_dcursor_t            cursor;
        fr_dhcpv6_encode_ctx_t  packet_ctx;
 
        root = fr_dict_root(dict_dhcpv6);
@@ -845,8 +845,8 @@ ssize_t     fr_dhcpv6_encode(fr_dbuff_t *dbuff, uint8_t const *original, size_t leng
        packet_ctx.original = original;
        packet_ctx.original_length = length;
 
-       fr_cursor_talloc_iter_init(&cursor, vps, fr_dhcpv6_next_encodable, dict_dhcpv6, fr_pair_t);
-       while ((fr_dbuff_extend(&frame_dbuff) > 0) && (fr_cursor_current(&cursor) != NULL)) {
+       fr_dcursor_talloc_iter_init(&cursor, vps, fr_dhcpv6_next_encodable, dict_dhcpv6, fr_pair_t);
+       while ((fr_dbuff_extend(&frame_dbuff) > 0) && (fr_dcursor_current(&cursor) != NULL)) {
                slen = fr_dhcpv6_encode_option(&frame_dbuff, &cursor, &packet_ctx);
                switch (slen) {
                case PAIR_ENCODE_SKIPPED:
index bf276f73957bb65ec9ba04174d1c879e5db99da3..221e46cdd3faa33615567fdab99abcaca103ae41 100644 (file)
@@ -155,7 +155,7 @@ ssize_t             fr_dhcpv6_encode(fr_dbuff_t *dbuff, uint8_t const *original, size_t len
                                 int msg_type, fr_pair_list_t *vps);
 
 ssize_t                fr_dhcpv6_decode(TALLOC_CTX *ctx, uint8_t const *packet, size_t packet_len,
-                                fr_cursor_t *cursor);
+                                fr_dcursor_t *cursor);
 
 void           fr_dhcpv6_print_hex(FILE *fp, uint8_t const *packet, size_t packet_len);