blob: 10a7d16cf5c28f0affb1ba2cc6eb05120c1664da [file] [log] [blame]
Phaneendra Manda1c0061d2015-08-06 12:29:38 +05301/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2015-present Open Networking Laboratory
Phaneendra Manda1c0061d2015-08-06 12:29:38 +05303 *
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 Label Object.
28 */
29public interface PcepLabelObject {
30
31 /**
32 * Returns O flag in Label Object.
33 *
34 * @return Boolean value
35 */
36 boolean getOFlag();
37
38 /**
39 * Sets O flag in Label Object with specified value.
40 *
41 * @param value O flag
42 */
43 void setOFlag(boolean value);
44
45 /**
46 * Returns Label from Label Object.
47 *
48 * @return Label value
49 */
50 int getLabel();
51
52 /**
53 * Sets Label field in Label Object with specified value.
54 *
55 * @param value Label
56 */
57 void setLabel(int value);
58
59 /**
60 * Returns list of Optional Tlvs.
61 *
62 * @return list of Optional Tlvs
63 */
64 LinkedList<PcepValueType> getOptionalTlv();
65
66 /**
67 * Sets Optional Tlvs in Label Object.
68 *
69 * @param llOptionalTlv list of Optional Tlvs
70 */
71 void setOptionalTlv(LinkedList<PcepValueType> llOptionalTlv);
72
73 /**
Phaneendra Manda1c0061d2015-08-06 12:29:38 +053074 * Writes the Label Object into channel buffer.
75 *
76 * @param bb channel buffer
77 * @return Returns the writerIndex of this buffer
78 * @throws PcepParseException while writing LABEL object into Channel Buffer.
79 */
80 int write(ChannelBuffer bb) throws PcepParseException;
81
82 /**
83 * Builder interface with get and set functions to build Label object.
84 */
Sho SHIMIZU260f6ef2015-08-11 13:53:31 -070085 interface Builder {
Phaneendra Manda1c0061d2015-08-06 12:29:38 +053086
87 /**
88 * Builds Label Object.
89 *
90 * @return Label Object
91 * @throws PcepParseException while building LABEL object.
92 */
93 PcepLabelObject build() throws PcepParseException;
94
95 /**
96 * Returns Label object header.
97 *
98 * @return Label object header
99 */
100 PcepObjectHeader getLabelObjHeader();
101
102 /**
103 * Sets Label object header and returns its builder.
104 *
105 * @param obj Label object header
106 * @return Builder by setting Label object header
107 */
108 Builder setLabelObjHeader(PcepObjectHeader obj);
109
110 /**
111 * Returns O flag in Label Object.
112 *
113 * @return Label value
114 */
115 boolean getOFlag();
116
117 /**
118 * Sets O flag and return its builder.
119 *
120 * @param value O flag
121 * @return Builder by setting O flag
122 */
123 Builder setOFlag(boolean value);
124
125 /**
126 * Returns Label from Label Object.
127 *
128 * @return Label value
129 */
130 int getLabel();
131
132 /**
133 * Sets Label field and return its builder.
134 *
135 * @param value Label field
136 * @return Builder by setting Label field
137 */
138 Builder setLabel(int value);
139
140 /**
141 * Returns list of Optional Tlvs.
142 *
143 * @return list of Optional Tlvs
144 */
145 LinkedList<PcepValueType> getOptionalTlv();
146
147 /**
148 * Sets list of Optional Tlvs and return its builder.
149 *
150 * @param llOptionalTlv list of Optional Tlvs
151 * @return Builder by setting list of Optional Tlvs
152 */
153 Builder setOptionalTlv(LinkedList<PcepValueType> llOptionalTlv);
154
155 /**
156 * Sets P flag in Label object header and returns its builder.
157 *
158 * @param value boolean value to set P flag
159 * @return Builder by setting P flag
160 */
Sho SHIMIZU260f6ef2015-08-11 13:53:31 -0700161 Builder setPFlag(boolean value);
Phaneendra Manda1c0061d2015-08-06 12:29:38 +0530162
163 /**
164 * Sets I flag in Label object header and returns its builder.
165 *
166 * @param value boolean value to set I flag
167 * @return Builder by setting I flag
168 */
Sho SHIMIZU260f6ef2015-08-11 13:53:31 -0700169 Builder setIFlag(boolean value);
Phaneendra Manda1c0061d2015-08-06 12:29:38 +0530170 }
171}