Sho SHIMIZU | 74361c1 | 2015-08-11 12:31:48 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2015 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.pcepio.protocol; |
| 17 | |
| 18 | import java.util.LinkedList; |
| 19 | |
| 20 | import org.jboss.netty.buffer.ChannelBuffer; |
| 21 | import org.onosproject.pcepio.exceptions.PcepParseException; |
| 22 | import org.onosproject.pcepio.types.PcepObjectHeader; |
| 23 | import org.onosproject.pcepio.types.PcepValueType; |
| 24 | |
| 25 | /** |
| 26 | * Abstraction of an entity providing PCEP RP Object. |
| 27 | */ |
| 28 | public interface PcepRPObject { |
| 29 | |
| 30 | /** |
| 31 | * Returns RequestId Number in RP Object. |
| 32 | * |
| 33 | * @return RequestId Number in RP Object |
| 34 | */ |
| 35 | int getRequestIdNum(); |
| 36 | |
| 37 | /** |
| 38 | * Sets RequestId Number with specified value. |
| 39 | * |
| 40 | * @param value RequestId Number |
| 41 | */ |
| 42 | void setRequestIdNum(int value); |
| 43 | |
| 44 | /** |
| 45 | * Returns O flag in RP Object. |
| 46 | * |
| 47 | * @return O flag in RP Object |
| 48 | */ |
| 49 | boolean getOFlag(); |
| 50 | |
| 51 | /** |
| 52 | * Sets O flag with specified value. |
| 53 | * |
| 54 | * @param value O flag |
| 55 | */ |
| 56 | void setOFlag(boolean value); |
| 57 | |
| 58 | /** |
| 59 | * Returns B flag in RP Object. |
| 60 | * |
| 61 | * @return B flag in RP Object |
| 62 | */ |
| 63 | boolean getBFlag(); |
| 64 | |
| 65 | /** |
| 66 | * Sets B flag with specified value. |
| 67 | * |
| 68 | * @param value B flag |
| 69 | */ |
| 70 | void setBFlag(boolean value); |
| 71 | |
| 72 | /** |
| 73 | * Returns R flag in RP Object. |
| 74 | * |
| 75 | * @return R flag in RP Object |
| 76 | */ |
| 77 | boolean getRFlag(); |
| 78 | |
| 79 | /** |
| 80 | * Sets R flag with specified value. |
| 81 | * |
| 82 | * @param value R flag |
| 83 | */ |
| 84 | void setRFlag(boolean value); |
| 85 | |
| 86 | /** |
| 87 | * Returns Priority Flag in RP Object. |
| 88 | * |
| 89 | * @return Priority Flag in RP Object |
| 90 | */ |
| 91 | byte getPriFlag(); |
| 92 | |
| 93 | /** |
| 94 | * Sets Priority Flag with specified value. |
| 95 | * |
| 96 | * @param value Priority Flag |
| 97 | */ |
| 98 | void setPriFlag(byte value); |
| 99 | |
| 100 | /** |
| 101 | * Returns list of Optional Tlvs in RP Object. |
| 102 | * |
| 103 | * @return list of Optional Tlvs in RP Object |
| 104 | */ |
| 105 | LinkedList<PcepValueType> getOptionalTlv(); |
| 106 | |
| 107 | /** |
| 108 | * Sets list of Optional Tlvs in RP Object and returns its builder. |
| 109 | * |
| 110 | * @param llOptionalTlv list of Optional Tlvs |
| 111 | */ |
| 112 | void setOptionalTlv(LinkedList<PcepValueType> llOptionalTlv); |
| 113 | |
| 114 | /** |
| 115 | * Prints attributes of RP object. |
| 116 | */ |
| 117 | void print(); |
| 118 | |
| 119 | /** |
| 120 | * Writes the RP Object into channel buffer. |
| 121 | * |
| 122 | * @param bb channel buffer |
| 123 | * @return Returns the writerIndex of this buffer |
| 124 | * @throws PcepParseException while writing RP object into Channel Buffer. |
| 125 | */ |
| 126 | int write(ChannelBuffer bb) throws PcepParseException; |
| 127 | |
| 128 | /** |
| 129 | * Builder interface with get and set functions to build bandwidth object. |
| 130 | */ |
Sho SHIMIZU | 260f6ef | 2015-08-11 13:53:31 -0700 | [diff] [blame] | 131 | interface Builder { |
Sho SHIMIZU | 74361c1 | 2015-08-11 12:31:48 -0700 | [diff] [blame] | 132 | |
| 133 | /** |
| 134 | * Builds RP Object. |
| 135 | * |
| 136 | * @return RP Object |
| 137 | */ |
| 138 | PcepRPObject build(); |
| 139 | |
| 140 | /** |
| 141 | * Returns RP object header. |
| 142 | * |
| 143 | * @return RP object header |
| 144 | */ |
| 145 | PcepObjectHeader getRPObjHeader(); |
| 146 | |
| 147 | /** |
| 148 | * Sets RP object header and returns its builder. |
| 149 | * |
| 150 | * @param obj RP object header |
| 151 | * @return Builder by setting RP object header |
| 152 | */ |
| 153 | Builder setRPObjHeader(PcepObjectHeader obj); |
| 154 | |
| 155 | /** |
| 156 | * Returns Request Id Number in RP Object. |
| 157 | * |
| 158 | * @return Request Id Number in RP Object |
| 159 | */ |
| 160 | int getRequestIdNum(); |
| 161 | |
| 162 | /** |
| 163 | * Sets Request Id Number and returns its builder. |
| 164 | * |
| 165 | * @param value Request Id Number |
| 166 | * @return Builder by setting Request Id Number |
| 167 | */ |
| 168 | Builder setRequestIdNum(int value); |
| 169 | |
| 170 | /** |
| 171 | * Returns O flag in RP Object. |
| 172 | * |
| 173 | * @return O flag in RP Object |
| 174 | */ |
| 175 | boolean getOFlag(); |
| 176 | |
| 177 | /** |
| 178 | * Sets O flag and returns its builder. |
| 179 | * |
| 180 | * @param value O flag |
| 181 | * @return Builder by setting O flag |
| 182 | */ |
| 183 | Builder setOFlag(boolean value); |
| 184 | |
| 185 | /** |
| 186 | * Returns B flag in RP Object. |
| 187 | * |
| 188 | * @return B flag in RP Object |
| 189 | */ |
| 190 | boolean getBFlag(); |
| 191 | |
| 192 | /** |
| 193 | * Sets B flag and returns its builder. |
| 194 | * |
| 195 | * @param value B flag |
| 196 | * @return Builder by setting B flag |
| 197 | */ |
| 198 | Builder setBFlag(boolean value); |
| 199 | |
| 200 | /** |
| 201 | * Returns R flag in RP Object. |
| 202 | * |
| 203 | * @return R flag in RP Object |
| 204 | */ |
| 205 | boolean getRFlag(); |
| 206 | |
| 207 | /** |
| 208 | * Sets R flag and returns its builder. |
| 209 | * |
| 210 | * @param value R flag |
| 211 | * @return Builder by setting R flag |
| 212 | */ |
| 213 | Builder setRFlag(boolean value); |
| 214 | |
| 215 | /** |
| 216 | * Returns Priority Flag in RP Object. |
| 217 | * |
| 218 | * @return Priority Flag in RP Object |
| 219 | */ |
| 220 | byte getPriFlag(); |
| 221 | |
| 222 | /** |
| 223 | * Sets Priority Flag and returns its builder. |
| 224 | * |
| 225 | * @param value Priority Flag |
| 226 | * @return Builder by setting Priority Flag |
| 227 | */ |
| 228 | Builder setPriFlag(byte value); |
| 229 | |
| 230 | /** |
| 231 | * Returns list of Optional Tlvs in RP Object. |
| 232 | * |
| 233 | * @return list of Optional Tlvs |
| 234 | */ |
| 235 | LinkedList<PcepValueType> getOptionalTlv(); |
| 236 | |
| 237 | /** |
| 238 | * Sets list of Optional Tlvs and returns its builder. |
| 239 | * |
| 240 | * @param llOptionalTlv list of Optional Tlvs |
| 241 | * @return Builder by setting list of Optional Tlvs |
| 242 | */ |
| 243 | Builder setOptionalTlv(LinkedList<PcepValueType> llOptionalTlv); |
| 244 | |
| 245 | /** |
| 246 | * Sets P flag in RP object header and returns its builder. |
| 247 | * |
| 248 | * @param value boolean value to set P flag |
| 249 | * @return Builder by setting P flag |
| 250 | */ |
| 251 | Builder setPFlag(boolean value); |
| 252 | |
| 253 | /** |
| 254 | * Sets I flag in RP object header and returns its builder. |
| 255 | * |
| 256 | * @param value boolean value to set I flag |
| 257 | * @return Builder by setting I flag |
| 258 | */ |
| 259 | Builder setIFlag(boolean value); |
| 260 | } |
| 261 | } |