Jian Li | 10a0906 | 2016-07-26 23:58:50 +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 org.onosproject.lisp.msg.types.LispAfiAddress; |
| 19 | |
| 20 | /** |
| 21 | * LISP record section which is part of LISP map register message. |
| 22 | */ |
| 23 | public interface LispMapRecord { |
| 24 | |
| 25 | /** |
| 26 | * Obtains record TTL value. |
| 27 | * |
| 28 | * @return record TTL value |
| 29 | */ |
| 30 | int getRecordTtl(); |
| 31 | |
| 32 | /** |
| 33 | * Obtains locator count value. |
| 34 | * |
| 35 | * @return locator count value |
| 36 | */ |
| 37 | int getLocatorCount(); |
| 38 | |
| 39 | /** |
| 40 | * Obtains address mask length. |
| 41 | * |
| 42 | * @return mask length |
| 43 | */ |
| 44 | byte getMaskLength(); |
| 45 | |
| 46 | /** |
| 47 | * Obtains LispMapReplyAction enum code. |
| 48 | * |
| 49 | * @return LispMapReplyAction enum code |
| 50 | */ |
| 51 | LispMapReplyAction getAction(); |
| 52 | |
| 53 | /** |
| 54 | * Obtains authoritative flag. |
| 55 | * |
| 56 | * @return authoritative flag |
| 57 | */ |
| 58 | boolean isAuthoritative(); |
| 59 | |
| 60 | /** |
| 61 | * Obtains map version number. |
| 62 | * |
| 63 | * @return map version number |
| 64 | */ |
| 65 | short getMapVersionNumber(); |
| 66 | |
| 67 | /** |
| 68 | * Obtains EID prefix. |
| 69 | * |
| 70 | * @return EID prefix |
| 71 | */ |
| 72 | LispAfiAddress getEidPrefixAfi(); |
| 73 | |
| 74 | /** |
| 75 | * A builder of LISP map record. |
| 76 | */ |
| 77 | interface MapRecordBuilder { |
| 78 | |
| 79 | /** |
| 80 | * Sets record TTL value. |
| 81 | * |
| 82 | * @param recordTtl record TTL |
| 83 | * @return MapRecordBuilder object |
| 84 | */ |
| 85 | MapRecordBuilder withRecordTtl(int recordTtl); |
| 86 | |
| 87 | /** |
| 88 | * Sets locator count. |
| 89 | * |
| 90 | * @param locatorCount locator count |
| 91 | * @return MapRecordBuilder object |
| 92 | */ |
| 93 | MapRecordBuilder withLocatorCount(int locatorCount); |
| 94 | |
| 95 | /** |
| 96 | * Sets mask length. |
| 97 | * |
| 98 | * @param maskLength mask length |
| 99 | * @return MapRecordBuilder object |
| 100 | */ |
| 101 | MapRecordBuilder withMaskLength(byte maskLength); |
| 102 | |
| 103 | /** |
| 104 | * Sets LISP map reply action enum. |
| 105 | * |
| 106 | * @param action map reply action |
| 107 | * @return MapRecordBuilder object |
| 108 | */ |
| 109 | MapRecordBuilder withAction(LispMapReplyAction action); |
| 110 | |
| 111 | /** |
| 112 | * Sets authoritative flag. |
| 113 | * |
| 114 | * @param authoritative authoritative flag |
| 115 | * @return MapRecordBuilder object |
| 116 | */ |
| 117 | MapRecordBuilder withAuthoritative(boolean authoritative); |
| 118 | |
| 119 | /** |
| 120 | * Sets LISP map version number. |
| 121 | * |
| 122 | * @param mapVersionNumber map version number |
| 123 | * @return MapRecordBuilder object |
| 124 | */ |
| 125 | MapRecordBuilder withMapVersionNumber(short mapVersionNumber); |
| 126 | |
| 127 | /** |
| 128 | * Sets EID prefix. |
| 129 | * |
| 130 | * @param prefix EID prefix |
| 131 | * @return MapRecordBuilder object |
| 132 | */ |
| 133 | MapRecordBuilder withEidPrefixAfi(LispAfiAddress prefix); |
| 134 | } |
| 135 | } |