log.h revision 85991
131921Sbrian/*- 231921Sbrian * Copyright (c) 1997 Brian Somers <brian@Awfulhak.org> 331921Sbrian * All rights reserved. 431921Sbrian * 531921Sbrian * Redistribution and use in source and binary forms, with or without 631921Sbrian * modification, are permitted provided that the following conditions 731921Sbrian * are met: 831921Sbrian * 1. Redistributions of source code must retain the above copyright 931921Sbrian * notice, this list of conditions and the following disclaimer. 1031921Sbrian * 2. Redistributions in binary form must reproduce the above copyright 1131921Sbrian * notice, this list of conditions and the following disclaimer in the 1231921Sbrian * documentation and/or other materials provided with the distribution. 1331921Sbrian * 1431921Sbrian * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1531921Sbrian * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1631921Sbrian * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1731921Sbrian * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1831921Sbrian * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 1931921Sbrian * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2031921Sbrian * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2131921Sbrian * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2231921Sbrian * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2331921Sbrian * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2431921Sbrian * SUCH DAMAGE. 2531921Sbrian * 2650479Speter * $FreeBSD: head/usr.sbin/ppp/log.h 85991 2001-11-03 21:45:32Z brian $ 2730715Sbrian */ 2830715Sbrian 2985991Sbrian#define LogLOG (0) 3026516Sbrian#define LogMIN (1) 3128679Sbrian#define LogASYNC (1) /* syslog(LOG_INFO, ....) */ 3238174Sbrian#define LogCBCP (2) 3338174Sbrian#define LogCCP (3) 3438174Sbrian#define LogCHAT (4) 3538174Sbrian#define LogCOMMAND (5) 3638174Sbrian#define LogCONNECT (6) 3738174Sbrian#define LogDEBUG (7) /* syslog(LOG_DEBUG, ....) */ 3858033Sbrian#define LogDNS (8) 3965181Sbrian#define LogFILTER (9) 4065181Sbrian#define LogHDLC (10) 4165181Sbrian#define LogID0 (11) 4265181Sbrian#define LogIPCP (12) 4381634Sbrian#define LogIPV6CP (13) 4481634Sbrian#define LogLCP (14) 4581634Sbrian#define LogLQM (15) 4681634Sbrian#define LogPHASE (16) 4781634Sbrian#define LogPHYSICAL (17) /* syslog(LOG_INFO, ....) */ 4881634Sbrian#define LogSYNC (18) /* syslog(LOG_INFO, ....) */ 4981634Sbrian#define LogTCPIP (19) 5081634Sbrian#define LogTIMER (20) /* syslog(LOG_DEBUG, ....) */ 5181634Sbrian#define LogTUN (21) /* If set, tun%d is output with each message */ 5281634Sbrian#define LogWARN (22) /* Sent to VarTerm else syslog(LOG_WARNING, ) */ 5381634Sbrian#define LogERROR (23) /* syslog(LOG_ERR, ....), + sent to VarTerm */ 5481634Sbrian#define LogALERT (24) /* syslog(LOG_ALERT, ....) */ 556059Samurai 5681634Sbrian#define LogMAXCONF (21) 5781634Sbrian#define LogMAX (24) 5858033Sbrian 5936285Sbrianstruct mbuf; 6036285Sbrianstruct cmdargs; 6136285Sbrianstruct prompt; 6236314Sbrianstruct server; 6336314Sbrianstruct datalink; 6436285Sbrian 6526516Sbrian/* The first int arg for all of the following is one of the above values */ 6636285Sbrianextern const char *log_Name(int); 6785991Sbrianextern int log_Id(const char *); 6836285Sbrianextern void log_Keep(int); 6936285Sbrianextern void log_KeepLocal(int, u_long *); 7036285Sbrianextern void log_Discard(int); 7136285Sbrianextern void log_DiscardLocal(int, u_long *); 7236285Sbrianextern void log_DiscardAll(void); 7336285Sbrianextern void log_DiscardAllLocal(u_long *); 7436285Sbrian#define LOG_KEPT_SYSLOG (1) /* Results of log_IsKept() */ 7536285Sbrian#define LOG_KEPT_LOCAL (2) /* Results of log_IsKept() */ 7636285Sbrianextern int log_IsKept(int); 7736285Sbrianextern int log_IsKeptLocal(int, u_long); 7836285Sbrianextern void log_Open(const char *); 7936285Sbrianextern void log_SetTun(int); 8036285Sbrianextern void log_Close(void); 8136285Sbrian#ifdef __GNUC__ 8236285Sbrianextern void log_Printf(int, const char *,...) 8336285Sbrian __attribute__ ((format (printf, 2, 3))); 8438200Sbrianextern void log_WritePrompts(struct datalink *, const char *, ...) 8538200Sbrian __attribute__ ((format (printf, 2, 3))); 8636285Sbrian#else 8736285Sbrianextern void log_Printf(int, const char *,...); 8838200Sbrianextern void log_WritePrompts(struct datalink *, const char *, ...); 8936285Sbrian#endif 9036285Sbrianextern void log_DumpBp(int, const char *, const struct mbuf *); 9136285Sbrianextern void log_DumpBuff(int, const char *, const u_char *, int); 9236285Sbrianextern int log_ShowLevel(struct cmdargs const *); 9336285Sbrianextern int log_SetLevel(struct cmdargs const *); 9436285Sbrianextern int log_ShowWho(struct cmdargs const *); 9536314Sbrian 9651005Sbrianextern struct prompt *log_PromptContext; 9738013Sbrianextern int log_PromptListChanged; 9836314Sbrianextern void log_RegisterPrompt(struct prompt *); 9936314Sbrianextern void log_UnRegisterPrompt(struct prompt *); 10036314Sbrianextern void log_DestroyPrompts(struct server *); 10136314Sbrianextern void log_DisplayPrompts(void); 10236314Sbrianextern void log_ActivatePrompt(struct prompt *); 10336314Sbrianextern void log_DeactivatePrompt(struct prompt *); 10436314Sbrianextern void log_SetTtyCommandMode(struct datalink *); 10536314Sbrianextern struct prompt *log_PromptList(void); 106