Phaneendra Manda | 1c0061d | 2015-08-06 12:29:38 +0530 | [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 RRO Object.
|
| 27 | */
|
| 28 | public interface PcepRroObject {
|
| 29 |
|
| 30 | /**
|
| 31 | * Returns list of SubObjects.
|
| 32 | *
|
| 33 | * @return list of SubObjects
|
| 34 | */
|
| 35 | LinkedList<PcepValueType> getSubObjects();
|
| 36 |
|
| 37 | /**
|
| 38 | * Sets list of SubObjects and return its builder.
|
| 39 | *
|
| 40 | * @param llSubObjects list of SubObjects
|
| 41 | */
|
| 42 | void setSubObjects(LinkedList<PcepValueType> llSubObjects);
|
| 43 |
|
| 44 | /**
|
| 45 | * Prints attributes of RRO object.
|
| 46 | */
|
| 47 | void print();
|
| 48 |
|
| 49 | /**
|
| 50 | * Writes the RRO Object into channel buffer.
|
| 51 | *
|
| 52 | * @param bb channel buffer
|
| 53 | * @return Returns the writerIndex of this buffer
|
| 54 | * @throws PcepParseException when object header failed to write in channel buffer
|
| 55 | */
|
| 56 | public int write(ChannelBuffer bb) throws PcepParseException;
|
| 57 |
|
| 58 | /**
|
| 59 | * Builder interface with get and set functions to build RRO object.
|
| 60 | */
|
| 61 | public interface Builder {
|
| 62 |
|
| 63 | /**
|
| 64 | * Builds RRO Object.
|
| 65 | *
|
| 66 | * @return RRO Object
|
| 67 | */
|
| 68 | PcepRroObject build();
|
| 69 |
|
| 70 | /**
|
| 71 | * Returns RRO object header.
|
| 72 | *
|
| 73 | * @return RRO object header
|
| 74 | */
|
| 75 | PcepObjectHeader getRroObjHeader();
|
| 76 |
|
| 77 | /**
|
| 78 | * Sets RRO object header and returns its builder.
|
| 79 | *
|
| 80 | * @param obj RRO object header
|
| 81 | * @return Builder by setting RRO object header
|
| 82 | */
|
| 83 | Builder setRroObjHeader(PcepObjectHeader obj);
|
| 84 |
|
| 85 | /**
|
| 86 | * Returns list of SubObjects.
|
| 87 | *
|
| 88 | * @return list of SubObjects
|
| 89 | */
|
| 90 | LinkedList<PcepValueType> getSubObjects();
|
| 91 |
|
| 92 | /**
|
| 93 | * Sets list of SubObjects in RRO Object and returns its builder.
|
| 94 | *
|
| 95 | * @param llSubObjects list of SubObjects
|
| 96 | * @return Builder by setting list of SubObjects
|
| 97 | */
|
| 98 | Builder setSubObjects(LinkedList<PcepValueType> llSubObjects);
|
| 99 |
|
| 100 | /**
|
| 101 | * Sets P flag in RRO object header and returns its builder.
|
| 102 | *
|
| 103 | * @param value boolean value to set P flag
|
| 104 | * @return Builder by setting P flag
|
| 105 | */
|
| 106 | Builder setPFlag(boolean value);
|
| 107 |
|
| 108 | /**
|
| 109 | * Sets I flag in RRO object header and returns its builder.
|
| 110 | *
|
| 111 | * @param value boolean value to set I flag
|
| 112 | * @return Builder by setting I flag
|
| 113 | */
|
| 114 | Builder setIFlag(boolean value);
|
| 115 | }
|
| 116 | } |