--- /dev/null
+/*
+ * This program is is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+/**
+ * $Id$
+ * @file lib/bio/packet.c
+ * @brief BIO PACKET handlers
+ *
+ * @copyright 2024 Network RADIUS SAS (legal@networkradius.com)
+ */
+
+#include <freeradius-devel/bio/bio_priv.h>
+#include <freeradius-devel/bio/packet.h>
+
+/*
+ * Debounce functions to get to the right callback.
+ */
+void fr_bio_packet_write_blocked(fr_bio_t *bio)
+{
+ fr_bio_packet_t *my = bio->uctx;
+
+ my->write_blocked = true;
+
+ my->cb.write_blocked(my);
+}
+
+void fr_bio_packet_write_resume(fr_bio_t *bio)
+{
+ fr_bio_packet_t *my = bio->uctx;
+
+ my->write_blocked = false;
+
+ my->cb.write_resume(my);
+}
+
+void fr_bio_packet_read_blocked(fr_bio_t *bio)
+{
+ fr_bio_packet_t *my = bio->uctx;
+
+ my->read_blocked = true;
+
+ my->cb.read_blocked(my);
+}
+
+void fr_bio_packet_read_resume(fr_bio_t *bio)
+{
+ fr_bio_packet_t *my = bio->uctx;
+
+ my->read_blocked = false;
+
+ my->cb.read_resume(my);
+}
+
return rcode;
}
-/*
- * Debounce functions to get to the right callback.
- */
-static void fr_bio_write_blocked(fr_bio_t *bio)
-{
- fr_radius_client_fd_bio_t *my = bio->uctx;
-
- my->common.write_blocked = true;
-
- my->common.cb.write_blocked(&my->common);
-}
-
-static void fr_bio_write_resume(fr_bio_t *bio)
+static void fr_radius_client_bio_write_resume(fr_bio_t *bio)
{
fr_radius_client_fd_bio_t *my = bio->uctx;
my->common.cb.write_resume(&my->common);
}
-static void fr_bio_read_blocked(fr_bio_t *bio)
-{
- fr_radius_client_fd_bio_t *my = bio->uctx;
-
- my->common.read_blocked = true;
-
- my->common.cb.read_blocked(&my->common);
-}
-
-static void fr_bio_read_resume(fr_bio_t *bio)
-{
- fr_radius_client_fd_bio_t *my = bio->uctx;
-
- my->common.read_blocked = false;
-
- my->common.cb.read_resume(&my->common);
-}
-
int fr_radius_client_bio_cb_set(fr_bio_packet_t *bio, fr_bio_packet_cb_funcs_t const *cb)
{
fr_radius_client_fd_bio_t *my = talloc_get_type_abort(bio, fr_radius_client_fd_bio_t);
fr_assert((cb->read_blocked != NULL) == (cb->read_resume != NULL));
#undef SET
-#define SET(_x) if (cb->_x) bio_cb._x = fr_bio_ ## _x
+#define SET(_x) if (cb->_x) bio_cb._x = fr_bio_packet_ ## _x
SET(write_blocked);
+ if (cb->write_resume) bio_cb.write_resume = fr_radius_client_bio_write_resume;
+
SET(read_blocked);
- SET(write_resume);
SET(read_resume);
return fr_bio_cb_set(my->fd, &bio_cb);