The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
fd_priv.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 
18 /**
19  * $Id: def9c60b8288f670135185fce3b390545151b60b $
20  * @file lib/bio/fd_priv.h
21  * @brief Private binary IO abstractions for file descriptors
22  *
23  * @copyright 2024 Network RADIUS SAS (legal@networkradius.com)
24  */
25 RCSIDH(lib_bio_fd_privh, "$Id: def9c60b8288f670135185fce3b390545151b60b $")
26 
27 #include <freeradius-devel/util/syserror.h>
28 
29 #include <freeradius-devel/bio/bio_priv.h>
30 #include <freeradius-devel/bio/fd.h>
31 
32 /** Our FD bio structure.
33  *
34  */
35 typedef struct fr_bio_fd_s {
37  fr_bio_callback_t user_shutdown; //!< user shutdown
38 
40 
41  struct {
42  fr_bio_callback_t success; //!< for fr_bio_fd_connect()
43  fr_bio_callback_t error; //!< for fr_bio_fd_connect()
44  fr_bio_callback_t timeout; //!< for fr_bio_fd_connect()
45  fr_event_list_t *el; //!< for fr_bio_fd_connect()
46  fr_event_timer_t const *ev; //!< for fr_bio_fd_connect()
48 
49  int max_tries; //!< how many times we retry on EINTR
50  size_t offset; //!< where #fr_bio_fd_packet_ctx_t is stored
51 
52 #if defined(IP_PKTINFO) || defined(IP_RECVDSTADDR) || defined(IPV6_PKTINFO)
53  struct iovec iov; //!< for recvfromto
54  struct msghdr msgh; //!< for recvfromto
55  uint8_t cbuf[256]; //!< for recvfromto
56 #endif
58 
59 #define fr_bio_fd_packet_ctx(_my, _packet_ctx) ((fr_bio_fd_packet_ctx_t *) (((uint8_t *) _packet_ctx) + _my->offset))
60 
61 int fr_filename_to_sockaddr(struct sockaddr_un *sun, socklen_t *sunlen, char const *filename) CC_HINT(nonnull);
62 
64 
66 
68 
void(* fr_bio_callback_t)(fr_bio_t *bio)
Definition: base.h:85
#define RCSIDH(h, id)
Definition: build.h:482
static fr_time_delta_t timeout
Definition: dhcpclient.c:54
Run-time status of the socket.
Definition: fd.h:110
fr_bio_shutdown & my
Definition: fd_errno.h:59
fr_bio_callback_t user_shutdown
user shutdown
Definition: fd_priv.h:37
size_t offset
where fr_bio_fd_packet_ctx_t is stored
Definition: fd_priv.h:50
int fr_bio_fd_socket_name(fr_bio_fd_t *my)
Definition: fd.c:630
fr_bio_fd_info_t info
Definition: fd_priv.h:39
int max_tries
how many times we retry on EINTR
Definition: fd_priv.h:49
int fr_bio_fd_init_connected(fr_bio_fd_t *my)
Definition: fd.c:783
int fr_filename_to_sockaddr(struct sockaddr_un *sun, socklen_t *sunlen, char const *filename)
Definition: fd.c:612
int fr_bio_fd_init_listen(fr_bio_fd_t *my)
Definition: fd.c:964
int fr_bio_fd_init_common(fr_bio_fd_t *my)
Definition: fd.c:846
struct fr_bio_fd_s fr_bio_fd_t
Our FD bio structure.
struct fr_bio_fd_s::@8 connect
Our FD bio structure.
Definition: fd_priv.h:35
Stores all information relating to an event list.
Definition: event.c:411
A timer event.
Definition: event.c:102
unsigned char uint8_t
Definition: merged_model.c:30
goto success
Definition: tmpl_eval.c:1455
static fr_event_list_t * el
int nonnull(2, 5))