xref: /freebsd/usr.sbin/ppp/log.h (revision b4f63b0b8b2f16453b945bbaeb714eb7d73f2c1a)
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  *
2697d92980SPeter Wemm  * $FreeBSD$
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)
436815097bSBrian Somers #define LogPHYSICAL	(14)	/* syslog(LOG_INFO, ....)	 */
446815097bSBrian Somers #define LogSYNC		(15)	/* syslog(LOG_INFO, ....)	 */
456815097bSBrian Somers #define LogTCPIP	(16)
466815097bSBrian Somers #define LogTIMER	(17)	/* syslog(LOG_DEBUG, ....)	 */
476815097bSBrian Somers #define LogTUN		(18)	/* If set, tun%d is output with each message */
486815097bSBrian Somers #define LogMAXCONF	(18)
496815097bSBrian Somers #define LogWARN		(19)	/* Sent to VarTerm else syslog(LOG_WARNING, ) */
506815097bSBrian Somers #define LogERROR	(20)	/* syslog(LOG_ERR, ....), + sent to VarTerm */
516815097bSBrian Somers #define LogALERT	(21)	/* syslog(LOG_ALERT, ....)	 */
526815097bSBrian Somers #define LogMAX		(21)
531ae349f5Scvs2svn 
5485b542cfSBrian Somers struct mbuf;
552764b86aSBrian Somers struct cmdargs;
562764b86aSBrian Somers struct prompt;
570f2f3eb3SBrian Somers struct server;
580f2f3eb3SBrian Somers struct datalink;
59af57ed9fSAtsushi Murai 
60927145beSBrian Somers /* The first int arg for all of the following is one of the above values */
61dd7e2610SBrian Somers extern const char *log_Name(int);
62dd7e2610SBrian Somers extern void log_Keep(int);
63dd7e2610SBrian Somers extern void log_KeepLocal(int, u_long *);
64dd7e2610SBrian Somers extern void log_Discard(int);
65dd7e2610SBrian Somers extern void log_DiscardLocal(int, u_long *);
66dd7e2610SBrian Somers extern void log_DiscardAll(void);
67dd7e2610SBrian Somers extern void log_DiscardAllLocal(u_long *);
68dd7e2610SBrian Somers #define LOG_KEPT_SYSLOG (1)	/* Results of log_IsKept() */
69dd7e2610SBrian Somers #define LOG_KEPT_LOCAL  (2)	/* Results of log_IsKept() */
70dd7e2610SBrian Somers extern int log_IsKept(int);
71dd7e2610SBrian Somers extern int log_IsKeptLocal(int, u_long);
72dd7e2610SBrian Somers extern void log_Open(const char *);
73dd7e2610SBrian Somers extern void log_SetTun(int);
74dd7e2610SBrian Somers extern void log_Close(void);
75fe3125a0SBrian Somers #ifdef __GNUC__
76dd7e2610SBrian Somers extern void log_Printf(int, const char *,...)
77fe3125a0SBrian Somers             __attribute__ ((format (printf, 2, 3)));
78bf1d3ff6SBrian Somers extern void log_WritePrompts(struct datalink *, const char *, ...)
79bf1d3ff6SBrian Somers             __attribute__ ((format (printf, 2, 3)));
80fe3125a0SBrian Somers #else
81dd7e2610SBrian Somers extern void log_Printf(int, const char *,...);
82bf1d3ff6SBrian Somers extern void log_WritePrompts(struct datalink *, const char *, ...);
83fe3125a0SBrian Somers #endif
84dd7e2610SBrian Somers extern void log_DumpBp(int, const char *, const struct mbuf *);
85dd7e2610SBrian Somers extern void log_DumpBuff(int, const char *, const u_char *, int);
86b6217683SBrian Somers extern int log_ShowLevel(struct cmdargs const *);
87b6217683SBrian Somers extern int log_SetLevel(struct cmdargs const *);
88b6217683SBrian Somers extern int log_ShowWho(struct cmdargs const *);
890f2f3eb3SBrian Somers 
90b4f63b0bSBrian Somers extern struct prompt *log_PromptContext;
910bdcbcbeSBrian Somers extern int log_PromptListChanged;
920f2f3eb3SBrian Somers extern void log_RegisterPrompt(struct prompt *);
930f2f3eb3SBrian Somers extern void log_UnRegisterPrompt(struct prompt *);
940f2f3eb3SBrian Somers extern void log_DestroyPrompts(struct server *);
950f2f3eb3SBrian Somers extern void log_DisplayPrompts(void);
960f2f3eb3SBrian Somers extern void log_ActivatePrompt(struct prompt *);
970f2f3eb3SBrian Somers extern void log_DeactivatePrompt(struct prompt *);
980f2f3eb3SBrian Somers extern void log_SetTtyCommandMode(struct datalink *);
990f2f3eb3SBrian Somers extern struct prompt *log_PromptList(void);
100