92d438745318f046da57c5b67d02ee8dfc44041d
[onosfw.git] /
1 /*
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
17 package org.onosproject.pcepio.protocol;
18
19 import org.jboss.netty.buffer.ChannelBuffer;
20 import org.onosproject.pcepio.exceptions.PcepParseException;
21 import org.onosproject.pcepio.types.PcepObjectHeader;
22
23 /**
24  * Abstraction of an entity providing PCEP End Points Object.
25  */
26 public interface PcepEndPointsObject {
27
28     /**
29      * Returns Source IpAddress from End Points Object.
30      *
31      * @return Source IpAddress from End Points Object
32      */
33     int getSourceIpAddress();
34
35     /**
36      * Sets Source IpAddress in End Points Object.
37      *
38      * @param sourceIpAddress Source IP Address
39      */
40     void setSourceIpAddress(int sourceIpAddress);
41
42     /**
43      * Returns Destination IpAddress from End Points Object.
44      *
45      * @return Destination IpAddress from End Points Object
46      */
47     int getDestIpAddress();
48
49     /**
50      * Sets Destination IpAddress in End Points Object.
51      *
52      * @param destIpAddress Destination IP Address
53      */
54     void setDestIpAddress(int destIpAddress);
55
56     /**
57      * Writes the EndPointsObject into channel buffer.
58      *
59      * @param bb channel buffer
60      * @return Returns the writerIndex of this buffer
61      * @throws PcepParseException while writing EndPointObject into ChannelBuffer
62      */
63     int write(ChannelBuffer bb) throws PcepParseException;
64
65     /**
66      * Builder interface with get and set functions to build EndPoints object.
67      */
68     interface Builder {
69
70         /**
71          * Builds End Points Object.
72          *
73          * @return End Points Object
74          * @throws PcepParseException while building EndPointObject
75          */
76         PcepEndPointsObject build() throws PcepParseException;
77
78         /**
79          * Returns End Points Object header.
80          *
81          * @return End Points Object header
82          */
83         PcepObjectHeader getEndPointsObjHeader();
84
85         /**
86          * Sets End Points Object header and returns its builder.
87          *
88          * @param obj End Points Object header
89          * @return Builder by setting End Points Object header
90          */
91         Builder setEndPointsObjHeader(PcepObjectHeader obj);
92
93         /**
94          * Returns Source IpAddress from End Points Object.
95          *
96          * @return Source IpAddress from End Points Object
97          */
98         int getSourceIpAddress();
99
100         /**
101          * Sets Source IpAddress in End Points Object and returns builder.
102          *
103          * @param sourceIpAddress Source IP Address
104          * @return Builder by setting Source IpAddress in End Points Object
105          */
106         Builder setSourceIpAddress(int sourceIpAddress);
107
108         /**
109          * Returns Destination IpAddress from End Points Object.
110          *
111          * @return Destination IpAddress from End Points Object
112          */
113         int getDestIpAddress();
114
115         /**
116          * Sets Destination IpAddress in End Points Object.
117          *
118          * @param destIpAddress Destination IP Address
119          * @return Builder by setting Destination IpAddress in End Points Object
120          */
121         Builder setDestIpAddress(int destIpAddress);
122
123         /**
124          * Sets P flag in Bandwidth object header and returns its builder.
125          *
126          * @param value boolean value to set P flag
127          * @return Builder by setting P flag
128          */
129         Builder setPFlag(boolean value);
130
131         /**
132          * Sets I flag in Bandwidth object header and returns its builder.
133          *
134          * @param value boolean value to set I flag
135          * @return Builder by setting I flag
136          */
137         Builder setIFlag(boolean value);
138     }
139 }