blob: 58113c6418b3d42faccb8c385348450bc069d752 [file] [log] [blame]
Jian Li451175e2016-07-19 23:22:20 +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
Jian Li719b3bf2016-07-22 00:38:29 +090018import org.onosproject.lisp.msg.types.LispAfiAddress;
19
20import java.util.List;
21
Jian Li451175e2016-07-19 23:22:20 +090022/**
23 * LISP map request message interface.
Jian Lif59c0ad2016-08-02 18:11:30 +090024 * <p>
Jian Li719b3bf2016-07-22 00:38:29 +090025 * LISP map request message format is defined in RFC6830.
26 * https://tools.ietf.org/html/rfc6830#page-27
27 *
Yuta HIGUCHI4b022112016-08-03 10:56:55 -070028 * <pre>
29 * {@literal
Jian Lif59c0ad2016-08-02 18:11:30 +090030 * <p>
Jian Li4eb3e3a2016-08-21 16:20:20 +090031 * 0 1 2 3
32 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
33 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
34 * |Type=1 |A|M|P|S|p|s| Reserved | IRC | Record Count |
35 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
36 * | Nonce . . . |
37 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
38 * | . . . Nonce |
39 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
40 * | Source-EID-AFI | Source EID Address ... |
41 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
42 * | ITR-RLOC-AFI 1 | ITR-RLOC Address 1 ... |
43 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
44 * | ... |
45 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
46 * | ITR-RLOC-AFI n | ITR-RLOC Address n ... |
47 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
48 * / | Reserved | EID mask-len | EID-Prefix-AFI |
Jian Li719b3bf2016-07-22 00:38:29 +090049 * Rec +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Jian Li4eb3e3a2016-08-21 16:20:20 +090050 * \ | EID-Prefix ... |
51 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
52 * | Map-Reply Record ... |
53 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Yuta HIGUCHI4b022112016-08-03 10:56:55 -070054 * }</pre>
Jian Li451175e2016-07-19 23:22:20 +090055 */
56public interface LispMapRequest extends LispMessage {
Jian Li719b3bf2016-07-22 00:38:29 +090057
58 /**
59 * Obtains authoritative flag.
60 *
61 * @return authoritative flag
62 */
63 boolean isAuthoritative();
64
65 /**
Jian Lif59c0ad2016-08-02 18:11:30 +090066 * Obtains map data present flag.
67 *
68 * @return map data present flag
69 */
70 boolean isMapDataPresent();
71
72 /**
Jian Li719b3bf2016-07-22 00:38:29 +090073 * Obtains probe flag.
74 *
75 * @return probe flag
76 */
77 boolean isProbe();
78
79 /**
80 * Obtains SMR flag.
81 *
82 * @return SMR flag
83 */
84 boolean isSmr();
85
86 /**
87 * Obtains PITR flag.
88 *
89 * @return PITR flag
90 */
91 boolean isPitr();
92
93 /**
94 * Obtains SMR Invoked flag.
95 *
96 * @return SMR invoked flag
97 */
98 boolean isSmrInvoked();
99
100 /**
101 * Obtains record count value.
102 *
103 * @return record count value
104 */
Jian Li42b3e432016-08-31 01:05:20 +0900105 int getRecordCount();
Jian Li719b3bf2016-07-22 00:38:29 +0900106
107 /**
108 * Obtains nonce value.
109 *
110 * @return nonce value
111 */
112 long getNonce();
113
114 /**
115 * Obtains source EID.
116 *
117 * @return source EID
118 */
119 LispAfiAddress getSourceEid();
120
121 /**
122 * Obtains a collection of ITR RLOCs.
123 *
124 * @return a collection of ITR RLOCs
125 */
126 List<LispAfiAddress> getItrRlocs();
127
128 /**
129 * Obtains a collection of EID records.
130 *
131 * @return a collection of EID records
132 */
Jian Li10a09062016-07-26 23:58:50 +0900133 List<LispEidRecord> getEids();
Jian Li719b3bf2016-07-22 00:38:29 +0900134
135 /**
Jian Li3e1bac22016-12-06 02:08:12 +0900136 * Obtains the size of map-reply record.
137 *
138 * @return the size of map-reply record
139 */
140 int getReplyRecord();
141
142 /**
Jian Li719b3bf2016-07-22 00:38:29 +0900143 * A builder of LISP map request message.
144 */
145 interface RequestBuilder extends Builder {
146
147 /**
Jian Lif59c0ad2016-08-02 18:11:30 +0900148 * Sets authoritative flag.
Jian Li719b3bf2016-07-22 00:38:29 +0900149 *
Jian Lif59c0ad2016-08-02 18:11:30 +0900150 * @param authoritative authoritative flag
Jian Li719b3bf2016-07-22 00:38:29 +0900151 * @return RequestBuilder object
152 */
Jian Lif59c0ad2016-08-02 18:11:30 +0900153 RequestBuilder withIsAuthoritative(boolean authoritative);
Jian Li719b3bf2016-07-22 00:38:29 +0900154
155 /**
Jian Lif59c0ad2016-08-02 18:11:30 +0900156 * Sets probe flag.
Jian Li719b3bf2016-07-22 00:38:29 +0900157 *
Jian Lif59c0ad2016-08-02 18:11:30 +0900158 * @param probe probe flag
Jian Li719b3bf2016-07-22 00:38:29 +0900159 * @return RequestBuilder object
160 */
Jian Lif59c0ad2016-08-02 18:11:30 +0900161 RequestBuilder withIsProbe(boolean probe);
Jian Li719b3bf2016-07-22 00:38:29 +0900162
163 /**
Jian Lif59c0ad2016-08-02 18:11:30 +0900164 * Sets map data resent flag.
Jian Li719b3bf2016-07-22 00:38:29 +0900165 *
Jian Lif59c0ad2016-08-02 18:11:30 +0900166 * @param mapDataPresent map data present flag
Jian Li719b3bf2016-07-22 00:38:29 +0900167 * @return RequestBuilder object
168 */
Jian Lif59c0ad2016-08-02 18:11:30 +0900169 RequestBuilder withIsMapDataPresent(boolean mapDataPresent);
Jian Li719b3bf2016-07-22 00:38:29 +0900170
171 /**
Jian Lif59c0ad2016-08-02 18:11:30 +0900172 * Sets smr flag.
Jian Li719b3bf2016-07-22 00:38:29 +0900173 *
Jian Lif59c0ad2016-08-02 18:11:30 +0900174 * @param smr smr flag
Jian Li719b3bf2016-07-22 00:38:29 +0900175 * @return RequestBuilder object
176 */
Jian Lif59c0ad2016-08-02 18:11:30 +0900177 RequestBuilder withIsSmr(boolean smr);
Jian Li719b3bf2016-07-22 00:38:29 +0900178
179 /**
Jian Lif59c0ad2016-08-02 18:11:30 +0900180 * Sets pitr flag.
Jian Li719b3bf2016-07-22 00:38:29 +0900181 *
Jian Lif59c0ad2016-08-02 18:11:30 +0900182 * @param pitr pitr flag
Jian Li719b3bf2016-07-22 00:38:29 +0900183 * @return RequestBuilder object
184 */
Jian Lif59c0ad2016-08-02 18:11:30 +0900185 RequestBuilder withIsPitr(boolean pitr);
186
187 /**
188 * Sets smrInvoked flag.
189 *
190 * @param smrInvoked smrInvoked flag
191 * @return RequestBuilder object
192 */
193 RequestBuilder withIsSmrInvoked(boolean smrInvoked);
Jian Li719b3bf2016-07-22 00:38:29 +0900194
195 /**
Jian Li719b3bf2016-07-22 00:38:29 +0900196 * Sets nonce value.
197 *
198 * @param nonce nonce value
199 * @return RequestBuilder object
200 */
201 RequestBuilder withNonce(long nonce);
202
203 /**
Jian Lif59c0ad2016-08-02 18:11:30 +0900204 * Sets source EID address.
205 *
206 * @param sourceEid source EID
207 * @return RequestBuilder object
208 */
209 RequestBuilder withSourceEid(LispAfiAddress sourceEid);
210
211 /**
Jian Li47671902016-08-11 01:18:18 +0900212 * Sets a collection of ITR RLOCs.
Jian Li719b3bf2016-07-22 00:38:29 +0900213 *
Jian Li47671902016-08-11 01:18:18 +0900214 * @param itrRlocs a collection of ITR RLOCs
Jian Li719b3bf2016-07-22 00:38:29 +0900215 * @return RequestBuilder object
216 */
Jian Li47671902016-08-11 01:18:18 +0900217 RequestBuilder withItrRlocs(List<LispAfiAddress> itrRlocs);
Jian Li719b3bf2016-07-22 00:38:29 +0900218
219 /**
Jian Li47671902016-08-11 01:18:18 +0900220 * Sets a collection of EID records.
Jian Li719b3bf2016-07-22 00:38:29 +0900221 *
Jian Li47671902016-08-11 01:18:18 +0900222 * @param records a collection of EID records
Jian Li719b3bf2016-07-22 00:38:29 +0900223 * @return RequestBuilder object
224 */
Jian Li47671902016-08-11 01:18:18 +0900225 RequestBuilder withEidRecords(List<LispEidRecord> records);
Jian Li525fded2016-08-04 01:15:33 +0900226
227 /**
Jian Li3e1bac22016-12-06 02:08:12 +0900228 * Sets the size of map-reply record.
229 *
230 * @param replyRecord the size of map-reply record
231 * @return RequestBuilder object
232 */
233 RequestBuilder withReplyRecord(int replyRecord);
234
235 /**
Jian Li525fded2016-08-04 01:15:33 +0900236 * Builds LISP map request message.
237 *
238 * @return LISP map request message
239 */
240 LispMapRequest build();
Jian Li719b3bf2016-07-22 00:38:29 +0900241 }
Jian Li451175e2016-07-19 23:22:20 +0900242}