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: 6281825380da76a7508c18e847cacca5788b1d89 $
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: 6281825380da76a7508c18e847cacca5788b1d89 $")
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  int max_tries; //!< how many times we retry on EINTR
42  size_t offset; //!< where #fr_bio_fd_packet_ctx_t is stored
43 
44 #if defined(IP_PKTINFO) || defined(IP_RECVDSTADDR) || defined(IPV6_PKTINFO)
45  struct iovec iov; //!< for recvfromto
46  struct msghdr msgh; //!< for recvfromto
47  uint8_t cbuf[256]; //!< for recvfromto
48 #endif
50 
51 #define fr_bio_fd_packet_ctx(_my, _packet_ctx) ((fr_bio_fd_packet_ctx_t *) (((uint8_t *) _packet_ctx) + _my->offset))
52 
53 int fr_filename_to_sockaddr(struct sockaddr_un *sun, socklen_t *sunlen, char const *filename) CC_HINT(nonnull);
54 
56 
58 
60 
int(* fr_bio_callback_t)(fr_bio_t *bio)
Definition: base.h:84
#define RCSIDH(h, id)
Definition: build.h:445
Run-time status of the socket.
Definition: fd.h:107
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:42
int fr_bio_fd_socket_name(fr_bio_fd_t *my)
Definition: fd.c:646
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:41
int fr_bio_fd_init_accept(fr_bio_fd_t *my)
Definition: fd.c:966
int fr_bio_fd_init_connected(fr_bio_fd_t *my)
Definition: fd.c:782
int fr_filename_to_sockaddr(struct sockaddr_un *sun, socklen_t *sunlen, char const *filename)
Definition: fd.c:628
int fr_bio_fd_init_common(fr_bio_fd_t *my)
Definition: fd.c:845
struct fr_bio_fd_s fr_bio_fd_t
Our FD bio structure.
Our FD bio structure.
Definition: fd_priv.h:35
unsigned char uint8_t
Definition: merged_model.c:30
int nonnull(2, 5))