Priyanka B | b2988fa | 2015-10-09 12:45:36 +0530 | [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 | |
| 17 | package org.onosproject.bgpio.util; |
| 18 | |
| 19 | import org.jboss.netty.buffer.ChannelBuffer; |
| 20 | import org.slf4j.Logger; |
| 21 | import org.slf4j.LoggerFactory; |
| 22 | |
| 23 | /** |
| 24 | * Provides methods to handle UnSupportedAttribute. |
| 25 | */ |
| 26 | public final class UnSupportedAttribute { |
| 27 | protected static final Logger log = LoggerFactory.getLogger(UnSupportedAttribute.class); |
| 28 | |
| 29 | private UnSupportedAttribute() { |
| 30 | } |
| 31 | |
| 32 | /** |
| 33 | * Reads channel buffer parses attribute header and skips specified length. |
| 34 | * |
| 35 | * @param cb channelBuffer |
| 36 | */ |
| 37 | public static void read(ChannelBuffer cb) { |
| 38 | Validation parseFlags = Validation.parseAttributeHeader(cb); |
| 39 | cb.skipBytes(parseFlags.getLength()); |
| 40 | } |
| 41 | |
| 42 | /** |
| 43 | * Skip specified bytes in channel buffer. |
| 44 | * |
| 45 | * @param cb channelBuffer |
| 46 | * @param length to be skipped |
| 47 | */ |
| 48 | public static void skipBytes(ChannelBuffer cb, short length) { |
| 49 | cb.skipBytes(length); |
| 50 | } |
| 51 | } |