xref: /freebsd/usr.sbin/ppp/log.h (revision 1c05a6ea6b849ff95e539c31adea887c644a6a01)
1 /*-
2  * Copyright (c) 1997 Brian Somers <brian@Awfulhak.org>
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24  * SUCH DAMAGE.
25  *
26  * $FreeBSD$
27  */
28 
29 #define LogLOG		(0)
30 #define LogMIN		(1)
31 #define LogASYNC	(1)	/* syslog(LOG_INFO, ....)	 */
32 #define LogCBCP		(2)
33 #define LogCCP		(3)
34 #define LogCHAT		(4)
35 #define LogCOMMAND	(5)
36 #define LogCONNECT	(6)
37 #define LogDEBUG	(7)	/* syslog(LOG_DEBUG, ....)	 */
38 #define LogDNS		(8)
39 #define LogFILTER       (9)
40 #define LogHDLC		(10)
41 #define LogID0		(11)
42 #define LogIPCP		(12)
43 #define LogIPV6CP	(13)
44 #define LogLCP		(14)
45 #define LogLQM		(15)
46 #define LogPHASE	(16)
47 #define LogPHYSICAL	(17)	/* syslog(LOG_INFO, ....)	 */
48 #define LogRADIUS	(18)	/* syslog(LOG_INFO, ....)	 */
49 #define LogSYNC		(19)	/* syslog(LOG_INFO, ....)	 */
50 #define LogTCPIP	(20)
51 #define LogTIMER	(21)	/* syslog(LOG_DEBUG, ....)	 */
52 #define LogTUN		(22)	/* If set, tun%d is output with each message */
53 #define LogWARN		(23)	/* Sent to VarTerm else syslog(LOG_WARNING, ) */
54 #define LogERROR	(24)	/* syslog(LOG_ERR, ....), + sent to VarTerm */
55 #define LogALERT	(25)	/* syslog(LOG_ALERT, ....)	 */
56 
57 #define LogMAXCONF	(22)
58 #define LogMAX		(25)
59 
60 struct mbuf;
61 struct cmdargs;
62 struct prompt;
63 struct server;
64 struct datalink;
65 
66 /* The first int arg for all of the following is one of the above values */
67 extern const char *log_Name(int);
68 extern void log_Keep(int);
69 extern void log_KeepLocal(int, u_long *);
70 extern void log_Discard(int);
71 extern void log_DiscardLocal(int, u_long *);
72 extern void log_DiscardAll(void);
73 extern void log_DiscardAllLocal(u_long *);
74 #define LOG_KEPT_SYSLOG (1)	/* Results of log_IsKept() */
75 #define LOG_KEPT_LOCAL  (2)	/* Results of log_IsKept() */
76 extern int log_IsKept(int);
77 extern int log_IsKeptLocal(int, u_long);
78 extern void log_Open(const char *);
79 extern void log_SetTun(int, const char *);
80 extern void log_Close(void);
81 #ifdef __GNUC__
82 extern void log_Printf(int, const char *,...)
83             __attribute__ ((format (printf, 2, 3)));
84 extern void log_WritePrompts(struct datalink *, const char *, ...)
85             __attribute__ ((format (printf, 2, 3)));
86 #else
87 extern void log_Printf(int, const char *,...);
88 extern void log_WritePrompts(struct datalink *, const char *, ...);
89 #endif
90 extern void log_DumpBp(int, const char *, const struct mbuf *);
91 extern void log_DumpBuff(int, const char *, const u_char *, int);
92 extern int log_ShowLevel(struct cmdargs const *);
93 extern int log_SetLevel(struct cmdargs const *);
94 extern int log_ShowWho(struct cmdargs const *);
95 
96 extern struct prompt *log_PromptContext;
97 extern int log_PromptListChanged;
98 extern void log_RegisterPrompt(struct prompt *);
99 extern void log_UnRegisterPrompt(struct prompt *);
100 extern void log_DestroyPrompts(struct server *);
101 extern void log_DisplayPrompts(void);
102 extern void log_ActivatePrompt(struct prompt *);
103 extern void log_DeactivatePrompt(struct prompt *);
104 extern void log_SetTtyCommandMode(struct datalink *);
105 extern struct prompt *log_PromptList(void);
106