-
Notifications
You must be signed in to change notification settings - Fork 39
/
bfd.cpp
executable file
·64 lines (54 loc) · 1.43 KB
/
bfd.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/**************************************************************
* Copyright (c) 2010-2013, Dynamic Network Services, Inc.
* Jake Montgomery ([email protected]) & Tom Daly ([email protected])
* Distributed under the FreeBSD License - see LICENSE
***************************************************************/
#include "standard.h"
#include "bfd.h"
// bfd constants are in a special namespace for clarity
namespace bfd
{
const char *StateNameArray[] = { "AdminDown", "Down", "Init", "Up" };
const char* StateName(bfd::State::Value state)
{
if (state < 0 || state > bfd::State::Up)
return "Invalid";
return StateNameArray[state];
}
const char *DiagNameArray[] =
{
"No Diagnostic",
"Control Detection Time Expired",
"Echo Function Failed",
"Neighbor Signaled Session Down",
"Forwarding Plane Reset",
"Path Down",
"Concatenated Path Down",
"Administratively Down",
"Reverse Concatenated Path Down"
};
const char* DiagString(Diag::Value diag)
{
if (diag < 0 || diag > bfd::Diag::ReverseConcatPathDown)
return "Unknown";
return DiagNameArray[diag];
}
const char *DiagShortNameArray[] =
{
"None",
"Time Expired",
"Echo Failed",
"Neighbor Down",
"Forwarding Reset",
"Path Down",
"Concat Down",
"Admin Down",
"Reverse Concat Down"
};
const char* DiagShortString(Diag::Value diag)
{
if (diag < 0 || diag > bfd::Diag::ReverseConcatPathDown)
return "Unknown";
return DiagShortNameArray[diag];
}
} // namespace bfd