blob: 35aa1dad4ffd3ca7f426dea7a9f259f36bd600f6 [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
87 */
Yoonseon Hanca814bf2016-09-12 11:37:48 -070088 void writeTo(ByteBuf byteBuf) throws LispWriterException;
Jian Li47671902016-08-11 01:18:18 +090089
90 /**
91 * A builder of LISP locator record.
92 */
93 interface LocatorRecordBuilder {
94
95 /**
96 * Sets priority value.
97 *
98 * @param priority priority
99 * @return LocatorRecordBuilder object
100 */
101 LocatorRecordBuilder withPriority(byte priority);
102
103 /**
104 * Sets weight value.
105 *
106 * @param weight weight
107 * @return LocatorRecordBuilder object
108 */
109 LocatorRecordBuilder withWeight(byte weight);
110
111 /**
112 * Sets multi-cast priority value.
113 *
114 * @param priority priority
115 * @return LocatorRecordBuilder object
116 */
117 LocatorRecordBuilder withMulticastPriority(byte priority);
118
119 /**
120 * Sets multi-cast weight value.
121 *
122 * @param weight weight
123 * @return LocatorRecordBuilder object
124 */
125 LocatorRecordBuilder withMulticastWeight(byte weight);
126
127 /**
128 * Sets local locator flag.
129 *
130 * @param localLocator local locator flag
131 * @return LocatorRecordBuilder object
132 */
133 LocatorRecordBuilder withLocalLocator(boolean localLocator);
134
135 /**
136 * Sets RLOC probed flag.
137 *
138 * @param rlocProbed RLOC probed flag
139 * @return LocatorRecordBuilder object
140 */
141 LocatorRecordBuilder withRlocProbed(boolean rlocProbed);
142
143 /**
144 * Sets routed flag.
145 *
146 * @param routed routed flag
147 * @return LocatorRecordBuilder object
148 */
149 LocatorRecordBuilder withRouted(boolean routed);
150
151 /**
152 * Sets locator AFI.
153 *
154 * @param locatorAfi locator AFI
155 * @return LocatorRecordBuilder object
156 */
157 LocatorRecordBuilder withLocatorAfi(LispAfiAddress locatorAfi);
158
159 /**
160 * Builds locator record.
161 *
162 * @return locator record instance
163 */
164 LispLocatorRecord build();
165 }
166}