blob: dd682d42faed7016e8b092f50fe6990f18a4f800 [file] [log] [blame]
Jonathan Hart916bf892016-01-27 16:42:55 -08001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2016-present Open Networking Laboratory
Jonathan Hart916bf892016-01-27 16:42:55 -08003 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package org.onosproject.routing.fpm.protocol;
18
19/**
20 * RtNetlink protocol value.
21 * <p>
22 * This is a subset of the protocol values used in rtnetlink.
23 * Taken from linux/rtnetlink.h
24 * </p>
25 */
26public enum RtProtocol {
27 /**
28 * Unspecified.
29 */
30 UNSPEC((short) 0),
31
32 /**
33 * Route installed by ICMP redirects.
34 */
35 REDIRECT((short) 1),
36
37 /**
38 * Route installed by kernel.
39 */
40 KERNEL((short) 2),
41
42 /**
43 * Route installed during boot.
44 */
45 BOOT((short) 3),
46
47 /**
48 * Route installed by administrator.
49 */
50 STATIC((short) 4),
51
52 /**
53 * GateD.
54 */
55 GATED((short) 8),
56
57 /**
58 * RDISC/ND router advertisements.
59 */
60 RA((short) 9),
61
62 /**
63 * Merit MRT.
64 */
65 MRT((short) 10),
66
67 /**
68 * Zebra.
69 */
70 ZEBRA((short) 11),
71
72 /**
73 * BIRD.
74 */
75 BIRD((short) 12),
76
77 /**
78 * DECnet routing daemon.
79 */
80 DNROUTED((short) 13),
81
82 /**
83 * XORP.
84 */
85 XORP((short) 14),
86
87 /**
88 * Netsukuku.
89 */
90 NTK((short) 15),
91
92 /**
93 * DHCP client.
94 */
95 DHCP((short) 16),
96
97 /**
98 * Multicast daemon.
99 */
100 MROUTED((short) 17),
101
102 /**
103 * Unknown.
104 */
105 UNKNOWN((short) 0);
106
107 private final short value;
108
109 /**
110 * Constructor.
111 *
112 * @param value value
113 */
114 RtProtocol(short value) {
115 this.value = value;
116 }
117
118 /**
119 * Returns the value.
120 *
121 * @return value
122 */
123 public short value() {
124 return value;
125 }
126
127 /**
128 * Gets the RtProtocol for the given integer value.
129 *
130 * @param value value
131 * @return RtProtocol, or null if unsupported type value
132 */
133 public static RtProtocol get(short value) {
134 for (RtProtocol p : RtProtocol.values()) {
135 if (p.value() == value) {
136 return p;
137 }
138 }
139 return UNKNOWN;
140 }
141}