xref: /freebsd/usr.sbin/ppp/log.h (revision 4cf49a43559ed9fdad601bdcccd2c55963008675)
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 LogMIN		(1)
30 #define LogASYNC	(1)	/* syslog(LOG_INFO, ....)	 */
31 #define LogCBCP		(2)
32 #define LogCCP		(3)
33 #define LogCHAT		(4)
34 #define LogCOMMAND	(5)
35 #define LogCONNECT	(6)
36 #define LogDEBUG	(7)	/* syslog(LOG_DEBUG, ....)	 */
37 #define LogHDLC		(8)
38 #define LogID0		(9)
39 #define LogIPCP		(10)
40 #define LogLCP		(11)
41 #define LogLQM		(12)
42 #define LogPHASE	(13)
43 #define LogPHYSICAL	(14)	/* syslog(LOG_INFO, ....)	 */
44 #define LogSYNC		(15)	/* syslog(LOG_INFO, ....)	 */
45 #define LogTCPIP	(16)
46 #define LogTIMER	(17)	/* syslog(LOG_DEBUG, ....)	 */
47 #define LogTUN		(18)	/* If set, tun%d is output with each message */
48 #define LogMAXCONF	(18)
49 #define LogWARN		(19)	/* Sent to VarTerm else syslog(LOG_WARNING, ) */
50 #define LogERROR	(20)	/* syslog(LOG_ERR, ....), + sent to VarTerm */
51 #define LogALERT	(21)	/* syslog(LOG_ALERT, ....)	 */
52 #define LogMAX		(21)
53 
54 struct mbuf;
55 struct cmdargs;
56 struct prompt;
57 struct server;
58 struct datalink;
59 
60 /* The first int arg for all of the following is one of the above values */
61 extern const char *log_Name(int);
62 extern void log_Keep(int);
63 extern void log_KeepLocal(int, u_long *);
64 extern void log_Discard(int);
65 extern void log_DiscardLocal(int, u_long *);
66 extern void log_DiscardAll(void);
67 extern void log_DiscardAllLocal(u_long *);
68 #define LOG_KEPT_SYSLOG (1)	/* Results of log_IsKept() */
69 #define LOG_KEPT_LOCAL  (2)	/* Results of log_IsKept() */
70 extern int log_IsKept(int);
71 extern int log_IsKeptLocal(int, u_long);
72 extern void log_Open(const char *);
73 extern void log_SetTun(int);
74 extern void log_Close(void);
75 #ifdef __GNUC__
76 extern void log_Printf(int, const char *,...)
77             __attribute__ ((format (printf, 2, 3)));
78 extern void log_WritePrompts(struct datalink *, const char *, ...)
79             __attribute__ ((format (printf, 2, 3)));
80 #else
81 extern void log_Printf(int, const char *,...);
82 extern void log_WritePrompts(struct datalink *, const char *, ...);
83 #endif
84 extern void log_DumpBp(int, const char *, const struct mbuf *);
85 extern void log_DumpBuff(int, const char *, const u_char *, int);
86 extern int log_ShowLevel(struct cmdargs const *);
87 extern int log_SetLevel(struct cmdargs const *);
88 extern int log_ShowWho(struct cmdargs const *);
89 
90 extern struct prompt *log_PromptContext;
91 extern int log_PromptListChanged;
92 extern void log_RegisterPrompt(struct prompt *);
93 extern void log_UnRegisterPrompt(struct prompt *);
94 extern void log_DestroyPrompts(struct server *);
95 extern void log_DisplayPrompts(void);
96 extern void log_ActivatePrompt(struct prompt *);
97 extern void log_DeactivatePrompt(struct prompt *);
98 extern void log_SetTtyCommandMode(struct datalink *);
99 extern struct prompt *log_PromptList(void);
100