blob: 84830e9d41dbf7b12ea6150db69e8efbf3efa433 [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 Li8fc2d2f2016-08-08 14:43:53 +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
Jian Li719b3bf2016-07-22 00:38:29 +090030 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
31 * |Type=4 | Reserved | Record Count |
32 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
33 * | Nonce . . . |
34 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
35 * | . . . Nonce |
36 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
37 * | Key ID | Authentication Data Length |
38 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
39 * ~ Authentication Data ~
40 * +-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
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 /**
81 * Obtains authentication data.
82 *
83 * @return authentication data
84 */
85 byte[] getAuthenticationData();
86
87 /**
88 * Obtains a collection of records.
89 *
90 * @return a collection of records
91 */
Jian Li10a09062016-07-26 23:58:50 +090092 List<LispMapRecord> getLispRecords();
Jian Li719b3bf2016-07-22 00:38:29 +090093
94 /**
95 * A builder of LISP map notify message.
96 */
97 interface NotifyBuilder extends Builder {
98
99 /**
100 * Sets nonce value.
101 *
102 * @param nonce nonce value
103 * @return NotifyBuilder object
104 */
105 NotifyBuilder withNonce(long nonce);
106
107 /**
108 * Sets record count.
109 *
110 * @param recordCount record count
111 * @return NotifyBuilder object
112 */
113 NotifyBuilder withRecordCount(byte recordCount);
114
115 /**
116 * Sets key identitifer.
117 *
118 * @param keyId key identifier
119 * @return NotifyBuilder object
120 */
121 NotifyBuilder withKeyId(short keyId);
122
123 /**
124 * Sets authentication data.
125 *
126 * @param authenticationData authentication data
127 * @return NotifyBuilder object
128 */
129 NotifyBuilder withAuthenticationData(byte[] authenticationData);
130
131 /**
Jian Li47671902016-08-11 01:18:18 +0900132 * Sets a collection of map records.
Jian Li719b3bf2016-07-22 00:38:29 +0900133 *
Jian Li47671902016-08-11 01:18:18 +0900134 * @param mapRecords a collection of map records
135 * @return RegisterBuilder object
Jian Li719b3bf2016-07-22 00:38:29 +0900136 */
Jian Li47671902016-08-11 01:18:18 +0900137 NotifyBuilder withMapRecords(List<LispMapRecord> mapRecords);
Jian Li525fded2016-08-04 01:15:33 +0900138
139 /**
140 * Builds LISP map notify message.
141 *
142 * @return LISP map notify message
143 */
144 LispMapNotify build();
Jian Li719b3bf2016-07-22 00:38:29 +0900145 }
Jian Li451175e2016-07-19 23:22:20 +0900146}