Sho SHIMIZU | 74361c1 | 2015-08-11 12:31:48 -0700 | [diff] [blame] | 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 | package org.onosproject.pcepio.protocol; |
| 17 | |
| 18 | import java.util.LinkedList; |
| 19 | |
| 20 | import org.jboss.netty.buffer.ChannelBuffer; |
| 21 | import org.onosproject.pcepio.exceptions.PcepParseException; |
| 22 | |
| 23 | /** |
| 24 | * Abstraction of an entity which provides PCEP Error Info. |
| 25 | * Reference :PCEP Extension for Transporting TE Data draft-dhodylee-pce-pcep-te-data-extn-02. |
| 26 | */ |
| 27 | public interface PcepErrorInfo { |
| 28 | |
| 29 | /** |
| 30 | * Returns whether error info list is present or not. |
| 31 | * |
| 32 | * @return true if error info present, false otherwise |
| 33 | */ |
Sho SHIMIZU | 260f6ef | 2015-08-11 13:53:31 -0700 | [diff] [blame] | 34 | boolean isErrorInfoPresent(); |
Sho SHIMIZU | 74361c1 | 2015-08-11 12:31:48 -0700 | [diff] [blame] | 35 | |
| 36 | /** |
| 37 | * Reads from channel buffer for TE and RP objects. |
| 38 | * |
| 39 | * @param bb of channel buffer |
| 40 | * @throws PcepParseException while parsing Error info part. |
| 41 | */ |
Sho SHIMIZU | 260f6ef | 2015-08-11 13:53:31 -0700 | [diff] [blame] | 42 | void read(ChannelBuffer bb) throws PcepParseException; |
Sho SHIMIZU | 74361c1 | 2015-08-11 12:31:48 -0700 | [diff] [blame] | 43 | |
| 44 | /** |
| 45 | * Writes byte stream of PCEP error info to channel buffer. |
| 46 | * |
| 47 | * @param bb of type channel buffer |
| 48 | * @throws PcepParseException while writing Error info part into Channel Buffer. |
| 49 | */ |
Sho SHIMIZU | 260f6ef | 2015-08-11 13:53:31 -0700 | [diff] [blame] | 50 | void write(ChannelBuffer bb) throws PcepParseException; |
Sho SHIMIZU | 74361c1 | 2015-08-11 12:31:48 -0700 | [diff] [blame] | 51 | |
| 52 | /** |
Sho SHIMIZU | 74361c1 | 2015-08-11 12:31:48 -0700 | [diff] [blame] | 53 | * Returns Error Value in PCEP-ERROR Object. |
| 54 | * |
| 55 | * @return list of Error Value in PCEP-ERROR Object |
| 56 | */ |
Sho SHIMIZU | 260f6ef | 2015-08-11 13:53:31 -0700 | [diff] [blame] | 57 | LinkedList<Integer> getErrorValue(); |
Sho SHIMIZU | 74361c1 | 2015-08-11 12:31:48 -0700 | [diff] [blame] | 58 | |
| 59 | /** |
| 60 | * Returns Error Type in PCEP-ERROR Object. |
| 61 | * |
| 62 | * @return list of Error Type in PCEP-ERROR Object |
| 63 | */ |
Sho SHIMIZU | 260f6ef | 2015-08-11 13:53:31 -0700 | [diff] [blame] | 64 | LinkedList<Integer> getErrorType(); |
Sho SHIMIZU | 74361c1 | 2015-08-11 12:31:48 -0700 | [diff] [blame] | 65 | |
| 66 | /** |
| 67 | * Builder interface with get and set functions to build ErrorInfo. |
| 68 | */ |
Sho SHIMIZU | 260f6ef | 2015-08-11 13:53:31 -0700 | [diff] [blame] | 69 | interface Builder { |
Sho SHIMIZU | 74361c1 | 2015-08-11 12:31:48 -0700 | [diff] [blame] | 70 | |
| 71 | /** |
| 72 | * Builds ErrorInfo Object. |
| 73 | * |
| 74 | * @return ErrorInfo Object. |
| 75 | */ |
| 76 | PcepErrorInfo build(); |
| 77 | |
| 78 | /** |
| 79 | * Returns list of PcepError. |
| 80 | * |
| 81 | * @return list of PcepError |
| 82 | */ |
| 83 | LinkedList<PcepError> getPcepErrorList(); |
| 84 | |
| 85 | /** |
| 86 | * Sets PcepError lists and returns its builder. |
| 87 | * |
| 88 | * @param llPcepErrorList list of PcepError |
| 89 | * @return builder by setting list of PcepError. |
| 90 | */ |
| 91 | Builder setPcepErrorList(LinkedList<PcepError> llPcepErrorList); |
| 92 | } |
| 93 | } |