blob: 82cac1fb6224ac4bc9673d0acbd601ed96f9d2a2 [file] [log] [blame]
Phaneendra Manda1c0061d2015-08-06 12:29:38 +05301/*
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 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 /**
74 * Prints attributes of Label object.
75 */
76 void print();
77
78 /**
79 * Writes the Label Object into channel buffer.
80 *
81 * @param bb channel buffer
82 * @return Returns the writerIndex of this buffer
83 * @throws PcepParseException while writing LABEL object into Channel Buffer.
84 */
85 int write(ChannelBuffer bb) throws PcepParseException;
86
87 /**
88 * Builder interface with get and set functions to build Label object.
89 */
90 public interface Builder {
91
92 /**
93 * Builds Label Object.
94 *
95 * @return Label Object
96 * @throws PcepParseException while building LABEL object.
97 */
98 PcepLabelObject build() throws PcepParseException;
99
100 /**
101 * Returns Label object header.
102 *
103 * @return Label object header
104 */
105 PcepObjectHeader getLabelObjHeader();
106
107 /**
108 * Sets Label object header and returns its builder.
109 *
110 * @param obj Label object header
111 * @return Builder by setting Label object header
112 */
113 Builder setLabelObjHeader(PcepObjectHeader obj);
114
115 /**
116 * Returns O flag in Label Object.
117 *
118 * @return Label value
119 */
120 boolean getOFlag();
121
122 /**
123 * Sets O flag and return its builder.
124 *
125 * @param value O flag
126 * @return Builder by setting O flag
127 */
128 Builder setOFlag(boolean value);
129
130 /**
131 * Returns Label from Label Object.
132 *
133 * @return Label value
134 */
135 int getLabel();
136
137 /**
138 * Sets Label field and return its builder.
139 *
140 * @param value Label field
141 * @return Builder by setting Label field
142 */
143 Builder setLabel(int value);
144
145 /**
146 * Returns list of Optional Tlvs.
147 *
148 * @return list of Optional Tlvs
149 */
150 LinkedList<PcepValueType> getOptionalTlv();
151
152 /**
153 * Sets list of Optional Tlvs and return its builder.
154 *
155 * @param llOptionalTlv list of Optional Tlvs
156 * @return Builder by setting list of Optional Tlvs
157 */
158 Builder setOptionalTlv(LinkedList<PcepValueType> llOptionalTlv);
159
160 /**
161 * Sets P flag in Label object header and returns its builder.
162 *
163 * @param value boolean value to set P flag
164 * @return Builder by setting P flag
165 */
166 public Builder setPFlag(boolean value);
167
168 /**
169 * Sets I flag in Label object header and returns its builder.
170 *
171 * @param value boolean value to set I flag
172 * @return Builder by setting I flag
173 */
174 public Builder setIFlag(boolean value);
175 }
176}