2 * OpenVPN -- An application to securely tunnel IP networks
3 * over a single TCP/UDP port, with support for SSL/TLS-based
4 * session authentication and key exchange,
5 * packet encryption, packet authentication, and
8 * Copyright (C) 2002-2005 OpenVPN Solutions LLC <info@openvpn.net>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2
12 * as published by the Free Software Foundation.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program (see the file COPYING included with this
21 * distribution); if not, write to the Free Software Foundation, Inc.,
22 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
31 * virtual function interface for status output
33 struct virtual_output
{
35 unsigned int flags_default
;
36 void (*func
) (void *arg
, const unsigned int flags
, const char *str
);
40 virtual_output_print (const struct virtual_output
*vo
, const unsigned int flags
, const char *str
)
42 (*vo
->func
) (vo
->arg
, flags
, str
);
46 * printf-style interface for inputting/outputting status info
51 # define STATUS_OUTPUT_READ (1<<0)
52 # define STATUS_OUTPUT_WRITE (1<<1)
58 const struct virtual_output
*vout
;
60 struct buffer read_buf
;
62 struct event_timeout et
;
67 struct status_output
*status_open (const char *filename
,
68 const int refresh_freq
,
70 const struct virtual_output
*vout
,
71 const unsigned int flags
);
73 bool status_trigger_tv (struct status_output
*so
, struct timeval
*tv
);
74 bool status_trigger (struct status_output
*so
);
75 void status_reset (struct status_output
*so
);
76 void status_flush (struct status_output
*so
);
77 bool status_close (struct status_output
*so
);
78 void status_printf (struct status_output
*so
, const char *format
, ...)
80 __attribute__ ((format (printf
, 2, 3)))
84 bool status_read (struct status_output
*so
, struct buffer
*buf
);
86 static inline unsigned int
87 status_rw_flags (const struct status_output
*so
)