From: Alan T. DeKok Date: Wed, 16 Oct 2024 17:22:54 +0000 (-0400) Subject: rename "activate" to "connected" X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=68e4852cb28929a0bed3c523b62d4d0ddc652aad;p=thirdparty%2Ffreeradius-server.git rename "activate" to "connected" to match the connection / trunk API --- diff --git a/src/bin/radclient-ng.c b/src/bin/radclient-ng.c index ed8b75df702..ea610227f55 100644 --- a/src/bin/radclient-ng.c +++ b/src/bin/radclient-ng.c @@ -1287,7 +1287,7 @@ static void client_write(fr_event_list_t *el, int fd, UNUSED int flags, void *uc } } -static void client_bio_activate(fr_bio_packet_t *client) +static void client_bio_connected(fr_bio_packet_t *client) { fr_radius_client_bio_info_t const *info; @@ -1769,7 +1769,7 @@ int main(int argc, char **argv) * paused or resumed when the socket becomes writeable. */ client_config.packet_cb_cfg = (fr_bio_packet_cb_funcs_t) { - .activate = client_bio_activate, + .connected = client_bio_connected, .failed = client_bio_failed, .write_blocked = client_bio_write_pause, diff --git a/src/lib/bio/base.h b/src/lib/bio/base.h index a61a02bec9c..8d904ec8625 100644 --- a/src/lib/bio/base.h +++ b/src/lib/bio/base.h @@ -79,12 +79,12 @@ typedef struct fr_bio_s fr_bio_t; typedef ssize_t (*fr_bio_read_t)(fr_bio_t *bio, void *packet_ctx, void *buffer, size_t size); typedef ssize_t (*fr_bio_write_t)(fr_bio_t *bio, void *packet_ctx, const void *buffer, size_t size); -typedef int (*fr_bio_io_t)(fr_bio_t *bio); /* activate / shutdown callbacks */ +typedef int (*fr_bio_io_t)(fr_bio_t *bio); /* connected / shutdown callbacks */ -typedef void (*fr_bio_callback_t)(fr_bio_t *bio); /* activate / shutdown callbacks */ +typedef void (*fr_bio_callback_t)(fr_bio_t *bio); /* connected / shutdown callbacks */ typedef struct { - fr_bio_callback_t activate; //!< called when the BIO is ready to be used + fr_bio_callback_t connected; //!< called when the BIO is ready to be used fr_bio_callback_t shutdown; //!< called when the BIO is being shut down fr_bio_callback_t eof; //!< called when the BIO is at EOF fr_bio_callback_t failed; //!< called when the BIO fails diff --git a/src/lib/bio/fd.c b/src/lib/bio/fd.c index 165a42c58e3..be39f87bce1 100644 --- a/src/lib/bio/fd.c +++ b/src/lib/bio/fd.c @@ -650,7 +650,7 @@ static void fr_bio_fd_set_open(fr_bio_fd_t *my) /* * Tell the caller that the socket is ready for application data. */ - if (my->cb.activate) my->cb.activate(&my->bio); + if (my->cb.connected) my->cb.connected(&my->bio); } diff --git a/src/lib/bio/haproxy.c b/src/lib/bio/haproxy.c index 10e1280ddcf..13be88c2cd3 100644 --- a/src/lib/bio/haproxy.c +++ b/src/lib/bio/haproxy.c @@ -159,7 +159,7 @@ static ssize_t fr_bio_haproxy_read_next(fr_bio_t *bio, UNUSED void *packet_ctx, /* * Somehow (magically) we can satisfy the read from our buffer. Do so. Note that we do NOT run - * the activation callback, as there is still data in our buffer + * the connected callback, as there is still data in our buffer */ if (size < used) { (void) fr_bio_buf_read(&my->buffer, buffer, size); @@ -172,9 +172,9 @@ static ssize_t fr_bio_haproxy_read_next(fr_bio_t *bio, UNUSED void *packet_ctx, (void) fr_bio_buf_read(&my->buffer, buffer, used); /* - * Call the users activation function, which might remove us from the proxy chain. + * Call the users "socket is now usable" function, which might remove us from the proxy chain. */ - if (my->cb.activate) my->cb.activate(bio); + if (my->cb.connected) my->cb.connected(bio); return used; } diff --git a/src/lib/bio/packet.h b/src/lib/bio/packet.h index 86024c352d7..6f0745795db 100644 --- a/src/lib/bio/packet.h +++ b/src/lib/bio/packet.h @@ -68,7 +68,7 @@ typedef int (*fr_bio_packet_io_t)(fr_bio_packet_t *bio); typedef void (*fr_bio_packet_callback_t)(fr_bio_packet_t *bio); typedef struct { - fr_bio_packet_callback_t activate; + fr_bio_packet_callback_t connected; fr_bio_packet_callback_t shutdown; fr_bio_packet_callback_t eof; fr_bio_packet_callback_t failed; diff --git a/src/protocols/radius/client.c b/src/protocols/radius/client.c index 86c21c14734..1a183eda34b 100644 --- a/src/protocols/radius/client.c +++ b/src/protocols/radius/client.c @@ -147,7 +147,7 @@ fr_radius_client_fd_bio_t *fr_radius_client_fd_bio_alloc(TALLOC_CTX *ctx, size_t /* * Inform all BIOs about the write pause / resume callbacks * - * @todo - these callbacks are set AFTER the BIOs have been initialized, so the activate() + * @todo - these callbacks are set AFTER the BIOs have been initialized, so the connected() * callback is never set, and therefore is never run. We should add all of the callbacks to the * various bio "cfg" data structures. */ @@ -687,10 +687,10 @@ static void fr_radius_client_bio_eof(fr_bio_t *bio) if (my->common.cb.eof) my->common.cb.eof(&my->common); } -/** Callback for when the FD is activated, i.e. connected. +/** Callback for when the FD is connected, and the application can use it * */ -static void fr_radius_client_bio_activate(fr_bio_t *bio) +static void fr_radius_client_bio_connected(fr_bio_t *bio) { fr_radius_client_fd_bio_t *my = bio->uctx; @@ -704,9 +704,9 @@ static void fr_radius_client_bio_activate(fr_bio_t *bio) if (my->ev) talloc_const_free(&my->ev); /* - * Tell the application that the connection has been activated. + * Tell the application that the connection has been connected, and is now usable. */ - my->common.cb.activate(&my->common); + my->common.cb.connected(&my->common); } /** We failed to connect in the given timeout, the connection is dead. @@ -728,23 +728,23 @@ void fr_radius_client_bio_connect(NDEBUG_UNUSED fr_event_list_t *el, NDEBUG_UNUS { fr_radius_client_fd_bio_t *my = talloc_get_type_abort(uctx, fr_radius_client_fd_bio_t); - fr_assert(my->common.cb.activate); + fr_assert(my->common.cb.connected); fr_assert(!my->retry || (my->info.retry_info->el == el)); fr_assert(my->info.fd_info->socket.fd == fd); /* - * The socket is already connected, go activate it. This happens when the FD bio opens an - * unconnected socket. It calls our activation routine before the application has a chance to + * The socket is already connected, tell the application. This happens when the FD bio opens an + * unconnected socket. It calls our connected routine before the application has a chance to * call our connect routine. */ if (my->info.connected) return; /* - * We don't pass the callbacks to fr_bio_fd_alloc(), so it can't call our activate routine. + * We don't pass the callbacks to fr_bio_fd_alloc(), so it can't call our connected routine. * As a result, we have to check if the FD is open, and then call it ourselves. */ if (my->info.fd_info->state == FR_BIO_FD_STATE_OPEN) { - fr_radius_client_bio_activate(my->fd); + fr_radius_client_bio_connected(my->fd); return; } @@ -863,7 +863,7 @@ void fr_radius_client_bio_cb_set(fr_bio_packet_t *bio, fr_bio_packet_cb_funcs_t fr_assert((cb->write_blocked != NULL) == (cb->write_resume != NULL)); fr_assert((cb->read_blocked != NULL) == (cb->read_resume != NULL)); - bio_cb.activate = fr_radius_client_bio_activate; + bio_cb.connected = fr_radius_client_bio_connected; bio_cb.write_blocked = fr_radius_client_bio_write_blocked; bio_cb.write_resume = fr_radius_client_bio_write_resume;