]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
privatize internal structures to io.c
authorAlan T. DeKok <aland@freeradius.org>
Wed, 25 Apr 2018 16:28:19 +0000 (12:28 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Wed, 25 Apr 2018 16:53:46 +0000 (12:53 -0400)
src/modules/proto_radius/io.c
src/modules/proto_radius/proto_radius.c
src/modules/proto_radius/proto_radius.h

index b8a3759f5db4638386b09ce28b986d62b158d5e2..c4042f486bbdde57722549327bcd98e0372ec14c 100644 (file)
 #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 }
index 7e7a4b1b7b6b602e105bf46e73e390ca9e2e5be5..b2a48fb2c73d8beaefdf45e9a882c29631f88a99 100644 (file)
@@ -353,14 +353,6 @@ static int mod_decode(void const *instance, REQUEST *request, uint8_t *const dat
                                }
                        }
                }
-
-               /*
-                *      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;
index 893016628b7011f85ce54caf0380c31c378c2389..dd6819d25c812ceeb6ad65b386ec0c01bfc40688 100644 (file)
@@ -46,88 +46,6 @@ typedef struct {
        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;