Shashikanth VH | 5dd8dbe | 2015-11-26 13:22:18 +0530 | [diff] [blame] | 1 | /* |
Brian O'Connor | 5ab426f | 2016-04-09 01:19:45 -0700 | [diff] [blame^] | 2 | * Copyright 2015-present Open Networking Laboratory |
Shashikanth VH | 5dd8dbe | 2015-11-26 13:22:18 +0530 | [diff] [blame] | 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.protocol.ver4; |
| 18 | |
| 19 | import org.onosproject.bgpio.protocol.BgpFactory; |
| 20 | import org.onosproject.bgpio.protocol.BgpKeepaliveMsg; |
| 21 | import org.onosproject.bgpio.protocol.BgpMessage; |
| 22 | import org.onosproject.bgpio.protocol.BgpMessageReader; |
| 23 | import org.onosproject.bgpio.protocol.BgpNotificationMsg; |
| 24 | import org.onosproject.bgpio.protocol.BgpOpenMsg; |
Shashikanth VH | 44967ec | 2016-02-04 19:46:16 +0530 | [diff] [blame] | 25 | import org.onosproject.bgpio.protocol.BgpUpdateMsg; |
Shashikanth VH | 5dd8dbe | 2015-11-26 13:22:18 +0530 | [diff] [blame] | 26 | import org.onosproject.bgpio.protocol.BgpVersion; |
| 27 | |
| 28 | /** |
| 29 | * Provides BGP Factory and returns builder classes for all objects and messages. |
| 30 | */ |
| 31 | public class BgpFactoryVer4 implements BgpFactory { |
| 32 | |
| 33 | public static final BgpFactoryVer4 INSTANCE = new BgpFactoryVer4(); |
| 34 | |
| 35 | @Override |
| 36 | public BgpOpenMsg.Builder openMessageBuilder() { |
| 37 | return new BgpOpenMsgVer4.Builder(); |
| 38 | } |
| 39 | |
| 40 | @Override |
| 41 | public BgpKeepaliveMsg.Builder keepaliveMessageBuilder() { |
| 42 | return new BgpKeepaliveMsgVer4.Builder(); |
| 43 | } |
| 44 | |
| 45 | @Override |
| 46 | public BgpNotificationMsg.Builder notificationMessageBuilder() { |
| 47 | return new BgpNotificationMsgVer4.Builder(); |
| 48 | } |
| 49 | |
| 50 | @Override |
Shashikanth VH | 44967ec | 2016-02-04 19:46:16 +0530 | [diff] [blame] | 51 | public BgpUpdateMsg.Builder updateMessageBuilder() { |
| 52 | return new BgpUpdateMsgVer4.Builder(); |
| 53 | } |
| 54 | |
| 55 | @Override |
Shashikanth VH | 5dd8dbe | 2015-11-26 13:22:18 +0530 | [diff] [blame] | 56 | public BgpMessageReader<BgpMessage> getReader() { |
| 57 | return BgpMessageVer4.READER; |
| 58 | } |
| 59 | |
| 60 | @Override |
| 61 | public BgpVersion getVersion() { |
| 62 | return BgpVersion.BGP_4; |
| 63 | } |
| 64 | } |