The FreeRADIUS server $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Loading...
Searching...
No Matches
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: a59d2a5b7749521b720e6f21ac811f1659b5985b $
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 */
25RCSIDH(lib_bio_fd_privh, "$Id: a59d2a5b7749521b720e6f21ac811f1659b5985b $")
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 */
35typedef 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[sizeof(struct cmsghdr) * 2]; //!< 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
61int 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:484
Run-time status of the socket.
Definition fd.h:124
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:633
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:789
int fr_filename_to_sockaddr(struct sockaddr_un *sun, socklen_t *sunlen, char const *filename)
Definition fd.c:615
int fr_bio_fd_init_listen(fr_bio_fd_t *my)
Definition fd.c:970
int fr_bio_fd_init_common(fr_bio_fd_t *my)
Definition fd.c:852
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
goto success
Definition tmpl_eval.c:1455
static fr_event_list_t * el
int nonnull(2, 5))