Jian Li | 3573439 | 2016-07-14 11:55:24 +0900 | [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 | */ |
Jian Li | 6b77dc0 | 2016-07-14 16:04:25 +0900 | [diff] [blame] | 16 | package org.onosproject.lisp.msg.types; |
Jian Li | 3573439 | 2016-07-14 11:55:24 +0900 | [diff] [blame] | 17 | |
Jian Li | 115d860 | 2016-08-15 20:21:53 +0900 | [diff] [blame] | 18 | import io.netty.buffer.ByteBuf; |
| 19 | import org.onosproject.lisp.msg.exceptions.LispParseError; |
GUNi | ba87170 | 2016-08-22 21:06:02 +0900 | [diff] [blame] | 20 | import org.onosproject.lisp.msg.exceptions.LispWriterException; |
Jian Li | 115d860 | 2016-08-15 20:21:53 +0900 | [diff] [blame] | 21 | |
Jian Li | 3573439 | 2016-07-14 11:55:24 +0900 | [diff] [blame] | 22 | /** |
Jian Li | 6b77dc0 | 2016-07-14 16:04:25 +0900 | [diff] [blame] | 23 | * No address. |
Jian Li | 3573439 | 2016-07-14 11:55:24 +0900 | [diff] [blame] | 24 | */ |
Jian Li | 6b77dc0 | 2016-07-14 16:04:25 +0900 | [diff] [blame] | 25 | public class LispNoAddress extends LispAfiAddress { |
Jian Li | 3573439 | 2016-07-14 11:55:24 +0900 | [diff] [blame] | 26 | |
Jian Li | 6b77dc0 | 2016-07-14 16:04:25 +0900 | [diff] [blame] | 27 | /** |
| 28 | * Initializes no address. |
| 29 | */ |
| 30 | public LispNoAddress() { |
| 31 | super(AddressFamilyIdentifierEnum.NO_ADDRESS); |
| 32 | } |
Jian Li | 115d860 | 2016-08-15 20:21:53 +0900 | [diff] [blame] | 33 | |
| 34 | /** |
| 35 | * LISP no address reader class. |
| 36 | */ |
| 37 | public static class NoAddressReader implements LispAddressReader<LispNoAddress> { |
| 38 | |
| 39 | @Override |
| 40 | public LispNoAddress readFrom(ByteBuf byteBuf) throws LispParseError { |
| 41 | return new LispNoAddress(); |
| 42 | } |
| 43 | } |
GUNi | ba87170 | 2016-08-22 21:06:02 +0900 | [diff] [blame] | 44 | |
| 45 | /** |
| 46 | * LISP no address writer class. |
| 47 | */ |
| 48 | public static class NoAddressWriter implements LispAddressWriter<LispNoAddress> { |
| 49 | |
| 50 | @Override |
Jian Li | 3a99e71 | 2016-12-16 21:23:16 +0900 | [diff] [blame] | 51 | public void writeTo(ByteBuf byteBuf, LispNoAddress address) |
| 52 | throws LispWriterException { |
Jian Li | 6ef1b3f | 2016-11-12 18:16:06 +0900 | [diff] [blame] | 53 | // since there is nothing to write to channel, we just leave it empty |
GUNi | ba87170 | 2016-08-22 21:06:02 +0900 | [diff] [blame] | 54 | } |
| 55 | } |
Jian Li | 3573439 | 2016-07-14 11:55:24 +0900 | [diff] [blame] | 56 | } |