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