The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
io.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: 3756341a79a76af3a53339ca462ccead8daba565 $
20  *
21  * @brief Function prototypes and datatypes for the REST (HTTP) transport.
22  * @file rlm_unbound/io.h
23  *
24  * @copyright 2019 The FreeRADIUS server project
25  * @copyright 2019 Arran Cudbard-Bell (a.cudbardb@freeradius.org)
26  */
27 RCSIDH(rlm_unbound_io_h, "$Id: 3756341a79a76af3a53339ca462ccead8daba565 $")
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
34 DIAG_OFF(documentation)
35 #include <unbound.h>
36 #include <unbound-event.h>
37 DIAG_ON(documentation)
39 
40 /** Wrapper around our event loop specifying callbacks for creating new event handles
41  *
42  * This stores libunbound specific information in addition to the el for the current
43  * worker thread. It's passed into the 'new_event' callback when a new event handle
44  * is created. So we use it to pass in the el, and any other useful information.
45  *
46  * Lifetime should be bound to the thread instance.
47  */
48 typedef struct {
49  struct ub_event_base base; //!< Interface structure for libunbound.
50  ///< MUST BE LISTED FIRST.
51  struct ub_ctx *ub; //!< Unbound ctx instantiated from this event base.
52 
53  fr_event_list_t *el; //!< Event loop events should be inserted into.
55 
56 int unbound_io_init(TALLOC_CTX *ctx, unbound_io_event_base_t **ev_b_out, fr_event_list_t *el);
57 
58 #ifdef __cplusplus
59 }
60 #endif
#define DIAG_UNKNOWN_PRAGMAS
Definition: build.h:417
#define DIAG_ON(_x)
Definition: build.h:419
#define RCSIDH(h, id)
Definition: build.h:445
#define DIAG_OFF(_x)
Definition: build.h:418
Stores all information relating to an event list.
Definition: event.c:411
struct ub_ctx * ub
Unbound ctx instantiated from this event base.
Definition: io.h:51
int unbound_io_init(TALLOC_CTX *ctx, unbound_io_event_base_t **ev_b_out, fr_event_list_t *el)
Alloc a new event base, and unbound ctx initialised from that event base.
Definition: io.c:482
fr_event_list_t * el
Event loop events should be inserted into.
Definition: io.h:53
Wrapper around our event loop specifying callbacks for creating new event handles.
Definition: io.h:48
static fr_event_list_t * el