/** Set a selectable file descriptor for this I/O path
*
*
- * @param[in] instance containing the configuration
+ * @param[in] listen the listener for this socket
* @param[in] fd the FD to set
*/
-typedef int (*fr_io_set_fd_t)(void *instance, int fd);
+typedef int (*fr_io_set_fd_t)(fr_listen_t *listen, int fd);
/** Decode a raw packet and convert it into a request.
*
/*
* Set the new FD, and get the module to set it's connection name.
*/
- if (inst->app_io->fd_set(connection->child->app_io_instance, fd) < 0) {
+ if (inst->app_io->fd_set(connection->child, fd) < 0) {
DEBUG3("Failed setting FD to %s", inst->app_io->name);
close(fd);
return NULL;
/** Set the file descriptor for this socket.
*
- * @param[in] instance of the RADIUS TCP I/O path.
- * @param[in] fd the FD to set
*/
-static int mod_fd_set(void *instance, int fd)
+static int mod_fd_set(fr_listen_t *listen, int fd)
{
- proto_control_tcp_t *inst = talloc_get_type_abort(instance, proto_control_tcp_t);
+ proto_control_tcp_t *inst = talloc_get_type_abort(listen->thread_instance, proto_control_tcp_t);
inst->sockfd = fd;
/** Set the file descriptor for this socket.
*
- * @param[in] instance of the RADIUS UNIX I/O path.
- * @param[in] fd the FD to set
*/
-static int mod_fd_set(void *instance, int fd)
+static int mod_fd_set(fr_listen_t *listen, int fd)
{
- proto_control_unix_t *inst = talloc_get_type_abort(instance, proto_control_unix_t);
+ proto_control_unix_t *inst = talloc_get_type_abort(listen->thread_instance, proto_control_unix_t);
#ifndef HAVE_FUNOPEN
cookie_io_functions_t io;
#endif
* Set up socket-specific callbacks
*/
#ifdef HAVE_FUNOPEN
- inst->stdout = funopen(instance, NULL, write_stdout, NULL, NULL);
+ inst->stdout = funopen(inst, NULL, write_stdout, NULL, NULL);
rad_assert(inst->stdout != NULL);
- inst->stderr = funopen(instance, NULL, write_stderr, NULL, NULL);
+ inst->stderr = funopen(inst, NULL, write_stderr, NULL, NULL);
rad_assert(inst->stderr != NULL);
- inst->misc = funopen(instance, NULL, write_misc, NULL, NULL);
+ inst->misc = funopen(inst, NULL, write_misc, NULL, NULL);
rad_assert(inst->misc != NULL);
#else
/*
io.close = NULL;
io.write = write_stdout;
- inst->stdout = fopencookie(instance, "w", io);
+ inst->stdout = fopencookie(inst, "w", io);
io.write = write_stderr;
- inst->stderr = fopencookie(instance, "w", io);
+ inst->stderr = fopencookie(inst, "w", io);
io.write = write_misc;
- inst->misc = fopencookie(instance, "w", io);
+ inst->misc = fopencookie(inst, "w", io);
#endif
/*
(void) setvbuf(inst->stderr, NULL, _IOLBF, 0);
(void) setvbuf(inst->misc, NULL, _IOLBF, 0);
- inst->info = talloc_zero(instance, fr_cmd_info_t);
- fr_command_info_init(instance, inst->info);
+ inst->info = talloc_zero(inst, fr_cmd_info_t);
+ fr_command_info_init(inst, inst->info);
return 0;
}
/** Set the file descriptor for this socket.
*
- * @param[in] instance of the UDP I/O path.
- * @param[in] fd the FD to set
*/
-static int mod_fd_set(void *instance, int fd)
+static int mod_fd_set(fr_listen_t *listen, int fd)
{
- proto_dhcpv4_udp_t *inst = talloc_get_type_abort(instance, proto_dhcpv4_udp_t);
+ proto_dhcpv4_udp_t *inst = talloc_get_type_abort(listen->thread_instance, proto_dhcpv4_udp_t);
inst->sockfd = fd;
}
/** Set the file descriptor for this socket.
- *
- * @param[in] instance of the RADIUS TCP I/O path.
- * @param[in] fd the FD to set
*/
-static int mod_fd_set(void *instance, int fd)
+static int mod_fd_set(fr_listen_t *listen, int fd)
{
- proto_radius_tcp_t *inst = talloc_get_type_abort(instance, proto_radius_tcp_t);
+ proto_radius_tcp_t *inst = talloc_get_type_abort(listen->thread_instance, proto_radius_tcp_t);
inst->sockfd = fd;
/** Set the file descriptor for this socket.
*
- * @param[in] instance of the RADIUS UDP I/O path.
- * @param[in] fd the FD to set
*/
-static int mod_fd_set(void *instance, int fd)
+static int mod_fd_set(fr_listen_t *listen, int fd)
{
- proto_radius_udp_t *inst = talloc_get_type_abort(instance, proto_radius_udp_t);
+ proto_radius_udp_t *inst = talloc_get_type_abort(listen->thread_instance, proto_radius_udp_t);
inst->sockfd = fd;
/** Set the file descriptor for this socket.
*
- * @param[in] instance of the UDP I/O path.
- * @param[in] fd the FD to set
*/
-static int mod_fd_set(void *instance, int fd)
+static int mod_fd_set(fr_listen_t *listen, int fd)
{
- proto_vmps_udp_t *inst = talloc_get_type_abort(instance, proto_vmps_udp_t);
+ proto_vmps_udp_t *inst = talloc_get_type_abort(listen->thread_instance, proto_vmps_udp_t);
inst->sockfd = fd;