Jian Li | 451175e | 2016-07-19 23:22:20 +0900 | [diff] [blame] | 1 | /* |
| 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 | */ |
| 16 | package org.onosproject.lisp.msg.protocols; |
| 17 | |
Jian Li | 719b3bf | 2016-07-22 00:38:29 +0900 | [diff] [blame] | 18 | import java.util.List; |
| 19 | |
Jian Li | 451175e | 2016-07-19 23:22:20 +0900 | [diff] [blame] | 20 | /** |
| 21 | * LISP map notify message interface. |
Jian Li | 8fc2d2f | 2016-08-08 14:43:53 +0900 | [diff] [blame] | 22 | * <p> |
Jian Li | 719b3bf | 2016-07-22 00:38:29 +0900 | [diff] [blame] | 23 | * LISP map notify message format is defined in RFC6830. |
| 24 | * https://tools.ietf.org/html/rfc6830#page-39 |
| 25 | * |
Yuta HIGUCHI | 4b02211 | 2016-08-03 10:56:55 -0700 | [diff] [blame] | 26 | * <pre> |
| 27 | * {@literal |
Jian Li | 4eb3e3a | 2016-08-21 16:20:20 +0900 | [diff] [blame] | 28 | * 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 Li | 719b3bf | 2016-07-22 00:38:29 +0900 | [diff] [blame] | 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 HIGUCHI | 4b02211 | 2016-08-03 10:56:55 -0700 | [diff] [blame] | 55 | * }</pre> |
Jian Li | 451175e | 2016-07-19 23:22:20 +0900 | [diff] [blame] | 56 | */ |
| 57 | public interface LispMapNotify extends LispMessage { |
Jian Li | 719b3bf | 2016-07-22 00:38:29 +0900 | [diff] [blame] | 58 | |
| 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 | */ |
Jian Li | 42b3e43 | 2016-08-31 01:05:20 +0900 | [diff] [blame] | 71 | int getRecordCount(); |
Jian Li | 719b3bf | 2016-07-22 00:38:29 +0900 | [diff] [blame] | 72 | |
| 73 | /** |
| 74 | * Obtains key identifier. |
| 75 | * |
| 76 | * @return key identifier |
| 77 | */ |
| 78 | short getKeyId(); |
| 79 | |
| 80 | /** |
Jian Li | edc5db1 | 2016-08-23 17:30:19 +0900 | [diff] [blame] | 81 | * Obtains authentication data length. |
| 82 | * |
| 83 | * @return authentication data length |
| 84 | */ |
| 85 | short getAuthDataLength(); |
| 86 | |
| 87 | /** |
Jian Li | 719b3bf | 2016-07-22 00:38:29 +0900 | [diff] [blame] | 88 | * 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 Li | edc5db1 | 2016-08-23 17:30:19 +0900 | [diff] [blame] | 99 | List<LispMapRecord> getMapRecords(); |
Jian Li | 719b3bf | 2016-07-22 00:38:29 +0900 | [diff] [blame] | 100 | |
| 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 | /** |
Jian Li | 719b3bf | 2016-07-22 00:38:29 +0900 | [diff] [blame] | 115 | * Sets key identitifer. |
| 116 | * |
| 117 | * @param keyId key identifier |
| 118 | * @return NotifyBuilder object |
| 119 | */ |
| 120 | NotifyBuilder withKeyId(short keyId); |
| 121 | |
| 122 | /** |
Jian Li | edc5db1 | 2016-08-23 17:30:19 +0900 | [diff] [blame] | 123 | * Sets authentication data length. |
| 124 | * |
| 125 | * @param authDataLength authentication data length |
| 126 | * @return NotifyBuilder object |
| 127 | */ |
| 128 | NotifyBuilder withAuthDataLength(short authDataLength); |
| 129 | |
| 130 | /** |
Jian Li | 719b3bf | 2016-07-22 00:38:29 +0900 | [diff] [blame] | 131 | * Sets authentication data. |
| 132 | * |
| 133 | * @param authenticationData authentication data |
| 134 | * @return NotifyBuilder object |
| 135 | */ |
| 136 | NotifyBuilder withAuthenticationData(byte[] authenticationData); |
| 137 | |
| 138 | /** |
Jian Li | 4767190 | 2016-08-11 01:18:18 +0900 | [diff] [blame] | 139 | * Sets a collection of map records. |
Jian Li | 719b3bf | 2016-07-22 00:38:29 +0900 | [diff] [blame] | 140 | * |
Jian Li | 4767190 | 2016-08-11 01:18:18 +0900 | [diff] [blame] | 141 | * @param mapRecords a collection of map records |
| 142 | * @return RegisterBuilder object |
Jian Li | 719b3bf | 2016-07-22 00:38:29 +0900 | [diff] [blame] | 143 | */ |
Jian Li | 4767190 | 2016-08-11 01:18:18 +0900 | [diff] [blame] | 144 | NotifyBuilder withMapRecords(List<LispMapRecord> mapRecords); |
Jian Li | 525fded | 2016-08-04 01:15:33 +0900 | [diff] [blame] | 145 | |
| 146 | /** |
| 147 | * Builds LISP map notify message. |
| 148 | * |
| 149 | * @return LISP map notify message |
| 150 | */ |
| 151 | LispMapNotify build(); |
Jian Li | 719b3bf | 2016-07-22 00:38:29 +0900 | [diff] [blame] | 152 | } |
Jian Li | 451175e | 2016-07-19 23:22:20 +0900 | [diff] [blame] | 153 | } |