blob: 7c3fb2dc07c0eab7cfb4938a5957c7591e9bf7cb [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 ERO Object.
28 */
29public interface PcepEroObject {
30
31 /**
32 * Return LinkedList of SubObjects of ERO Object.
33 *
34 * @return list of subobjects
35 */
36 LinkedList<PcepValueType> getSubObjects();
37
38 /**
39 * Sets LinkedList of SubObjects in ERO Object.
40 *
41 * @param llSubObjects list of subobjects
42 */
43 void setSubObjects(LinkedList<PcepValueType> llSubObjects);
44
45 /**
46 * Writes the ERO Object into channel buffer.
47 *
48 * @param bb channel buffer
49 * @return Returns the writerIndex of this buffer
50 * @throws PcepParseException while writing ERO Object into ChannelBuffer
51 */
52 public int write(ChannelBuffer bb) throws PcepParseException;
53
54 /**
55 * Prints attributes of ERO object.
56 */
57 void print();
58
59 /**
60 * Builder interface with get and set functions to build ERO object.
61 */
62 public interface Builder {
63
64 /**
65 * Builds ERO Object.
66 *
67 * @return ERO Object
68 */
69 PcepEroObject build();
70
71 /**
72 * Returns ERO Object Header.
73 *
74 * @return ERO Object Header
75 */
76 PcepObjectHeader getEroObjHeader();
77
78 /**
79 * Sets ERO Object header and returns its builder.
80 *
81 * @param obj ERO Object header
82 * @return Builder by setting ERO Object header
83 */
84 Builder setEroObjHeader(PcepObjectHeader obj);
85
86 /**
87 * Returns LinkedList of SubObjects in ERO Objects.
88 *
89 * @return list of subobjects
90 */
91 LinkedList<PcepValueType> getSubObjects();
92
93 /**
94 * Sets LinkedList of SubObjects and returns its builder.
95 *
96 * @param llSubObjects list of SubObjects
97 * @return Builder by setting list of SubObjects
98 */
99 Builder setSubObjects(LinkedList<PcepValueType> llSubObjects);
100
101 /**
102 * Sets P flag in ERO object header and returns its builder.
103 *
104 * @param value boolean value to set P flag
105 * @return Builder by setting P flag
106 */
107 Builder setPFlag(boolean value);
108
109 /**
110 * Sets I flag in ERO object header and returns its builder.
111 *
112 * @param value boolean value to set I flag
113 * @return Builder by setting I flag
114 */
115 Builder setIFlag(boolean value);
116 }
117}