xref: /freebsd/usr.sbin/ppp/log.h (revision 92b095588304eafcb4ba45699fe8afec726b5969)
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  *
2692b09558SBrian Somers  *	$Id: log.h,v 1.21 1998/08/02 13:01:16 brian Exp $
2775240ed1SBrian Somers  */
2875240ed1SBrian Somers 
29927145beSBrian Somers #define LogMIN		(1)
30927145beSBrian Somers #define LogASYNC	(1)	/* syslog(LOG_INFO, ....)	 */
3192b09558SBrian Somers #define LogCBCP		(2)
3292b09558SBrian Somers #define LogCCP		(3)
3392b09558SBrian Somers #define LogCHAT		(4)
3492b09558SBrian Somers #define LogCOMMAND	(5)
3592b09558SBrian Somers #define LogCONNECT	(6)
3692b09558SBrian Somers #define LogDEBUG	(7)	/* syslog(LOG_DEBUG, ....)	 */
3792b09558SBrian Somers #define LogHDLC		(8)
3892b09558SBrian Somers #define LogID0		(9)
3992b09558SBrian Somers #define LogIPCP		(10)
4092b09558SBrian Somers #define LogLCP		(11)
4192b09558SBrian Somers #define LogLQM		(12)
4292b09558SBrian Somers #define LogPHASE	(13)
4392b09558SBrian Somers #define LogTCPIP	(14)
4492b09558SBrian Somers #define LogTIMER	(15)	/* syslog(LOG_DEBUG, ....)	 */
4592b09558SBrian Somers #define LogTUN		(16)	/* If set, tun%d is output with each message */
4692b09558SBrian Somers #define LogMAXCONF	(16)
4792b09558SBrian Somers #define LogWARN		(17)	/* Sent to VarTerm else syslog(LOG_WARNING, ) */
4892b09558SBrian Somers #define LogERROR	(18)	/* syslog(LOG_ERR, ....), + sent to VarTerm */
4992b09558SBrian Somers #define LogALERT	(19)	/* syslog(LOG_ALERT, ....)	 */
5092b09558SBrian Somers #define LogMAX		(19)
511ae349f5Scvs2svn 
5285b542cfSBrian Somers struct mbuf;
532764b86aSBrian Somers struct cmdargs;
542764b86aSBrian Somers struct prompt;
550f2f3eb3SBrian Somers struct server;
560f2f3eb3SBrian Somers struct datalink;
57af57ed9fSAtsushi Murai 
58927145beSBrian Somers /* The first int arg for all of the following is one of the above values */
59dd7e2610SBrian Somers extern const char *log_Name(int);
60dd7e2610SBrian Somers extern void log_Keep(int);
61dd7e2610SBrian Somers extern void log_KeepLocal(int, u_long *);
62dd7e2610SBrian Somers extern void log_Discard(int);
63dd7e2610SBrian Somers extern void log_DiscardLocal(int, u_long *);
64dd7e2610SBrian Somers extern void log_DiscardAll(void);
65dd7e2610SBrian Somers extern void log_DiscardAllLocal(u_long *);
66dd7e2610SBrian Somers #define LOG_KEPT_SYSLOG (1)	/* Results of log_IsKept() */
67dd7e2610SBrian Somers #define LOG_KEPT_LOCAL  (2)	/* Results of log_IsKept() */
68dd7e2610SBrian Somers extern int log_IsKept(int);
69dd7e2610SBrian Somers extern int log_IsKeptLocal(int, u_long);
70dd7e2610SBrian Somers extern void log_Open(const char *);
71dd7e2610SBrian Somers extern void log_SetTun(int);
72dd7e2610SBrian Somers extern void log_Close(void);
73fe3125a0SBrian Somers #ifdef __GNUC__
74dd7e2610SBrian Somers extern void log_Printf(int, const char *,...)
75fe3125a0SBrian Somers             __attribute__ ((format (printf, 2, 3)));
76fe3125a0SBrian Somers #else
77dd7e2610SBrian Somers extern void log_Printf(int, const char *,...);
78fe3125a0SBrian Somers #endif
79dd7e2610SBrian Somers extern void log_DumpBp(int, const char *, const struct mbuf *);
80dd7e2610SBrian Somers extern void log_DumpBuff(int, const char *, const u_char *, int);
81b6217683SBrian Somers extern int log_ShowLevel(struct cmdargs const *);
82b6217683SBrian Somers extern int log_SetLevel(struct cmdargs const *);
83b6217683SBrian Somers extern int log_ShowWho(struct cmdargs const *);
840f2f3eb3SBrian Somers 
850bdcbcbeSBrian Somers extern int log_PromptListChanged;
860f2f3eb3SBrian Somers extern void log_RegisterPrompt(struct prompt *);
870f2f3eb3SBrian Somers extern void log_UnRegisterPrompt(struct prompt *);
880f2f3eb3SBrian Somers extern void log_DestroyPrompts(struct server *);
890f2f3eb3SBrian Somers extern void log_DisplayPrompts(void);
900f2f3eb3SBrian Somers extern void log_WritePrompts(struct datalink *, const char *, int);
910f2f3eb3SBrian Somers extern void log_ActivatePrompt(struct prompt *);
920f2f3eb3SBrian Somers extern void log_DeactivatePrompt(struct prompt *);
930f2f3eb3SBrian Somers extern void log_SetTtyCommandMode(struct datalink *);
940f2f3eb3SBrian Somers extern struct prompt *log_PromptList(void);
95