Jian Li | 4767190 | 2016-08-11 01:18:18 +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 | |
| 18 | import io.netty.buffer.ByteBuf; |
| 19 | import org.onosproject.lisp.msg.types.LispAfiAddress; |
Jian Li | 5e505c6 | 2016-12-05 02:44:24 +0900 | [diff] [blame] | 20 | import org.onosproject.lisp.msg.exceptions.LispWriterException; |
Jian Li | 4767190 | 2016-08-11 01:18:18 +0900 | [diff] [blame] | 21 | |
| 22 | /** |
| 23 | * LISP locator record section which is part of LISP map record. |
| 24 | */ |
| 25 | public interface LispLocatorRecord { |
| 26 | |
| 27 | /** |
| 28 | * Obtains priority value. |
| 29 | * |
| 30 | * @return priority value |
| 31 | */ |
| 32 | byte getPriority(); |
| 33 | |
| 34 | /** |
| 35 | * Obtains weight value. |
| 36 | * |
| 37 | * @return weight value |
| 38 | */ |
| 39 | byte getWeight(); |
| 40 | |
| 41 | /** |
| 42 | * Obtains multi-cast priority value. |
| 43 | * |
| 44 | * @return multi-cast priority value |
| 45 | */ |
| 46 | byte getMulticastPriority(); |
| 47 | |
| 48 | /** |
| 49 | * Obtains multi-cast weight value. |
| 50 | * |
| 51 | * @return multi-cast weight value |
| 52 | */ |
| 53 | byte getMulticastWeight(); |
| 54 | |
| 55 | /** |
| 56 | * Obtains local locator flag. |
| 57 | * |
| 58 | * @return local locator flag |
| 59 | */ |
| 60 | boolean isLocalLocator(); |
| 61 | |
| 62 | /** |
| 63 | * Obtains RLOC probed flag. |
| 64 | * |
| 65 | * @return RLOC probed flag |
| 66 | */ |
| 67 | boolean isRlocProbed(); |
| 68 | |
| 69 | /** |
| 70 | * Obtains routed flag. |
| 71 | * |
| 72 | * @return routed flag |
| 73 | */ |
| 74 | boolean isRouted(); |
| 75 | |
| 76 | /** |
| 77 | * Obtains locator AFI. |
| 78 | * |
| 79 | * @return locator AFI |
| 80 | */ |
| 81 | LispAfiAddress getLocatorAfi(); |
| 82 | |
| 83 | /** |
| 84 | * Writes LISP message object into communication channel. |
| 85 | * |
| 86 | * @param byteBuf byte buffer |
Ray Milkey | 0bb1e10 | 2016-11-10 14:51:27 -0800 | [diff] [blame] | 87 | * @throws LispWriterException on error |
Jian Li | 4767190 | 2016-08-11 01:18:18 +0900 | [diff] [blame] | 88 | */ |
Yoonseon Han | ca814bf | 2016-09-12 11:37:48 -0700 | [diff] [blame] | 89 | void writeTo(ByteBuf byteBuf) throws LispWriterException; |
Jian Li | 4767190 | 2016-08-11 01:18:18 +0900 | [diff] [blame] | 90 | |
| 91 | /** |
| 92 | * A builder of LISP locator record. |
| 93 | */ |
| 94 | interface LocatorRecordBuilder { |
| 95 | |
| 96 | /** |
| 97 | * Sets priority value. |
| 98 | * |
| 99 | * @param priority priority |
| 100 | * @return LocatorRecordBuilder object |
| 101 | */ |
| 102 | LocatorRecordBuilder withPriority(byte priority); |
| 103 | |
| 104 | /** |
| 105 | * Sets weight value. |
| 106 | * |
| 107 | * @param weight weight |
| 108 | * @return LocatorRecordBuilder object |
| 109 | */ |
| 110 | LocatorRecordBuilder withWeight(byte weight); |
| 111 | |
| 112 | /** |
| 113 | * Sets multi-cast priority value. |
| 114 | * |
| 115 | * @param priority priority |
| 116 | * @return LocatorRecordBuilder object |
| 117 | */ |
| 118 | LocatorRecordBuilder withMulticastPriority(byte priority); |
| 119 | |
| 120 | /** |
| 121 | * Sets multi-cast weight value. |
| 122 | * |
| 123 | * @param weight weight |
| 124 | * @return LocatorRecordBuilder object |
| 125 | */ |
| 126 | LocatorRecordBuilder withMulticastWeight(byte weight); |
| 127 | |
| 128 | /** |
| 129 | * Sets local locator flag. |
| 130 | * |
| 131 | * @param localLocator local locator flag |
| 132 | * @return LocatorRecordBuilder object |
| 133 | */ |
| 134 | LocatorRecordBuilder withLocalLocator(boolean localLocator); |
| 135 | |
| 136 | /** |
| 137 | * Sets RLOC probed flag. |
| 138 | * |
| 139 | * @param rlocProbed RLOC probed flag |
| 140 | * @return LocatorRecordBuilder object |
| 141 | */ |
| 142 | LocatorRecordBuilder withRlocProbed(boolean rlocProbed); |
| 143 | |
| 144 | /** |
| 145 | * Sets routed flag. |
| 146 | * |
| 147 | * @param routed routed flag |
| 148 | * @return LocatorRecordBuilder object |
| 149 | */ |
| 150 | LocatorRecordBuilder withRouted(boolean routed); |
| 151 | |
| 152 | /** |
| 153 | * Sets locator AFI. |
| 154 | * |
| 155 | * @param locatorAfi locator AFI |
| 156 | * @return LocatorRecordBuilder object |
| 157 | */ |
| 158 | LocatorRecordBuilder withLocatorAfi(LispAfiAddress locatorAfi); |
| 159 | |
| 160 | /** |
| 161 | * Builds locator record. |
| 162 | * |
| 163 | * @return locator record instance |
| 164 | */ |
| 165 | LispLocatorRecord build(); |
| 166 | } |
| 167 | } |