diff options
author | Sebastian Benoit <benno@cvs.openbsd.org> | 2016-09-02 16:22:32 +0000 |
---|---|---|
committer | Sebastian Benoit <benno@cvs.openbsd.org> | 2016-09-02 16:22:32 +0000 |
commit | 4569274a8225ea3f3fbd7b1266680d4495cd4ea2 (patch) | |
tree | 3e6a2a14f23d51cc992b03ed0cf6694fc9d45626 /usr.sbin/dvmrpd/logmsg.c | |
parent | 41550decd9d45cb01640b6f2a186c96786189cd4 (diff) |
work on making log.c similar in all daemons:
move daemon-local functions into new logmsg.c, and reduce
the (mostly whitespace) differences so that log.c's can be diffed easily.
ok claudio@
Diffstat (limited to 'usr.sbin/dvmrpd/logmsg.c')
-rw-r--r-- | usr.sbin/dvmrpd/logmsg.c | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/usr.sbin/dvmrpd/logmsg.c b/usr.sbin/dvmrpd/logmsg.c new file mode 100644 index 00000000000..09847f4a93c --- /dev/null +++ b/usr.sbin/dvmrpd/logmsg.c @@ -0,0 +1,90 @@ +/* $OpenBSD: logmsg.c,v 1.1 2016/09/02 16:20:34 benno Exp $ */ + +/* + * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include <errno.h> +#include <stdarg.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <syslog.h> +#include <unistd.h> + +#include "igmp.h" +#include "dvmrpd.h" +#include "log.h" + +/* names */ +const char * +nbr_state_name(int state) +{ + switch (state) { + case NBR_STA_DOWN: + return ("DOWN"); + case NBR_STA_1_WAY: + return ("1-WAY"); + case NBR_STA_2_WAY: + return ("2-WAY"); + default: + return ("UNKNOWN"); + } +} + +const char * +if_state_name(int state) +{ + switch (state) { + case IF_STA_DOWN: + return ("DOWN"); + case IF_STA_QUERIER: + return ("QUERIER"); + case IF_STA_NONQUERIER: + return ("NONQUERIER"); + default: + return ("UNKNOWN"); + } +} + +const char * +group_state_name(int state) +{ + switch (state) { + case GRP_STA_NO_MEMB_PRSNT: + return ("NO MEMBER"); + case GRP_STA_MEMB_PRSNT: + return ("MEMBER"); + case GRP_STA_V1_MEMB_PRSNT: + return ("V1 MEMBER"); + case GRP_STA_CHECK_MEMB: + return ("CHECKING"); + default: + return ("UNKNOWN"); + } +} + +const char * +if_type_name(enum iface_type type) +{ + switch (type) { + case IF_TYPE_POINTOPOINT: + return ("POINTOPOINT"); + case IF_TYPE_BROADCAST: + return ("BROADCAST"); + } + /* NOTREACHED */ + return ("UNKNOWN"); +} |