radcli_avp_iter_next(3)

πŸ“¦ version 2.0.1, in arch rolling

πŸ’– NAME

radcli_avp_iter_next β€” bestie, this is the one that hands you the current attribute and then immediately advances. Like, grab-and-go energy ✨

(Oh and the manual name is Radius client library, and it lives in section 3 of the radcli pages, iykyk πŸŽ€)


✨ SYNOPSIS

#include <radcli/>

const radcli_avp * radcli_avp_iter_next(
    radcli_avp_iter  *it
);

🌸 DESCRIPTION

Okay so this section on the actual page is lowkey empty β€” no cap, it goes straight from the heading into PARAMETERS. So there's literally nothing to summarize here, the real tea is all in the sections below 🫢


πŸŽ€ PARAMETERS

  • it β€” an iterator, and it's gotta be one you got from radcli_avp_list_iter(). That's the only currency accepted here πŸ’…

πŸ¦‹ STRUCTURES

So we're iterating over a radcli_avp_list, and the iterator itself is described like this:

A plain value: construct with radcli_avp_list_iter(), advance with radcli_avp_iter_next(). No allocation, safe to copy, safe to run several independent iterators over the same list concurrently (as long as nothing mutates the list while any of them are in use β€” see radcli_avp_list_st's locking note in lib/avp.c). Fields are an implementation detail; do not access them directly. Deliberately not opaque via an incomplete type: a two-pointer cursor belongs on the caller's stack at zero cost, the way any ccan/list or kernel list cursor does, not behind a heap allocation.

Translation: it's a plain value, zero allocation, you can copy it all you want, and you can totally run a bunch of independent iterators over the same list at the same time β€” but only if nothing mutates the list while any of them are live 😭 that's the one caveat, respect it. Also the struct fields are an implementation detail, so keep your hands off them, fr fr. And this thing is deliberately not opaque via an incomplete type β€” a two-pointer cursor belongs on the caller's stack at zero cost, the way any ccan/list or kernel list cursor does, not behind a heap allocation. Main character design choice πŸ‘‘

Usage, presented exactly like the page has it (spacing gremlins and all, we don't touch code πŸ™ˆ):

Usage: radcli_avp_iterit=radcli_avp_list_iter(list);

constradcli_avp*a;

while((a=radcli_avp_iter_next(&it))!=NULL){

}

And the struct itself:

struct radcli_avp_iter {
  const radcli_avp_list  *list;
  const radcli_avp       *cur;
};

⭐ RETURN VALUE

It gives you the current attribute, or NULL once the list is exhausted. And listen β€” every subsequent call on the same it also returns NULL; it does not restart. The iterator is done, it has left the chat πŸ’€


πŸ‘‘ SEE ALSO

The whole friend group, go say hi πŸ’œ


Go forth and loop, bestie. Just remember: NULL means stop, not "try again harder" πŸ”₯

And that's the whole page! This one came from radcli, dated 2026-10-10 β€” so if you're citing it, that's the version and the date, mwah πŸ’‹πŸŽ€

πŸ“¦ where this page comes from