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