blob: 0080d02cf2e668e7c46b1dfe71024d0f7cc40ab7 [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 SRP Object.
28 */
29public interface PcepSrpObject {
30
31 /**
32 * Returns SRP ID of SRP Object.
33 *
34 * @return SRP ID of SRP Object
35 */
36 int getSrpID();
37
38 /**
39 * Sets SRP ID with specified value.
40 *
41 * @param srpID SRP ID of SRP Object
42 */
43 void setSrpID(int srpID);
44
45 /**
46 * Returns R flag of SRP Object.
47 *
48 * @return R flag of SRP Object
49 */
50 boolean getRFlag();
51
52 /**
53 * Sets R flag with specified value.
54 *
55 * @param bRFlag R Flag of SRP Object
56 */
57 void setRFlag(boolean bRFlag);
58
59 /**
60 * sets the optional TLvs.
61 *
62 * @param llOptionalTlv list of optional tlvs
63 */
64 public void setOptionalTlv(LinkedList<PcepValueType> llOptionalTlv);
65
66 /**
67 * Returns list of optional tlvs.
68 *
69 * @return llOptionalTlv list of optional tlvs
70 */
71 public LinkedList<PcepValueType> getOptionalTlv();
72
73 /**
74 * Prints attributes of SRP object.
75 */
76 void print();
77
78 /**
79 * Writes the SRP Object into channel buffer.
80 *
81 * @param bb channel buffer
82 * @return Returns the writerIndex of this buffer
83 * @throws PcepParseException when tlv is null
84 */
85 int write(ChannelBuffer bb) throws PcepParseException;
86
87 /**
88 * Builder interface with get and set functions to build SRP object.
89 */
90 public interface Builder {
91
92 /**
93 * Builds SRP Object.
94 *
95 * @return SRP Object
96 * @throws PcepParseException when mandatory object is not set
97 */
98 PcepSrpObject build() throws PcepParseException;
99
100 /**
101 * Returns SRP object header.
102 *
103 * @return SRP object header
104 */
105 PcepObjectHeader getSrpObjHeader();
106
107 /**
108 * Sets SRP object header and returns its builder.
109 *
110 * @param obj SRP object header
111 * @return Builder by setting SRP object header
112 */
113 Builder setSrpObjHeader(PcepObjectHeader obj);
114
115 /**
116 * Returns SRP ID of SRP Object.
117 *
118 * @return SRP ID of SRP Object
119 */
120 int getSrpID();
121
122 /**
123 * Sets SRP ID and returns its builder.
124 *
125 * @param srpID SRP ID
126 * @return Builder by setting SRP ID
127 */
128 Builder setSrpID(int srpID);
129
130 /**
131 * Returns R flag of SRP Object.
132 *
133 * @return R flag of SRP Object
134 */
135 boolean getRFlag();
136
137 /**
138 * Sets R flag and returns its builder.
139 *
140 * @param bRFlag R flag
141 * @return Builder by setting R flag
142 */
143 Builder setRFlag(boolean bRFlag);
144
145 /**
146 * Returns list of optional tlvs.
147 *
148 * @return llOptionalTlv list of optional tlvs
149 */
150 public LinkedList<PcepValueType> getOptionalTlv();
151
152 /**
153 * sets the optional TLvs.
154 *
155 * @param llOptionalTlv List of optional tlv
156 * @return builder by setting list of optional tlv.
157 */
158 public Builder setOptionalTlv(LinkedList<PcepValueType> llOptionalTlv);
159
160 /**
161 * Sets P flag in SRP 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 Builder setPFlag(boolean value);
167
168 /**
169 * Sets I flag in SRP 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 Builder setIFlag(boolean value);
175
176 }
177}