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