#include <freeradius-devel/rad_assert.h>
#include "proto_radius.h"
+/** A saved packet
+ *
+ */
+typedef struct {
+ int heap_id;
+ uint32_t priority;
+ fr_time_t recv_time;
+ fr_io_track_t *track;
+ uint8_t *buffer;
+ size_t buffer_len;
+} fr_io_pending_packet_t;
+
+
+/** Client states
+ *
+ */
+typedef enum {
+ PR_CLIENT_INVALID = 0,
+ PR_CLIENT_STATIC, //!< static / global clients
+ PR_CLIENT_NAK, //!< negative cache entry
+ PR_CLIENT_DYNAMIC, //!< dynamically defined client
+ PR_CLIENT_CONNECTED, //!< dynamically defined client in a connected socket
+ PR_CLIENT_PENDING, //!< dynamic client pending definition
+} fr_io_client_state_t;
+
+/** Client definitions for proto_radius
+ *
+ */
+typedef struct fr_io_client_t {
+ fr_io_client_state_t state; //!< state of this client
+ fr_ipaddr_t src_ipaddr; //!< packets come from this address
+ fr_ipaddr_t network; //!< network for dynamic clients
+ RADCLIENT *radclient; //!< old-style definition of this client
+
+ int packets; //!< number of packets using this client
+ int heap_id; //!< for pending clients
+
+ bool connected; //!< is this client for a connected socket?
+ bool use_connected; //!< does this client allow connected sub-sockets?
+ bool ready_to_delete; //!< are we ready to delete this client?
+ bool in_trie; //!< is the client in the trie?
+
+ struct fr_io_instance_t *inst; //!< parent instance for master IO handler
+ fr_event_timer_t const *ev; //!< when we clean up the client
+ rbtree_t *table; //!< tracking table for packets
+
+ fr_heap_t *pending; //!< pending packets for this client
+ fr_hash_table_t *addresses; //!< list of src/dst addresses used by this client
+
+ pthread_mutex_t mutex; //!< for parent / child signaling
+ fr_hash_table_t *ht; //!< for tracking connected sockets
+} fr_io_client_t;
+
+/** Track a connection
+ *
+ * This structure contains information about the connection,
+ * a pointer to the library instance so that we can clean up on exit,
+ * and the listener.
+ *
+ * It also points to a client structure which is for this connection,
+ * and only this connection.
+ *
+ * Finally, a pointer to the parent client, so that the child can
+ * tell the parent it's alive, and the parent can push packets to the
+ * child.
+ */
+typedef struct {
+ int magic; //!< sparkles and unicorns
+ char const *name; //!< taken from proto_radius_TRANSPORT
+ int packets; //!< number of packets using this connection
+ fr_io_address_t *address; //!< full information about the connection.
+ fr_listen_t *listen; //!< listener for this socket
+ fr_io_client_t *client; //!< our local client (pending or connected).
+ fr_io_client_t *parent; //!< points to the parent client.
+ dl_instance_t *dl_inst; //!< for submodule
+
+ bool dead; //!< roundabout way to get the network side to close a socket
+ bool paused; //!< event filter doesn't like resuming something that isn't paused
+ void *app_io_instance; //!< as described
+ fr_event_list_t *el; //!< event list for this connection
+ fr_network_t *nr; //!< network for this connection
+} fr_io_connection_t;
+
static fr_event_update_t pause_read[] = {
FR_EVENT_SUSPEND(fr_event_io_func_t, read),
{ 0 }
}
}
}
-
- /*
- * If this packet is trying to define a connected
- * socket, tell the dynamic client code.
- */
- if (track->client->connected) {
- (void) pair_make_request("FreeRADIUS-Client-Connected", "true", T_OP_EQ);
- }
}
if (!inst->io.app_io->decode) return 0;
uint8_t packet[20]; //!< original RADIUS packet.
} fr_io_track_t;
-/** A saved packet
- *
- */
-typedef struct {
- int heap_id;
- uint32_t priority;
- fr_time_t recv_time;
- fr_io_track_t *track;
- uint8_t *buffer;
- size_t buffer_len;
-} fr_io_pending_packet_t;
-
-
-/** Client states
- *
- */
-typedef enum {
- PR_CLIENT_INVALID = 0,
- PR_CLIENT_STATIC, //!< static / global clients
- PR_CLIENT_NAK, //!< negative cache entry
- PR_CLIENT_DYNAMIC, //!< dynamically defined client
- PR_CLIENT_CONNECTED, //!< dynamically defined client in a connected socket
- PR_CLIENT_PENDING, //!< dynamic client pending definition
-} fr_io_client_state_t;
-
-/** Client definitions for proto_radius
- *
- */
-typedef struct fr_io_client_t {
- fr_io_client_state_t state; //!< state of this client
- fr_ipaddr_t src_ipaddr; //!< packets come from this address
- fr_ipaddr_t network; //!< network for dynamic clients
- RADCLIENT *radclient; //!< old-style definition of this client
-
- int packets; //!< number of packets using this client
- int heap_id; //!< for pending clients
-
- bool connected; //!< is this client for a connected socket?
- bool use_connected; //!< does this client allow connected sub-sockets?
- bool ready_to_delete; //!< are we ready to delete this client?
- bool in_trie; //!< is the client in the trie?
-
- struct fr_io_instance_t *inst; //!< parent instance for master IO handler
- fr_event_timer_t const *ev; //!< when we clean up the client
- rbtree_t *table; //!< tracking table for packets
-
- fr_heap_t *pending; //!< pending packets for this client
- fr_hash_table_t *addresses; //!< list of src/dst addresses used by this client
-
- pthread_mutex_t mutex; //!< for parent / child signaling
- fr_hash_table_t *ht; //!< for tracking connected sockets
-} fr_io_client_t;
-
-/** Track a connection
- *
- * This structure contains information about the connection,
- * a pointer to the library instance so that we can clean up on exit,
- * and the listener.
- *
- * It also points to a client structure which is for this connection,
- * and only this connection.
- *
- * Finally, a pointer to the parent client, so that the child can
- * tell the parent it's alive, and the parent can push packets to the
- * child.
- */
-typedef struct {
- int magic; //!< sparkles and unicorns
- char const *name; //!< taken from proto_radius_TRANSPORT
- int packets; //!< number of packets using this connection
- fr_io_address_t *address; //!< full information about the connection.
- fr_listen_t *listen; //!< listener for this socket
- fr_io_client_t *client; //!< our local client (pending or connected).
- fr_io_client_t *parent; //!< points to the parent client.
- dl_instance_t *dl_inst; //!< for submodule
-
- bool dead; //!< roundabout way to get the network side to close a socket
- bool paused; //!< event filter doesn't like resuming something that isn't paused
- void *app_io_instance; //!< as described
- fr_event_list_t *el; //!< event list for this connection
- fr_network_t *nr; //!< network for this connection
-} fr_io_connection_t;
extern fr_app_io_t proto_radius_master_io;