• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/router/accel-pptpd/pppd_plugin/src/
1/* util.h ....... error message utilities.
2 *                C. Scott Ananian <cananian@alumni.princeton.edu>
3 *
4 * $Id: util.h,v 1.6 2005/03/10 01:18:20 quozl Exp $
5 */
6
7#ifndef INC_UTIL_H
8#define INC_UTIL_H
9
10/* log_string is an identifier for this pptp process, passed from
11   command line using --log-string=X, and included with every log message.
12   Useful for people with multiple pptp sessions open at a time */
13extern char * log_string;
14
15/* log_level sets the logging verbosity. Values range from 0 (errors only)
16   to 1 (errors and warnings) to 2 (high verbosity, for debugging) */
17extern int    log_level;
18
19void _log(const char *func, const char *file, int line, const char *format, ...)
20     __attribute__ ((format (printf, 4, 5)));
21void _warn(const char *func, const char *file, int line, const char *format, ...)
22     __attribute__ ((format (printf, 4, 5)));
23void _fatal(const char *func, const char *file, int line, const char *format, ...)
24     __attribute__ ((format (printf, 4, 5))) __attribute__ ((noreturn));
25
26#define log(format, args...) \
27	_log(__FUNCTION__,__FILE__,__LINE__, format , ## args)
28#define warn(format, args...) \
29	_warn(__FUNCTION__,__FILE__,__LINE__, format , ## args)
30#define fatal(format, args...) \
31	_fatal(__FUNCTION__,__FILE__,__LINE__, format , ## args)
32
33int file2fd(const char *path, const char *mode, int fd);
34
35/* signal to pipe delivery implementation */
36
37/* create a signal pipe, returns 0 for success, -1 with errno for failure */
38int sigpipe_create();
39
40/* generic handler for signals, writes signal number to pipe */
41void sigpipe_handler(int signum);
42
43/* assign a signal number to the pipe */
44void sigpipe_assign(int signum);
45
46/* return the signal pipe read file descriptor for select(2) */
47int sigpipe_fd();
48
49/* read and return the pending signal from the pipe */
50int sigpipe_read();
51
52void sigpipe_close();
53
54#endif /* INC_UTIL_H */
55