Annotation of embedaddon/mpd/src/log.h, revision 1.1.1.1

1.1       misho       1: 
                      2: /*
                      3:  * log.h
                      4:  *
                      5:  * Written by Toshiharu OHNO <tony-o@iij.ad.jp>
                      6:  * Copyright (c) 1993, Internet Initiative Japan, Inc. All rights reserved.
                      7:  * See ``COPYRIGHT.iij''
                      8:  * 
                      9:  * Rewritten by Archie Cobbs <archie@freebsd.org>
                     10:  * Copyright (c) 1995-1999 Whistle Communications, Inc. All rights reserved.
                     11:  * See ``COPYRIGHT.whistle''
                     12:  */
                     13: 
                     14: #ifndef _LG_H_
                     15: #define        _LG_H_
                     16: 
                     17: /*
                     18:  * DEFINITIONS
                     19:  */
                     20: 
                     21:   enum
                     22:   {
                     23:     LG_I_ALWAYS = 0,
                     24:     LG_I_BUND,
                     25:     LG_I_BUND2,
                     26:     LG_I_LINK,
                     27:     LG_I_REP,
                     28:     LG_I_CHAT,
                     29:     LG_I_CHAT2,
                     30:     LG_I_IFACE,
                     31:     LG_I_IFACE2,
                     32:     LG_I_LCP,
                     33:     LG_I_LCP2,
                     34:     LG_I_AUTH,
                     35:     LG_I_AUTH2,
                     36:     LG_I_IPCP,
                     37:     LG_I_IPCP2,
                     38:     LG_I_IPV6CP,
                     39:     LG_I_IPV6CP2,
                     40:     LG_I_CCP,
                     41:     LG_I_CCP2,
                     42:     LG_I_ECP,
                     43:     LG_I_ECP2,
                     44:     LG_I_FSM,
                     45:     LG_I_ECHO,
                     46:     LG_I_PHYS,
                     47:     LG_I_PHYS2,
                     48:     LG_I_PHYS3,
                     49:     LG_I_FRAME,
                     50:     LG_I_RADIUS,
                     51:     LG_I_RADIUS2,
                     52:     LG_I_CONSOLE,
                     53:     LG_I_EVENTS
                     54:   };
                     55: 
                     56: /* Definition of log options */
                     57: 
                     58:   #define LG_BUND              (1 << LG_I_BUND)
                     59:   #define LG_BUND2             (1 << LG_I_BUND2)
                     60:   #define LG_LINK              (1 << LG_I_LINK)
                     61:   #define LG_REP               (1 << LG_I_REP)
                     62:   #define LG_CHAT              (1 << LG_I_CHAT)
                     63:   #define LG_CHAT2             (1 << LG_I_CHAT2)
                     64:   #define LG_IFACE             (1 << LG_I_IFACE)
                     65:   #define LG_IFACE2            (1 << LG_I_IFACE2)
                     66:   #define LG_LCP               (1 << LG_I_LCP)
                     67:   #define LG_LCP2              (1 << LG_I_LCP2)
                     68:   #define LG_AUTH              (1 << LG_I_AUTH)
                     69:   #define LG_AUTH2             (1 << LG_I_AUTH2)
                     70:   #define LG_IPCP              (1 << LG_I_IPCP)
                     71:   #define LG_IPCP2             (1 << LG_I_IPCP2)
                     72:   #define LG_IPV6CP            (1 << LG_I_IPV6CP)
                     73:   #define LG_IPV6CP2           (1 << LG_I_IPV6CP2)
                     74:   #define LG_CCP               (1 << LG_I_CCP)
                     75:   #define LG_CCP2              (1 << LG_I_CCP2)
                     76:   #define LG_ECP               (1 << LG_I_ECP)
                     77:   #define LG_ECP2              (1 << LG_I_ECP2)
                     78:   #define LG_FSM               (1 << LG_I_FSM)
                     79:   #define LG_ECHO              (1 << LG_I_ECHO)
                     80:   #define LG_PHYS              (1 << LG_I_PHYS)
                     81:   #define LG_PHYS2             (1 << LG_I_PHYS2)
                     82:   #define LG_PHYS3             (1 << LG_I_PHYS3)
                     83:   #define LG_FRAME             (1 << LG_I_FRAME)
                     84:   #define LG_RADIUS            (1 << LG_I_RADIUS)
                     85:   #define LG_RADIUS2           (1 << LG_I_RADIUS2)
                     86:   #define LG_CONSOLE           (1 << LG_I_CONSOLE)
                     87:   #define LG_ALWAYS            (1 << LG_I_ALWAYS)
                     88:   #define LG_EVENTS            (1 << LG_I_EVENTS)
                     89: 
                     90:   #define LG_ERR               (LG_ALWAYS)
                     91: 
                     92: /* Default options at startup */
                     93: 
                     94:   #define LG_DEFAULT_OPT       (0                      \
                     95:                                | LG_BUND               \
                     96:                                | LG_LINK               \
                     97:                                | LG_REP                \
                     98:                                | LG_IFACE              \
                     99:                                | LG_CONSOLE            \
                    100:                                | LG_CHAT               \
                    101:                                | LG_LCP                \
                    102:                                | LG_IPCP               \
                    103:                                | LG_IPV6CP             \
                    104:                                | LG_CCP                \
                    105:                                | LG_ECP                \
                    106:                                | LG_AUTH               \
                    107:                                | LG_RADIUS             \
                    108:                                | LG_FSM                \
                    109:                                | LG_PHYS               \
                    110:                                )
                    111: 
                    112:   #define Log(lev, args)       do {                            \
                    113:                                  if (gLogOptions & (lev))      \
                    114:                                    LogPrintf args;             \
                    115:                                } while (0)
                    116: 
                    117:   #define Log2(lev, args)      do {                            \
                    118:                                  if (gLogOptions & (lev))      \
                    119:                                    LogPrintf2 args;            \
                    120:                                } while (0)
                    121: 
                    122:   #define LogDumpBuf(lev, buf, len, fmt, args...) do {         \
                    123:                                  if (gLogOptions & (lev))      \
                    124:                                    LogDumpBuf2(buf, len, fmt, ##args); \
                    125:                                } while (0)
                    126: 
                    127:   #define LogDumpBp(lev, bp, fmt, args...) do {                        \
                    128:                                  if (gLogOptions & (lev))      \
                    129:                                    LogDumpBp2(bp, fmt, ##args);\
                    130:                                } while (0)
                    131: 
                    132: /*
                    133:  * VARIABLES
                    134:  */
                    135: 
                    136:   extern int   gLogOptions;
                    137: #ifdef SYSLOG_FACILITY
                    138:   extern char  gSysLogIdent[32];
                    139: #endif
                    140: 
                    141: /*
                    142:  * FUNCTIONS
                    143:  */
                    144: 
                    145:   extern int   LogOpen(void);
                    146:   extern void  LogClose(void);
                    147:   extern void  LogPrintf(const char *fmt, ...) __printflike(1, 2);
                    148:   extern void  vLogPrintf(const char *fmt, va_list args);
                    149:   extern void  LogPrintf2(const char *fmt, ...) __printflike(1, 2);
                    150:   extern int   LogCommand(Context ctx, int ac, char *av[], void *arg);
                    151:   extern void  LogDumpBuf2(const u_char *buf, int len,
                    152:                        const char *fmt, ...) __printflike(3, 4);
                    153:   extern void  LogDumpBp2(Mbuf bp, const char *fmt, ...)
                    154:                        __printflike(2, 3);
                    155:   extern void  Perror(const char *fmt, ...) __printflike(1, 2);
                    156: 
                    157: #endif
                    158: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>