The FreeRADIUS server $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Loading...
Searching...
No Matches
fopencookie.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/** Provide missing types for fopencookie on systems that don't support it
19 *
20 * You should always include this file when using fopencookie
21 *
22 * @file src/lib/util/fopencookie.h
23 *
24 * @copyright 2019 The FreeRADIUS server project
25 * @copyright 2019 Arran Cudbard-Bell (a.cudbardb@freeradius.org)
26 */
27RCSIDH(fopencookie_h, "$Id: 8aaeaf71a8beed2bf6e421168c9df0d3a7d4e0df $")
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33#include <stdio.h>
34
35#ifndef HAVE_FOPENCOOKIE
36#define HAVE_FOPENCOOKIE 1
37
38#if defined(__APPLE__)
39/** Mac OS has always had a 64-bit off_t, so it doesn't have off64_t. */
40typedef off_t off64_t;
41#endif
42
43typedef ssize_t (*cookie_read_function_t)(void *cookie, char *buf, size_t size);
44
45typedef ssize_t (*cookie_write_function_t)(void *cookie, const char *buf, size_t size);
46
47typedef int (*cookie_seek_function_t)(void *cookie, off64_t *offset, int whence);
48
49typedef int (*cookie_close_function_t)(void *cookie);
50
57
58FILE *fopencookie(void *cookie, const char *mode, cookie_io_functions_t io_funcs);
59
60#endif
61
62#ifdef __cplusplus
63}
64#endif
#define RCSIDH(h, id)
Definition build.h:484
int(* cookie_seek_function_t)(void *cookie, off64_t *offset, int whence)
Definition fopencookie.h:47
FILE * fopencookie(void *cookie, const char *mode, cookie_io_functions_t io_funcs)
Definition fopencookie.c:99
cookie_close_function_t close
Definition fopencookie.h:55
cookie_seek_function_t seek
Definition fopencookie.h:54
int(* cookie_close_function_t)(void *cookie)
Definition fopencookie.h:49
ssize_t(* cookie_read_function_t)(void *cookie, char *buf, size_t size)
Definition fopencookie.h:43
ssize_t(* cookie_write_function_t)(void *cookie, const char *buf, size_t size)
Definition fopencookie.h:45
cookie_read_function_t read
Definition fopencookie.h:52
cookie_write_function_t write
Definition fopencookie.h:53
long int ssize_t
long long int off_t
static const trunk_io_funcs_t io_funcs
Definition bio.c:2416