blob: 3af6b759268ba93c668697b62ced2df3a7e794dd [file] [log] [blame]
Sho SHIMIZU74361c12015-08-11 12:31:48 -07001/*
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
17package org.onosproject.pcepio.protocol;
18
19import java.util.LinkedList;
20
21import org.jboss.netty.buffer.ChannelBuffer;
22import org.onosproject.pcepio.exceptions.PcepParseException;
23import org.onosproject.pcepio.types.PcepObjectHeader;
24import org.onosproject.pcepio.types.PcepValueType;
25
26/**
27 * Abstraction of an entity providing PCEP ERO Object.
28 */
29public interface PcepEroObject {
30
31 /**
32 * Return LinkedList of SubObjects of ERO Object.
33 *
34 * @return list of subobjects
35 */
36 LinkedList<PcepValueType> getSubObjects();
37
38 /**
39 * Sets LinkedList of SubObjects in ERO Object.
40 *
41 * @param llSubObjects list of subobjects
42 */
43 void setSubObjects(LinkedList<PcepValueType> llSubObjects);
44
45 /**
46 * Writes the ERO Object into channel buffer.
47 *
48 * @param bb channel buffer
49 * @return Returns the writerIndex of this buffer
50 * @throws PcepParseException while writing ERO Object into ChannelBuffer
51 */
Sho SHIMIZU260f6ef2015-08-11 13:53:31 -070052 int write(ChannelBuffer bb) throws PcepParseException;
Sho SHIMIZU74361c12015-08-11 12:31:48 -070053
54 /**
Sho SHIMIZU74361c12015-08-11 12:31:48 -070055 * Builder interface with get and set functions to build ERO object.
56 */
Sho SHIMIZU260f6ef2015-08-11 13:53:31 -070057 interface Builder {
Sho SHIMIZU74361c12015-08-11 12:31:48 -070058
59 /**
60 * Builds ERO Object.
61 *
62 * @return ERO Object
63 */
64 PcepEroObject build();
65
66 /**
67 * Returns ERO Object Header.
68 *
69 * @return ERO Object Header
70 */
71 PcepObjectHeader getEroObjHeader();
72
73 /**
74 * Sets ERO Object header and returns its builder.
75 *
76 * @param obj ERO Object header
77 * @return Builder by setting ERO Object header
78 */
79 Builder setEroObjHeader(PcepObjectHeader obj);
80
81 /**
82 * Returns LinkedList of SubObjects in ERO Objects.
83 *
84 * @return list of subobjects
85 */
86 LinkedList<PcepValueType> getSubObjects();
87
88 /**
89 * Sets LinkedList of SubObjects and returns its builder.
90 *
91 * @param llSubObjects list of SubObjects
92 * @return Builder by setting list of SubObjects
93 */
94 Builder setSubObjects(LinkedList<PcepValueType> llSubObjects);
95
96 /**
97 * Sets P flag in ERO object header and returns its builder.
98 *
99 * @param value boolean value to set P flag
100 * @return Builder by setting P flag
101 */
102 Builder setPFlag(boolean value);
103
104 /**
105 * Sets I flag in ERO object header and returns its builder.
106 *
107 * @param value boolean value to set I flag
108 * @return Builder by setting I flag
109 */
110 Builder setIFlag(boolean value);
111 }
Sho SHIMIZU260f6ef2015-08-11 13:53:31 -0700112}