xref: /freebsd/usr.sbin/ppp/log.h (revision 0bdcbcbe9be534c9eb729da4f1d7f98de78cc1a8)
1c39934eaSBrian Somers /*-
2c39934eaSBrian Somers  * Copyright (c) 1997 Brian Somers <brian@Awfulhak.org>
3c39934eaSBrian Somers  * All rights reserved.
4c39934eaSBrian Somers  *
5c39934eaSBrian Somers  * Redistribution and use in source and binary forms, with or without
6c39934eaSBrian Somers  * modification, are permitted provided that the following conditions
7c39934eaSBrian Somers  * are met:
8c39934eaSBrian Somers  * 1. Redistributions of source code must retain the above copyright
9c39934eaSBrian Somers  *    notice, this list of conditions and the following disclaimer.
10c39934eaSBrian Somers  * 2. Redistributions in binary form must reproduce the above copyright
11c39934eaSBrian Somers  *    notice, this list of conditions and the following disclaimer in the
12c39934eaSBrian Somers  *    documentation and/or other materials provided with the distribution.
13c39934eaSBrian Somers  *
14c39934eaSBrian Somers  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15c39934eaSBrian Somers  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16c39934eaSBrian Somers  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17c39934eaSBrian Somers  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18c39934eaSBrian Somers  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19c39934eaSBrian Somers  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20c39934eaSBrian Somers  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21c39934eaSBrian Somers  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22c39934eaSBrian Somers  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23c39934eaSBrian Somers  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24c39934eaSBrian Somers  * SUCH DAMAGE.
25c39934eaSBrian Somers  *
260bdcbcbeSBrian Somers  *	$Id: log.h,v 1.20 1998/05/23 22:24:41 brian Exp $
2775240ed1SBrian Somers  */
2875240ed1SBrian Somers 
29927145beSBrian Somers #define LogMIN		(1)
30927145beSBrian Somers #define LogASYNC	(1)	/* syslog(LOG_INFO, ....)	 */
31d47dceb8SBrian Somers #define LogCCP		(2)
32d47dceb8SBrian Somers #define LogCHAT		(3)
33d47dceb8SBrian Somers #define LogCOMMAND	(4)
34d47dceb8SBrian Somers #define LogCONNECT	(5)
35d47dceb8SBrian Somers #define LogDEBUG	(6)	/* syslog(LOG_DEBUG, ....)	 */
36b1ac9332SBrian Somers #define LogHDLC		(7)
37b1ac9332SBrian Somers #define LogID0		(8)
38b1ac9332SBrian Somers #define LogIPCP		(9)
39b1ac9332SBrian Somers #define LogLCP		(10)
40b1ac9332SBrian Somers #define LogLQM		(11)
41b1ac9332SBrian Somers #define LogPHASE	(12)
42b1ac9332SBrian Somers #define LogTCPIP	(13)
43b1ac9332SBrian Somers #define LogTIMER	(14)	/* syslog(LOG_DEBUG, ....)	 */
446f384573SBrian Somers #define LogTUN		(15)	/* If set, tun%d is output with each message */
456f384573SBrian Somers #define LogMAXCONF	(15)
466f384573SBrian Somers #define LogWARN		(16)	/* Sent to VarTerm else syslog(LOG_WARNING, ) */
476f384573SBrian Somers #define LogERROR	(17)	/* syslog(LOG_ERR, ....), + sent to VarTerm */
486f384573SBrian Somers #define LogALERT	(18)	/* syslog(LOG_ALERT, ....)	 */
496f384573SBrian Somers #define LogMAX		(18)
501ae349f5Scvs2svn 
5185b542cfSBrian Somers struct mbuf;
522764b86aSBrian Somers struct cmdargs;
532764b86aSBrian Somers struct prompt;
540f2f3eb3SBrian Somers struct server;
550f2f3eb3SBrian Somers struct datalink;
56af57ed9fSAtsushi Murai 
57927145beSBrian Somers /* The first int arg for all of the following is one of the above values */
58dd7e2610SBrian Somers extern const char *log_Name(int);
59dd7e2610SBrian Somers extern void log_Keep(int);
60dd7e2610SBrian Somers extern void log_KeepLocal(int, u_long *);
61dd7e2610SBrian Somers extern void log_Discard(int);
62dd7e2610SBrian Somers extern void log_DiscardLocal(int, u_long *);
63dd7e2610SBrian Somers extern void log_DiscardAll(void);
64dd7e2610SBrian Somers extern void log_DiscardAllLocal(u_long *);
65dd7e2610SBrian Somers #define LOG_KEPT_SYSLOG (1)	/* Results of log_IsKept() */
66dd7e2610SBrian Somers #define LOG_KEPT_LOCAL  (2)	/* Results of log_IsKept() */
67dd7e2610SBrian Somers extern int log_IsKept(int);
68dd7e2610SBrian Somers extern int log_IsKeptLocal(int, u_long);
69dd7e2610SBrian Somers extern void log_Open(const char *);
70dd7e2610SBrian Somers extern void log_SetTun(int);
71dd7e2610SBrian Somers extern void log_Close(void);
72fe3125a0SBrian Somers #ifdef __GNUC__
73dd7e2610SBrian Somers extern void log_Printf(int, const char *,...)
74fe3125a0SBrian Somers             __attribute__ ((format (printf, 2, 3)));
75fe3125a0SBrian Somers #else
76dd7e2610SBrian Somers extern void log_Printf(int, const char *,...);
77fe3125a0SBrian Somers #endif
78dd7e2610SBrian Somers extern void log_DumpBp(int, const char *, const struct mbuf *);
79dd7e2610SBrian Somers extern void log_DumpBuff(int, const char *, const u_char *, int);
80b6217683SBrian Somers extern int log_ShowLevel(struct cmdargs const *);
81b6217683SBrian Somers extern int log_SetLevel(struct cmdargs const *);
82b6217683SBrian Somers extern int log_ShowWho(struct cmdargs const *);
830f2f3eb3SBrian Somers 
840bdcbcbeSBrian Somers extern int log_PromptListChanged;
850f2f3eb3SBrian Somers extern void log_RegisterPrompt(struct prompt *);
860f2f3eb3SBrian Somers extern void log_UnRegisterPrompt(struct prompt *);
870f2f3eb3SBrian Somers extern void log_DestroyPrompts(struct server *);
880f2f3eb3SBrian Somers extern void log_DisplayPrompts(void);
890f2f3eb3SBrian Somers extern void log_WritePrompts(struct datalink *, const char *, int);
900f2f3eb3SBrian Somers extern void log_ActivatePrompt(struct prompt *);
910f2f3eb3SBrian Somers extern void log_DeactivatePrompt(struct prompt *);
920f2f3eb3SBrian Somers extern void log_SetTtyCommandMode(struct datalink *);
930f2f3eb3SBrian Somers extern struct prompt *log_PromptList(void);
94