4 * Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC")
5 * Copyright (C) 2001 Internet Software Consortium.
7 * Permission to use, copy, modify, and/or distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.
11 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
12 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
13 * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
14 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
15 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
16 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17 * PERFORMANCE OF THIS SOFTWARE.
20 /* Id: syslog.c,v 1.8 2007/09/13 04:45:18 each Exp */
29 #include <isc/result.h>
30 #include <isc/string.h>
31 #include <isc/syslog.h>
34 static struct dsn_c_pvt_sfnt
{
41 { LOG_DAEMON
, "daemon" },
43 { LOG_SYSLOG
, "syslog" },
55 { LOG_AUTHPRIV
, "authpriv" },
60 { LOG_LOCAL0
, "local0"},
61 { LOG_LOCAL1
, "local1"},
62 { LOG_LOCAL2
, "local2"},
63 { LOG_LOCAL3
, "local3"},
64 { LOG_LOCAL4
, "local4"},
65 { LOG_LOCAL5
, "local5"},
66 { LOG_LOCAL6
, "local6"},
67 { LOG_LOCAL7
, "local7"},
72 isc_syslog_facilityfromstring(const char *str
, int *facilityp
) {
76 REQUIRE(facilityp
!= NULL
);
78 for (i
= 0; facilities
[i
].strval
!= NULL
; i
++) {
79 if (strcasecmp(facilities
[i
].strval
, str
) == 0) {
80 *facilityp
= facilities
[i
].val
;
81 return (ISC_R_SUCCESS
);
84 return (ISC_R_NOTFOUND
);