The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
listen.h
Go to the documentation of this file.
1 #pragma once
2 /*
3  * This program is free software; you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License as published by
5  * the Free Software Foundation; either version 2 of the License, or
6  * (at your option) any later version.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
16  */
17 #include <freeradius-devel/io/base.h>
18 #include <freeradius-devel/io/application.h>
19 #include <freeradius-devel/server/time_tracking.h>
20 
21 /** Describes a path data takes to/from the wire to/from fr_pair_ts
22  *
23  */
24 typedef struct fr_listen fr_listen_t;
25 struct fr_listen {
26  fr_rb_node_t virtual_server_node; //!< Entry into the virtual server's tree of listeners.
27 
28  int fd; //!< file descriptor for this socket - set by open
29  char const *name; //!< printable name for this socket - set by open
30 
31  fr_app_io_t const *app_io; //!< I/O path functions.
32  void const *app_io_instance; //!< I/O path configuration context.
33  void *thread_instance; //!< thread / socket context
34 
35  fr_socket_t *app_io_addr; //!< for tracking duplicate sockets
36 
37  fr_app_t const *app;
38  void const *app_instance;
39 
40  CONF_SECTION *server_cs; //!< CONF_SECTION of the server
41 
42  bool connected; //!< is this for a connected socket?
43  bool track_duplicates; //!< do we track duplicate packets?
44  bool no_write_callback; //!< sometimes we don't need to do writes
45  bool non_socket_listener; //!< special internal listener that does not use sockets.
46  bool needs_full_setup; //!< Set to true to avoid the short cut when adding the listener.
47  ///< Added for rlm_detail which requires inst->parent->sc to be
48  ///< populated when event_list_set callback is run which doesn't
49  ///< happen if the short cut is taken.
50 
51  size_t default_message_size; //!< copied from app_io, but may be changed
52  size_t num_messages; //!< for the message ring buffer
53 };
54 
55 /**
56  * Minimal data structure to use the new code.
57  */
58 struct fr_async_s {
61 
64 
65  fr_dlist_t entry; //!< in the list of requests associated with this channel
66 
67  void *packet_ctx;
68  fr_listen_t *listen; //!< How we received this request,
69  //!< and how we'll send the reply.
70  uint32_t priority; //!< higher == higher priority
71 
72  uint32_t sequence; //!< higher == higher priority, too
73 };
74 
Public structure describing an I/O path for a protocol.
Definition: app_io.h:33
Describes a new application (protocol)
Definition: application.h:71
A section grouping multiple CONF_PAIR.
Definition: cf_priv.h:89
A full channel, which consists of two ends.
Definition: channel.c:144
Entry in a doubly linked list.
Definition: dlist.h:41
fr_rb_node_t virtual_server_node
Entry into the virtual server's tree of listeners.
Definition: listen.h:26
fr_time_t recv_time
Definition: listen.h:59
fr_channel_t * channel
Definition: listen.h:63
size_t num_messages
for the message ring buffer
Definition: listen.h:52
fr_listen_t * listen
How we received this request, and how we'll send the reply.
Definition: listen.h:68
bool non_socket_listener
special internal listener that does not use sockets.
Definition: listen.h:45
char const * name
printable name for this socket - set by open
Definition: listen.h:29
uint32_t sequence
higher == higher priority, too
Definition: listen.h:72
fr_dlist_t entry
in the list of requests associated with this channel
Definition: listen.h:65
bool track_duplicates
do we track duplicate packets?
Definition: listen.h:43
fr_socket_t * app_io_addr
for tracking duplicate sockets
Definition: listen.h:35
void const * app_instance
Definition: listen.h:38
size_t default_message_size
copied from app_io, but may be changed
Definition: listen.h:51
fr_time_tracking_t tracking
Definition: listen.h:62
bool connected
is this for a connected socket?
Definition: listen.h:42
fr_app_t const * app
Definition: listen.h:37
void const * app_io_instance
I/O path configuration context.
Definition: listen.h:32
void * packet_ctx
Definition: listen.h:67
int fr_io_listen_free(fr_listen_t *li)
Definition: master.c:2915
uint32_t priority
higher == higher priority
Definition: listen.h:70
CONF_SECTION * server_cs
CONF_SECTION of the server.
Definition: listen.h:40
void * thread_instance
thread / socket context
Definition: listen.h:33
bool no_write_callback
sometimes we don't need to do writes
Definition: listen.h:44
int fd
file descriptor for this socket - set by open
Definition: listen.h:28
bool needs_full_setup
Set to true to avoid the short cut when adding the listener.
Definition: listen.h:46
fr_app_io_t const * app_io
I/O path functions.
Definition: listen.h:31
fr_event_list_t * el
Definition: listen.h:60
Minimal data structure to use the new code.
Definition: listen.h:58
Stores all information relating to an event list.
Definition: event.c:411
unsigned int uint32_t
Definition: merged_model.c:33
"server local" time.
Definition: time.h:69
Holds information necessary for binding or connecting to a socket.
Definition: socket.h:63