blob: 052df6ad1ed931e86d90a64ac4787936fdc6fc93 [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 notify message interface.
Jian Li8fc2d2f2016-08-08 14:43:53 +090022 * <p>
Jian Li719b3bf2016-07-22 00:38:29 +090023 * LISP map notify message format is defined in RFC6830.
24 * https://tools.ietf.org/html/rfc6830#page-39
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=4 | Reserved | 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 LispMapNotify extends LispMessage {
Jian Li719b3bf2016-07-22 00:38:29 +090058
59 /**
60 * Obtains nonce value.
61 *
62 * @return nonce value
63 */
64 long getNonce();
65
66 /**
67 * Obtains record count value.
68 *
69 * @return record count value
70 */
71 byte getRecordCount();
72
73 /**
74 * Obtains key identifier.
75 *
76 * @return key identifier
77 */
78 short getKeyId();
79
80 /**
Jian Liedc5db12016-08-23 17:30:19 +090081 * Obtains authentication data length.
82 *
83 * @return authentication data length
84 */
85 short getAuthDataLength();
86
87 /**
Jian Li719b3bf2016-07-22 00:38:29 +090088 * Obtains authentication data.
89 *
90 * @return authentication data
91 */
92 byte[] getAuthenticationData();
93
94 /**
95 * Obtains a collection of records.
96 *
97 * @return a collection of records
98 */
Jian Liedc5db12016-08-23 17:30:19 +090099 List<LispMapRecord> getMapRecords();
Jian Li719b3bf2016-07-22 00:38:29 +0900100
101 /**
102 * A builder of LISP map notify message.
103 */
104 interface NotifyBuilder extends Builder {
105
106 /**
107 * Sets nonce value.
108 *
109 * @param nonce nonce value
110 * @return NotifyBuilder object
111 */
112 NotifyBuilder withNonce(long nonce);
113
114 /**
115 * Sets record count.
116 *
117 * @param recordCount record count
118 * @return NotifyBuilder object
119 */
120 NotifyBuilder withRecordCount(byte recordCount);
121
122 /**
123 * Sets key identitifer.
124 *
125 * @param keyId key identifier
126 * @return NotifyBuilder object
127 */
128 NotifyBuilder withKeyId(short keyId);
129
130 /**
Jian Liedc5db12016-08-23 17:30:19 +0900131 * Sets authentication data length.
132 *
133 * @param authDataLength authentication data length
134 * @return NotifyBuilder object
135 */
136 NotifyBuilder withAuthDataLength(short authDataLength);
137
138 /**
Jian Li719b3bf2016-07-22 00:38:29 +0900139 * Sets authentication data.
140 *
141 * @param authenticationData authentication data
142 * @return NotifyBuilder object
143 */
144 NotifyBuilder withAuthenticationData(byte[] authenticationData);
145
146 /**
Jian Li47671902016-08-11 01:18:18 +0900147 * Sets a collection of map records.
Jian Li719b3bf2016-07-22 00:38:29 +0900148 *
Jian Li47671902016-08-11 01:18:18 +0900149 * @param mapRecords a collection of map records
150 * @return RegisterBuilder object
Jian Li719b3bf2016-07-22 00:38:29 +0900151 */
Jian Li47671902016-08-11 01:18:18 +0900152 NotifyBuilder withMapRecords(List<LispMapRecord> mapRecords);
Jian Li525fded2016-08-04 01:15:33 +0900153
154 /**
155 * Builds LISP map notify message.
156 *
157 * @return LISP map notify message
158 */
159 LispMapNotify build();
Jian Li719b3bf2016-07-22 00:38:29 +0900160 }
Jian Li451175e2016-07-19 23:22:20 +0900161}