log.h revision 58033
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 58033 2000-03-14 01:46:49Z brian $ 2730715Sbrian */ 2830715Sbrian 2926516Sbrian#define LogMIN (1) 3028679Sbrian#define LogASYNC (1) /* syslog(LOG_INFO, ....) */ 3138174Sbrian#define LogCBCP (2) 3238174Sbrian#define LogCCP (3) 3338174Sbrian#define LogCHAT (4) 3438174Sbrian#define LogCOMMAND (5) 3538174Sbrian#define LogCONNECT (6) 3638174Sbrian#define LogDEBUG (7) /* syslog(LOG_DEBUG, ....) */ 3758033Sbrian#define LogDNS (8) 3858033Sbrian#define LogHDLC (9) 3958033Sbrian#define LogID0 (10) 4058033Sbrian#define LogIPCP (11) 4158033Sbrian#define LogLCP (12) 4258033Sbrian#define LogLQM (13) 4358033Sbrian#define LogPHASE (14) 4458033Sbrian#define LogPHYSICAL (15) /* syslog(LOG_INFO, ....) */ 4558033Sbrian#define LogSYNC (16) /* syslog(LOG_INFO, ....) */ 4658033Sbrian#define LogTCPIP (17) 4758033Sbrian#define LogTIMER (18) /* syslog(LOG_DEBUG, ....) */ 4858033Sbrian#define LogTUN (19) /* If set, tun%d is output with each message */ 4958033Sbrian#define LogWARN (20) /* Sent to VarTerm else syslog(LOG_WARNING, ) */ 5058033Sbrian#define LogERROR (21) /* syslog(LOG_ERR, ....), + sent to VarTerm */ 5158033Sbrian#define LogALERT (22) /* syslog(LOG_ALERT, ....) */ 526059Samurai 5358033Sbrian#define LogMAXCONF (19) 5458033Sbrian#define LogMAX (22) 5558033Sbrian 5636285Sbrianstruct mbuf; 5736285Sbrianstruct cmdargs; 5836285Sbrianstruct prompt; 5936314Sbrianstruct server; 6036314Sbrianstruct datalink; 6136285Sbrian 6226516Sbrian/* The first int arg for all of the following is one of the above values */ 6336285Sbrianextern const char *log_Name(int); 6436285Sbrianextern void log_Keep(int); 6536285Sbrianextern void log_KeepLocal(int, u_long *); 6636285Sbrianextern void log_Discard(int); 6736285Sbrianextern void log_DiscardLocal(int, u_long *); 6836285Sbrianextern void log_DiscardAll(void); 6936285Sbrianextern void log_DiscardAllLocal(u_long *); 7036285Sbrian#define LOG_KEPT_SYSLOG (1) /* Results of log_IsKept() */ 7136285Sbrian#define LOG_KEPT_LOCAL (2) /* Results of log_IsKept() */ 7236285Sbrianextern int log_IsKept(int); 7336285Sbrianextern int log_IsKeptLocal(int, u_long); 7436285Sbrianextern void log_Open(const char *); 7536285Sbrianextern void log_SetTun(int); 7636285Sbrianextern void log_Close(void); 7736285Sbrian#ifdef __GNUC__ 7836285Sbrianextern void log_Printf(int, const char *,...) 7936285Sbrian __attribute__ ((format (printf, 2, 3))); 8038200Sbrianextern void log_WritePrompts(struct datalink *, const char *, ...) 8138200Sbrian __attribute__ ((format (printf, 2, 3))); 8236285Sbrian#else 8336285Sbrianextern void log_Printf(int, const char *,...); 8438200Sbrianextern void log_WritePrompts(struct datalink *, const char *, ...); 8536285Sbrian#endif 8636285Sbrianextern void log_DumpBp(int, const char *, const struct mbuf *); 8736285Sbrianextern void log_DumpBuff(int, const char *, const u_char *, int); 8836285Sbrianextern int log_ShowLevel(struct cmdargs const *); 8936285Sbrianextern int log_SetLevel(struct cmdargs const *); 9036285Sbrianextern int log_ShowWho(struct cmdargs const *); 9136314Sbrian 9251005Sbrianextern struct prompt *log_PromptContext; 9338013Sbrianextern int log_PromptListChanged; 9436314Sbrianextern void log_RegisterPrompt(struct prompt *); 9536314Sbrianextern void log_UnRegisterPrompt(struct prompt *); 9636314Sbrianextern void log_DestroyPrompts(struct server *); 9736314Sbrianextern void log_DisplayPrompts(void); 9836314Sbrianextern void log_ActivatePrompt(struct prompt *); 9936314Sbrianextern void log_DeactivatePrompt(struct prompt *); 10036314Sbrianextern void log_SetTtyCommandMode(struct datalink *); 10136314Sbrianextern struct prompt *log_PromptList(void); 102