blob: f5341c21fbd4c60728cc5881d222c6d063a426c8 [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 java.util.List;
19
Jian Li451175e2016-07-19 23:22:20 +090020/**
21 * LISP map register message interface.
Jian Li8fc2d2f2016-08-08 14:43:53 +090022 * <p>
Jian Li719b3bf2016-07-22 00:38:29 +090023 * LISP map register message format is defined in RFC6830.
24 * https://tools.ietf.org/html/rfc6830#page-37
25 *
Yuta HIGUCHI4b022112016-08-03 10:56:55 -070026 * <pre>
27 * {@literal
Jian Li4eb3e3a2016-08-21 16:20:20 +090028 * 0 1 2 3
29 * 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
30 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
31 * |Type=3 |P| Reserved |M| Record Count |
32 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
33 * | Nonce . . . |
34 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
35 * | . . . Nonce |
36 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
37 * | Key ID | Authentication Data Length |
38 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
39 * ~ Authentication Data ~
Jian Li719b3bf2016-07-22 00:38:29 +090040 * +-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
41 * | | Record TTL |
42 * | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
43 * R | Locator Count | EID mask-len | ACT |A| Reserved |
44 * e +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
45 * c | Rsvd | Map-Version Number | EID-Prefix-AFI |
46 * o +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
47 * r | EID-Prefix |
48 * d +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
49 * | /| Priority | Weight | M Priority | M Weight |
50 * | L +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
51 * | o | Unused Flags |L|p|R| Loc-AFI |
52 * | c +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
53 * | \| Locator |
54 * +-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Yuta HIGUCHI4b022112016-08-03 10:56:55 -070055 * }</pre>
Jian Li451175e2016-07-19 23:22:20 +090056 */
57public interface LispMapRegister extends LispMessage {
Jian Li719b3bf2016-07-22 00:38:29 +090058
59 /**
60 * Obtains proxy map reply flag.
61 *
62 * @return proxy map reply flag
63 */
64 boolean isProxyMapReply();
65
66 /**
67 * Obtains want map notify flag.
68 *
69 * @return want map notify flag
70 */
71 boolean isWantMapNotify();
72
73 /**
74 * Obtains record count value.
75 *
76 * @return record count value
77 */
Jian Li42b3e432016-08-31 01:05:20 +090078 int getRecordCount();
Jian Li719b3bf2016-07-22 00:38:29 +090079
80 /**
81 * Obtains nonce value.
82 *
83 * @return nonce value
84 */
85 long getNonce();
86
87 /**
88 * Obtains key identifier.
89 *
90 * @return key identifier
91 */
92 short getKeyId();
93
94 /**
Jian Liedc5db12016-08-23 17:30:19 +090095 * Obtains authentication data length.
96 *
97 * @return authentication data length
98 */
99 short getAuthDataLength();
100
101 /**
Jian Li719b3bf2016-07-22 00:38:29 +0900102 * Obtains authentication data.
103 *
104 * @return authentication data
105 */
106 byte[] getAuthenticationData();
107
108 /**
109 * Obtains a collection of records.
110 *
111 * @return a collection of records
112 */
Jian Lia7b394d2016-08-21 23:11:46 +0900113 List<LispMapRecord> getMapRecords();
Jian Li719b3bf2016-07-22 00:38:29 +0900114
115 /**
116 * A builder of LISP map register message.
117 */
118 interface RegisterBuilder extends Builder {
119
120 /**
121 * Sets isProxyMapReply flag.
122 *
123 * @param isProxyMapReply isProxyMapReply
124 * @return RegisterBuilder object
125 */
126 RegisterBuilder withIsProxyMapReply(boolean isProxyMapReply);
127
128 /**
129 * Sets isWantMapNotify flag.
130 *
131 * @param isWantMapNotify isWantMapNotify
132 * @return RegisterBuilder object
133 */
134 RegisterBuilder withIsWantMapNotify(boolean isWantMapNotify);
135
136 /**
Jian Li719b3bf2016-07-22 00:38:29 +0900137 * Sets nonce value.
138 *
139 * @param nonce nonce value
140 * @return RegisterBuilder object
141 */
142 RegisterBuilder withNonce(long nonce);
143
144 /**
Jian Liedc5db12016-08-23 17:30:19 +0900145 * Sets authentication data length.
146 *
147 * @param authDataLength authentication data length
148 * @return RegisterBuilder object
149 */
150 RegisterBuilder withAuthDataLength(short authDataLength);
151
152 /**
Jian Li719b3bf2016-07-22 00:38:29 +0900153 * Sets key identifier.
154 *
155 * @param keyId key identifier
156 * @return RegisterBuilder object
157 */
158 RegisterBuilder withKeyId(short keyId);
159
160 /**
161 * Sets authentication data.
162 *
163 * @param authenticationData authentication data
164 * @return RegisterBuilder object
165 */
166 RegisterBuilder withAuthenticationData(byte[] authenticationData);
167
168 /**
Jian Li47671902016-08-11 01:18:18 +0900169 * Sets a collection of map records.
Jian Li719b3bf2016-07-22 00:38:29 +0900170 *
Jian Li47671902016-08-11 01:18:18 +0900171 * @param mapRecords a collection of map records
Jian Li719b3bf2016-07-22 00:38:29 +0900172 * @return RegisterBuilder object
173 */
Jian Li47671902016-08-11 01:18:18 +0900174 RegisterBuilder withMapRecords(List<LispMapRecord> mapRecords);
Jian Li525fded2016-08-04 01:15:33 +0900175
176 /**
177 * Builds LISP map register message.
178 *
179 * @return LISP map register message
180 */
181 LispMapRegister build();
Jian Li719b3bf2016-07-22 00:38:29 +0900182 }
Jian Li451175e2016-07-19 23:22:20 +0900183}