blob: 16374d5bb23806c6aaf61b8a2692abd25390433d [file] [log] [blame]
bharat saraswale1806302015-08-21 12:16:46 +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 */
Sho SHIMIZU74361c12015-08-11 12:31:48 -070016package org.onosproject.pcepio.protocol;
17
18import java.util.LinkedList;
19
20import org.jboss.netty.buffer.ChannelBuffer;
21import org.onosproject.pcepio.exceptions.PcepParseException;
22import org.onosproject.pcepio.types.PcepObjectHeader;
23import org.onosproject.pcepio.types.PcepValueType;
24
25/**
26 * Abstraction of an entity providing PCEP Error Object.
27 */
28public interface PcepErrorObject {
29
30 /**
31 * Returns Error Type in Error Object.
32 *
33 * @return Error Type in Error Object
34 */
35 int getErrorType();
36
37 /**
38 * Sets Error Type in Error Object.
39 *
40 * @param value Error Type
41 */
42 void setErrorType(byte value);
43
44 /**
45 * Returns Error Value in Error Object.
46 *
47 * @return Error Value
48 */
49 byte getErrorValue();
50
51 /**
52 * Sets Error Value in Error Object.
53 *
54 * @param value Error Value
55 */
56 void setErrorValue(byte value);
57
58 /**
59 * Returns Optional Tlvs in Error Object.
60 *
61 * @return list of Optional Tlvs in Error Object
62 */
63 LinkedList<PcepValueType> getOptionalTlv();
64
65 /**
66 * Sets Optional Tlvs in Error Object.
67 *
68 * @param llOptionalTlv list of Optional Tlvs
69 */
70 void setOptionalTlv(LinkedList<PcepValueType> llOptionalTlv);
71
72 /**
Sho SHIMIZU74361c12015-08-11 12:31:48 -070073 * Writes the Error Object into channel buffer.
74 *
75 * @param bb channel buffer
76 * @return Returns the writerIndex of this buffer
77 * @throws PcepParseException while writing Error Object into ChannelBuffer
78 */
79 int write(ChannelBuffer bb) throws PcepParseException;
80
81 /**
82 * Builder interface with get and set functions to build Error object.
83 */
Sho SHIMIZU260f6ef2015-08-11 13:53:31 -070084 interface Builder {
Sho SHIMIZU74361c12015-08-11 12:31:48 -070085
86 /**
87 * Builds Error Object.
88 *
89 * @return Error Object.
90 */
91 PcepErrorObject build();
92
93 /**
94 * Returns Error Object header.
95 *
96 * @return Error Object header
97 */
98 PcepObjectHeader getErrorObjHeader();
99
100 /**
101 * Sets Error Object header and returns its Builder.
102 *
103 * @param obj Error Object header
104 * @return Builder by setting Error Object header
105 */
106 Builder setErrorObjHeader(PcepObjectHeader obj);
107
108 /**
109 * Returns Error Type in Error Object.
110 *
111 * @return Error Type in Error Object
112 */
113 int getErrorType();
114
115 /**
116 * Sets Error Type and returns its builder.
117 *
118 * @param value of Error-Type field
119 * @return builder by setting Error Type field.
120 */
121 Builder setErrorType(byte value);
122
123 /**
124 * Returns Error Value in Error Object.
125 *
126 * @return Error Value
127 */
128 byte getErrorValue();
129
130 /**
131 * Sets Error Value and returns its builder.
132 *
133 * @param value of Error-Value field
134 * @return Builder by setting Error Value field.
135 */
136 Builder setErrorValue(byte value);
137
138 /**
139 * Returns list of Optional Tlvs of Error Object.
140 *
141 * @return list of Optional Tlvs of Error Object
142 */
143 LinkedList<PcepValueType> getOptionalTlv();
144
145 /**
146 * Sets Optional Tlvs of Error Object and returns its Builder.
147 *
148 * @param llOptionalTlv Optional Tlvs of Error Object
149 * @return Builder by setting Optional Tlvs.
150 */
151 Builder setOptionalTlv(LinkedList<PcepValueType> llOptionalTlv);
152
153 /**
154 * Sets P flag in Error object header and returns its builder.
155 *
156 * @param value boolean value to set P flag
157 * @return Builder by setting P flag
158 */
159 Builder setPFlag(boolean value);
160
161 /**
162 * Sets I flag in Error object header and returns its builder.
163 *
164 * @param value boolean value to set I flag
165 * @return Builder by setting I flag
166 */
167 Builder setIFlag(boolean value);
168 }
169}