log.h revision 98243
1254721Semaste/*-
2254721Semaste * Copyright (c) 1997 Brian Somers <brian@Awfulhak.org>
3254721Semaste * All rights reserved.
4254721Semaste *
5254721Semaste * Redistribution and use in source and binary forms, with or without
6254721Semaste * modification, are permitted provided that the following conditions
7254721Semaste * are met:
8254721Semaste * 1. Redistributions of source code must retain the above copyright
9254721Semaste *    notice, this list of conditions and the following disclaimer.
10254721Semaste * 2. Redistributions in binary form must reproduce the above copyright
11254721Semaste *    notice, this list of conditions and the following disclaimer in the
12254721Semaste *    documentation and/or other materials provided with the distribution.
13254721Semaste *
14254721Semaste * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15254721Semaste * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16254721Semaste * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17254721Semaste * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18254721Semaste * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19254721Semaste * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20254721Semaste * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21254721Semaste * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22254721Semaste * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23254721Semaste * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24254721Semaste * SUCH DAMAGE.
25254721Semaste *
26254721Semaste * $FreeBSD: head/usr.sbin/ppp/log.h 98243 2002-06-15 08:03:30Z brian $
27254721Semaste */
28254721Semaste
29254721Semaste#define LogLOG		(0)
30254721Semaste#define LogMIN		(1)
31254721Semaste#define LogASYNC	(1)	/* syslog(LOG_INFO, ....)	 */
32254721Semaste#define LogCBCP		(2)
33254721Semaste#define LogCCP		(3)
34254721Semaste#define LogCHAT		(4)
35254721Semaste#define LogCOMMAND	(5)
36254721Semaste#define LogCONNECT	(6)
37254721Semaste#define LogDEBUG	(7)	/* syslog(LOG_DEBUG, ....)	 */
38254721Semaste#define LogDNS		(8)
39254721Semaste#define LogFILTER       (9)
40254721Semaste#define LogHDLC		(10)
41254721Semaste#define LogID0		(11)
42254721Semaste#define LogIPCP		(12)
43254721Semaste#define LogIPV6CP	(13)
44254721Semaste#define LogLCP		(14)
45254721Semaste#define LogLQM		(15)
46254721Semaste#define LogPHASE	(16)
47254721Semaste#define LogPHYSICAL	(17)	/* syslog(LOG_INFO, ....)	 */
48254721Semaste#define LogSYNC		(18)	/* syslog(LOG_INFO, ....)	 */
49254721Semaste#define LogTCPIP	(19)
50254721Semaste#define LogTIMER	(20)	/* syslog(LOG_DEBUG, ....)	 */
51254721Semaste#define LogTUN		(21)	/* If set, tun%d is output with each message */
52254721Semaste#define LogWARN		(22)	/* Sent to VarTerm else syslog(LOG_WARNING, ) */
53254721Semaste#define LogERROR	(23)	/* syslog(LOG_ERR, ....), + sent to VarTerm */
54254721Semaste#define LogALERT	(24)	/* syslog(LOG_ALERT, ....)	 */
55254721Semaste
56254721Semaste#define LogMAXCONF	(21)
57254721Semaste#define LogMAX		(24)
58254721Semaste
59254721Semastestruct mbuf;
60254721Semastestruct cmdargs;
61254721Semastestruct prompt;
62254721Semastestruct server;
63254721Semastestruct datalink;
64254721Semaste
65254721Semaste/* The first int arg for all of the following is one of the above values */
66254721Semasteextern const char *log_Name(int);
67254721Semasteextern void log_Keep(int);
68254721Semasteextern void log_KeepLocal(int, u_long *);
69254721Semasteextern void log_Discard(int);
70254721Semasteextern void log_DiscardLocal(int, u_long *);
71254721Semasteextern void log_DiscardAll(void);
72254721Semasteextern void log_DiscardAllLocal(u_long *);
73254721Semaste#define LOG_KEPT_SYSLOG (1)	/* Results of log_IsKept() */
74254721Semaste#define LOG_KEPT_LOCAL  (2)	/* Results of log_IsKept() */
75254721Semasteextern int log_IsKept(int);
76254721Semasteextern int log_IsKeptLocal(int, u_long);
77254721Semasteextern void log_Open(const char *);
78254721Semasteextern void log_SetTun(int);
79254721Semasteextern void log_Close(void);
80254721Semaste#ifdef __GNUC__
81254721Semasteextern void log_Printf(int, const char *,...)
82254721Semaste            __attribute__ ((format (printf, 2, 3)));
83254721Semasteextern void log_WritePrompts(struct datalink *, const char *, ...)
84254721Semaste            __attribute__ ((format (printf, 2, 3)));
85254721Semaste#else
86254721Semasteextern void log_Printf(int, const char *,...);
87254721Semasteextern void log_WritePrompts(struct datalink *, const char *, ...);
88254721Semaste#endif
89254721Semasteextern void log_DumpBp(int, const char *, const struct mbuf *);
90254721Semasteextern void log_DumpBuff(int, const char *, const u_char *, int);
91254721Semasteextern int log_ShowLevel(struct cmdargs const *);
92254721Semasteextern int log_SetLevel(struct cmdargs const *);
93254721Semasteextern int log_ShowWho(struct cmdargs const *);
94254721Semaste
95254721Semasteextern struct prompt *log_PromptContext;
96254721Semasteextern int log_PromptListChanged;
97254721Semasteextern void log_RegisterPrompt(struct prompt *);
98254721Semasteextern void log_UnRegisterPrompt(struct prompt *);
99254721Semasteextern void log_DestroyPrompts(struct server *);
100254721Semasteextern void log_DisplayPrompts(void);
101254721Semasteextern void log_ActivatePrompt(struct prompt *);
102254721Semasteextern void log_DeactivatePrompt(struct prompt *);
103254721Semasteextern void log_SetTtyCommandMode(struct datalink *);
104254721Semasteextern struct prompt *log_PromptList(void);
105254721Semaste