GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: usr.sbin/dvmrpctl/../dvmrpd/logmsg.c Lines: 0 20 0.0 %
Date: 2017-11-13 Branches: 0 16 0.0 %

Line Branch Exec Source
1
/*	$OpenBSD: logmsg.c,v 1.1 2016/09/02 16:20:34 benno Exp $ */
2
3
/*
4
 * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
5
 *
6
 * Permission to use, copy, modify, and distribute this software for any
7
 * purpose with or without fee is hereby granted, provided that the above
8
 * copyright notice and this permission notice appear in all copies.
9
 *
10
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17
 */
18
19
#include <errno.h>
20
#include <stdarg.h>
21
#include <stdio.h>
22
#include <stdlib.h>
23
#include <string.h>
24
#include <syslog.h>
25
#include <unistd.h>
26
27
#include "igmp.h"
28
#include "dvmrpd.h"
29
#include "log.h"
30
31
/* names */
32
const char *
33
nbr_state_name(int state)
34
{
35
	switch (state) {
36
	case NBR_STA_DOWN:
37
		return ("DOWN");
38
	case NBR_STA_1_WAY:
39
		return ("1-WAY");
40
	case NBR_STA_2_WAY:
41
		return ("2-WAY");
42
	default:
43
		return ("UNKNOWN");
44
	}
45
}
46
47
const char *
48
if_state_name(int state)
49
{
50
	switch (state) {
51
	case IF_STA_DOWN:
52
		return ("DOWN");
53
	case IF_STA_QUERIER:
54
		return ("QUERIER");
55
	case IF_STA_NONQUERIER:
56
		return ("NONQUERIER");
57
	default:
58
		return ("UNKNOWN");
59
	}
60
}
61
62
const char *
63
group_state_name(int state)
64
{
65
	switch (state) {
66
	case GRP_STA_NO_MEMB_PRSNT:
67
		return ("NO MEMBER");
68
	case GRP_STA_MEMB_PRSNT:
69
		return ("MEMBER");
70
	case GRP_STA_V1_MEMB_PRSNT:
71
		return ("V1 MEMBER");
72
	case GRP_STA_CHECK_MEMB:
73
		return ("CHECKING");
74
	default:
75
		return ("UNKNOWN");
76
	}
77
}
78
79
const char *
80
if_type_name(enum iface_type type)
81
{
82
	switch (type) {
83
	case IF_TYPE_POINTOPOINT:
84
		return ("POINTOPOINT");
85
	case IF_TYPE_BROADCAST:
86
		return ("BROADCAST");
87
	}
88
	/* NOTREACHED */
89
	return ("UNKNOWN");
90
}