Sho SHIMIZU | 74361c1 | 2015-08-11 12:31:48 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | 5ab426f | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2015-present Open Networking Laboratory |
Sho SHIMIZU | 74361c1 | 2015-08-11 12:31:48 -0700 | [diff] [blame] | 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 | import org.jboss.netty.buffer.ChannelBuffer; |
| 20 | import org.onosproject.pcepio.exceptions.PcepParseException; |
| 21 | import org.onosproject.pcepio.types.PcepObjectHeader; |
| 22 | import org.onosproject.pcepio.types.PcepValueType; |
| 23 | |
| 24 | /** |
| 25 | * Abstraction of an entity providing PCEP IRO Object. |
| 26 | */ |
| 27 | public interface PcepIroObject { |
| 28 | |
| 29 | /** |
| 30 | * Returns list of SubObjects. |
| 31 | * |
| 32 | * @return list of SubObjects |
| 33 | */ |
| 34 | LinkedList<PcepValueType> getSubObjects(); |
| 35 | |
| 36 | /** |
| 37 | * Sets list of SubObjects. |
| 38 | * |
| 39 | * @param llSubObjects list of SubObjects |
| 40 | */ |
| 41 | void setSubObjects(LinkedList<PcepValueType> llSubObjects); |
| 42 | |
| 43 | /** |
Sho SHIMIZU | 74361c1 | 2015-08-11 12:31:48 -0700 | [diff] [blame] | 44 | * Writes the IRO into channel buffer. |
| 45 | * |
| 46 | * @param bb channel buffer |
| 47 | * @return Returns the writerIndex of this buffer |
| 48 | * @throws PcepParseException while writing IRO object. |
| 49 | */ |
Sho SHIMIZU | 260f6ef | 2015-08-11 13:53:31 -0700 | [diff] [blame] | 50 | int write(ChannelBuffer bb) throws PcepParseException; |
Sho SHIMIZU | 74361c1 | 2015-08-11 12:31:48 -0700 | [diff] [blame] | 51 | |
| 52 | /** |
| 53 | * Builder interface with get and set functions to build IRO object. |
| 54 | */ |
Sho SHIMIZU | 260f6ef | 2015-08-11 13:53:31 -0700 | [diff] [blame] | 55 | interface Builder { |
Sho SHIMIZU | 74361c1 | 2015-08-11 12:31:48 -0700 | [diff] [blame] | 56 | |
| 57 | /** |
| 58 | * Builds IRO Object. |
| 59 | * |
| 60 | * @return IRO Object |
| 61 | */ |
| 62 | PcepIroObject build(); |
| 63 | |
| 64 | /** |
| 65 | * Returns IRO object header. |
| 66 | * |
| 67 | * @return IRO object header |
| 68 | */ |
| 69 | PcepObjectHeader getIroObjHeader(); |
| 70 | |
| 71 | /** |
| 72 | * Sets IRO object header and returns its builder. |
| 73 | * |
| 74 | * @param obj IRO object header |
| 75 | * @return Builder by setting IRO object header |
| 76 | */ |
| 77 | Builder setIroObjHeader(PcepObjectHeader obj); |
| 78 | |
| 79 | /** |
| 80 | * Returns list of SubObjects. |
| 81 | * |
| 82 | * @return list of SubObjects |
| 83 | */ |
| 84 | LinkedList<PcepValueType> getSubObjects(); |
| 85 | |
| 86 | /** |
| 87 | * Sets list of SubObjects in IRO Object and returns its builder. |
| 88 | * |
| 89 | * @param llSubObjects list of SubObjects |
| 90 | * @return Builder by setting list of SubObjects |
| 91 | */ |
| 92 | Builder setSubObjects(LinkedList<PcepValueType> llSubObjects); |
| 93 | |
| 94 | /** |
| 95 | * Sets P flag in IRO object header and returns its builder. |
| 96 | * |
| 97 | * @param value boolean value to set P flag |
| 98 | * @return Builder by setting P flag |
| 99 | */ |
| 100 | Builder setPFlag(boolean value); |
| 101 | |
| 102 | /** |
| 103 | * Sets I flag in IRO object header and returns its builder. |
| 104 | * |
| 105 | * @param value boolean value to set I flag |
| 106 | * @return Builder by setting I flag |
| 107 | */ |
| 108 | Builder setIFlag(boolean value); |
| 109 | } |
| 110 | } |