1 /* util.h ....... error message utilities.
2 * C. Scott Ananian <cananian@alumni.princeton.edu>
4 * $Id: util.h,v 1.6 2005/03/10 01:18:20 quozl Exp $
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 */
13 extern char * log_string;
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) */
19 void _debuglog(const char *func, const char *file, int line, const char *format, ...)
20 __attribute__ ((format (printf, 4, 5)));
21 void _log(const char *func, const char *file, int line, const char *format, ...)
22 __attribute__ ((format (printf, 4, 5)));
23 void _warn(const char *func, const char *file, int line, const char *format, ...)
24 __attribute__ ((format (printf, 4, 5)));
25 void _fatal(const char *func, const char *file, int line, const char *format, ...)
26 __attribute__ ((format (printf, 4, 5))) __attribute__ ((noreturn));
29 #define debuglog(format, args...) \
30 _debuglog(__FUNCTION__,__FILE__,__LINE__, format , ## args)
31 #define log(format, args...) \
32 _log(__FUNCTION__,__FILE__,__LINE__, format , ## args)
33 #define warn(format, args...) \
34 _warn(__FUNCTION__,__FILE__,__LINE__, format , ## args)
35 #define fatal(format, args...) \
36 _fatal(__FUNCTION__,__FILE__,__LINE__, format , ## args)
38 #define debuglog(format, args...) \
40 #define log(format, args...) \
41 _log(NULL,NULL,0, format , ## args)
42 #define warn(format, args...) \
43 _warn(NULL,NULL,0, format , ## args)
44 #define fatal(format, args...) \
45 _fatal(NULL,NULL,0, format , ## args)
48 int file2fd(const char *path, const char *mode, int fd);
50 /* signal to pipe delivery implementation */
52 /* create a signal pipe, returns 0 for success, -1 with errno for failure */
55 /* generic handler for signals, writes signal number to pipe */
56 void sigpipe_handler(int signum);
58 /* assign a signal number to the pipe */
59 void sigpipe_assign(int signum);
61 /* return the signal pipe read file descriptor for select(2) */
64 /* read and return the pending signal from the pipe */
69 #endif /* INC_UTIL_H */