blob: ca18e0b8fc2af3a4879849a3ed34824afb31b93e [file] [log] [blame]
Jian Li47671902016-08-11 01:18:18 +09001/*
2 * Copyright 2016-present Open Networking Laboratory
3 *
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 */
16package org.onosproject.lisp.msg.protocols;
17
18import io.netty.buffer.ByteBuf;
19import org.onosproject.lisp.msg.types.LispAfiAddress;
20
21/**
22 * LISP locator record section which is part of LISP map record.
23 */
24public interface LispLocatorRecord {
25
26 /**
27 * Obtains priority value.
28 *
29 * @return priority value
30 */
31 byte getPriority();
32
33 /**
34 * Obtains weight value.
35 *
36 * @return weight value
37 */
38 byte getWeight();
39
40 /**
41 * Obtains multi-cast priority value.
42 *
43 * @return multi-cast priority value
44 */
45 byte getMulticastPriority();
46
47 /**
48 * Obtains multi-cast weight value.
49 *
50 * @return multi-cast weight value
51 */
52 byte getMulticastWeight();
53
54 /**
55 * Obtains local locator flag.
56 *
57 * @return local locator flag
58 */
59 boolean isLocalLocator();
60
61 /**
62 * Obtains RLOC probed flag.
63 *
64 * @return RLOC probed flag
65 */
66 boolean isRlocProbed();
67
68 /**
69 * Obtains routed flag.
70 *
71 * @return routed flag
72 */
73 boolean isRouted();
74
75 /**
76 * Obtains locator AFI.
77 *
78 * @return locator AFI
79 */
80 LispAfiAddress getLocatorAfi();
81
82 /**
83 * Writes LISP message object into communication channel.
84 *
85 * @param byteBuf byte buffer
86 */
87 void writeTo(ByteBuf byteBuf);
88
89 /**
90 * A builder of LISP locator record.
91 */
92 interface LocatorRecordBuilder {
93
94 /**
95 * Sets priority value.
96 *
97 * @param priority priority
98 * @return LocatorRecordBuilder object
99 */
100 LocatorRecordBuilder withPriority(byte priority);
101
102 /**
103 * Sets weight value.
104 *
105 * @param weight weight
106 * @return LocatorRecordBuilder object
107 */
108 LocatorRecordBuilder withWeight(byte weight);
109
110 /**
111 * Sets multi-cast priority value.
112 *
113 * @param priority priority
114 * @return LocatorRecordBuilder object
115 */
116 LocatorRecordBuilder withMulticastPriority(byte priority);
117
118 /**
119 * Sets multi-cast weight value.
120 *
121 * @param weight weight
122 * @return LocatorRecordBuilder object
123 */
124 LocatorRecordBuilder withMulticastWeight(byte weight);
125
126 /**
127 * Sets local locator flag.
128 *
129 * @param localLocator local locator flag
130 * @return LocatorRecordBuilder object
131 */
132 LocatorRecordBuilder withLocalLocator(boolean localLocator);
133
134 /**
135 * Sets RLOC probed flag.
136 *
137 * @param rlocProbed RLOC probed flag
138 * @return LocatorRecordBuilder object
139 */
140 LocatorRecordBuilder withRlocProbed(boolean rlocProbed);
141
142 /**
143 * Sets routed flag.
144 *
145 * @param routed routed flag
146 * @return LocatorRecordBuilder object
147 */
148 LocatorRecordBuilder withRouted(boolean routed);
149
150 /**
151 * Sets locator AFI.
152 *
153 * @param locatorAfi locator AFI
154 * @return LocatorRecordBuilder object
155 */
156 LocatorRecordBuilder withLocatorAfi(LispAfiAddress locatorAfi);
157
158 /**
159 * Builds locator record.
160 *
161 * @return locator record instance
162 */
163 LispLocatorRecord build();
164 }
165}