2 * Copyright (C) 1993-2001 by Darren Reed.
4 * See the IPFILTER.LICENCE file for details on licencing.
10 #if !defined(__SVR4) && !defined(__svr4__)
24 static const char rcsid
[] = "@(#)$Id: facpri.c,v 1.3.2.4 2001/07/15 22:06:12 darrenr Exp $";
27 typedef struct table
{
33 { "kern", LOG_KERN
}, { "user", LOG_USER
},
34 { "mail", LOG_MAIL
}, { "daemon", LOG_DAEMON
},
35 { "auth", LOG_AUTH
}, { "syslog", LOG_SYSLOG
},
36 { "lpr", LOG_LPR
}, { "news", LOG_NEWS
},
38 #if LOG_CRON == LOG_CRON2
39 { "cron2", LOG_CRON1
},
41 { "cron", LOG_CRON1
},
47 { "authpriv", LOG_AUTHPRIV
},
50 { "audit", LOG_AUDIT
},
53 { "logalert", LOG_LFMT
},
55 #if LOG_CRON == LOG_CRON1
56 { "cron", LOG_CRON2
},
58 { "cron2", LOG_CRON2
},
61 { "security", LOG_SECURITY
},
63 { "local0", LOG_LOCAL0
}, { "local1", LOG_LOCAL1
},
64 { "local2", LOG_LOCAL2
}, { "local3", LOG_LOCAL3
},
65 { "local4", LOG_LOCAL4
}, { "local5", LOG_LOCAL5
},
66 { "local6", LOG_LOCAL6
}, { "local7", LOG_LOCAL7
},
72 * map a facility number to its name
80 fac
= facpri
& LOG_FACMASK
;
83 if (facs
[j
].value
== fac
)
85 for (i
= 0; facs
[i
].name
; i
++)
86 if (fac
== facs
[i
].value
)
95 * map a facility name to its number
103 for (i
= 0; facs
[i
].name
; i
++)
104 if (!strcmp(facs
[i
].name
, name
))
105 return facs
[i
].value
;
111 { "emerg", LOG_EMERG
}, { "alert", LOG_ALERT
},
112 { "crit", LOG_CRIT
}, { "err", LOG_ERR
},
113 { "warn", LOG_WARNING
}, { "notice", LOG_NOTICE
},
114 { "info", LOG_INFO
}, { "debug", LOG_DEBUG
},
120 * map a priority name to its number
128 for (i
= 0; pris
[i
].name
; i
++)
129 if (!strcmp(pris
[i
].name
, name
))
130 return pris
[i
].value
;
136 * map a priority number to its name
144 pri
= facpri
& LOG_PRIMASK
;
145 if (pris
[pri
].value
== pri
)
146 return pris
[pri
].name
;
147 for (i
= 0; pris
[i
].name
; i
++)
148 if (pri
== pris
[i
].value
)