blob: 16f695602ddbe40cdd01cbbffb059ccd59be67c9 [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 */
78 byte getRecordCount();
79
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 /**
95 * Obtains authentication data.
96 *
97 * @return authentication data
98 */
99 byte[] getAuthenticationData();
100
101 /**
102 * Obtains a collection of records.
103 *
104 * @return a collection of records
105 */
Jian Lia7b394d2016-08-21 23:11:46 +0900106 List<LispMapRecord> getMapRecords();
Jian Li719b3bf2016-07-22 00:38:29 +0900107
108 /**
109 * A builder of LISP map register message.
110 */
111 interface RegisterBuilder extends Builder {
112
113 /**
114 * Sets isProxyMapReply flag.
115 *
116 * @param isProxyMapReply isProxyMapReply
117 * @return RegisterBuilder object
118 */
119 RegisterBuilder withIsProxyMapReply(boolean isProxyMapReply);
120
121 /**
122 * Sets isWantMapNotify flag.
123 *
124 * @param isWantMapNotify isWantMapNotify
125 * @return RegisterBuilder object
126 */
127 RegisterBuilder withIsWantMapNotify(boolean isWantMapNotify);
128
129 /**
130 * Sets record count.
131 *
132 * @param recordCount record count
133 * @return RegisterBuilder object
134 */
135 RegisterBuilder withRecordCount(byte recordCount);
136
137 /**
138 * Sets nonce value.
139 *
140 * @param nonce nonce value
141 * @return RegisterBuilder object
142 */
143 RegisterBuilder withNonce(long nonce);
144
145 /**
146 * Sets key identifier.
147 *
148 * @param keyId key identifier
149 * @return RegisterBuilder object
150 */
151 RegisterBuilder withKeyId(short keyId);
152
153 /**
154 * Sets authentication data.
155 *
156 * @param authenticationData authentication data
157 * @return RegisterBuilder object
158 */
159 RegisterBuilder withAuthenticationData(byte[] authenticationData);
160
161 /**
Jian Li47671902016-08-11 01:18:18 +0900162 * Sets a collection of map records.
Jian Li719b3bf2016-07-22 00:38:29 +0900163 *
Jian Li47671902016-08-11 01:18:18 +0900164 * @param mapRecords a collection of map records
Jian Li719b3bf2016-07-22 00:38:29 +0900165 * @return RegisterBuilder object
166 */
Jian Li47671902016-08-11 01:18:18 +0900167 RegisterBuilder withMapRecords(List<LispMapRecord> mapRecords);
Jian Li525fded2016-08-04 01:15:33 +0900168
169 /**
170 * Builds LISP map register message.
171 *
172 * @return LISP map register message
173 */
174 LispMapRegister build();
Jian Li719b3bf2016-07-22 00:38:29 +0900175 }
Jian Li451175e2016-07-19 23:22:20 +0900176}