sunishvk | a1dfc3e | 2016-04-16 12:24:47 +0530 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2016-present 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.isis.io.isispacket.tlv; |
| 17 | |
| 18 | import com.google.common.base.MoreObjects; |
| 19 | import org.jboss.netty.buffer.ChannelBuffer; |
| 20 | |
| 21 | /** |
| 22 | * Representation of IDRP information TLV. |
| 23 | */ |
| 24 | public class IdrpInformationTlv extends TlvHeader implements IsisTlv { |
| 25 | |
| 26 | private byte irdpInformationType; |
| 27 | private int externalInformation; |
| 28 | |
| 29 | /** |
| 30 | * Creates an instance of IDRP information TLV. |
| 31 | * |
Dhruv Dhody | e64b93e | 2016-04-20 19:26:55 +0530 | [diff] [blame^] | 32 | * @param tlvHeader TLV header |
sunishvk | a1dfc3e | 2016-04-16 12:24:47 +0530 | [diff] [blame] | 33 | */ |
| 34 | public IdrpInformationTlv(TlvHeader tlvHeader) { |
| 35 | this.setTlvType(tlvHeader.tlvType()); |
| 36 | this.setTlvLength(tlvHeader.tlvLength()); |
| 37 | } |
| 38 | |
| 39 | /** |
| 40 | * Returns the external information of IDRP information TLV. |
| 41 | * |
| 42 | * @return external information |
| 43 | */ |
| 44 | public int externalInformation() { |
| 45 | return externalInformation; |
| 46 | } |
| 47 | |
| 48 | /** |
| 49 | * Sets the external information for IDRP information TLV. |
| 50 | * |
| 51 | * @param externalInformation external information |
| 52 | */ |
| 53 | public void setExternalInformation(int externalInformation) { |
| 54 | this.externalInformation = externalInformation; |
| 55 | } |
| 56 | |
| 57 | /** |
| 58 | * Returns the IDRP information of IDRP information TLV. |
| 59 | * |
| 60 | * @return IDRP information type |
| 61 | */ |
| 62 | public byte irdpInformationType() { |
| 63 | return irdpInformationType; |
| 64 | } |
| 65 | |
| 66 | /** |
| 67 | * Sets the IDRP information for IDRP information TLV. |
| 68 | * |
| 69 | * @param irdpInformationType IDRP information type |
| 70 | */ |
| 71 | public void setIrdpInformationType(byte irdpInformationType) { |
| 72 | this.irdpInformationType = irdpInformationType; |
| 73 | } |
| 74 | |
| 75 | @Override |
| 76 | public void readFrom(ChannelBuffer channelBuffer) { |
| 77 | //TODO |
| 78 | } |
| 79 | |
| 80 | |
| 81 | @Override |
| 82 | public byte[] asBytes() { |
| 83 | //TODO |
| 84 | return null; |
| 85 | } |
| 86 | |
| 87 | @Override |
| 88 | public String toString() { |
| 89 | return MoreObjects.toStringHelper(getClass()) |
| 90 | .omitNullValues() |
| 91 | .add("externalInformation", externalInformation) |
| 92 | .add("irdpInformationType", irdpInformationType) |
| 93 | .toString(); |
| 94 | } |
| 95 | } |