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