Taras Lemkin | 4178591 | 2018-03-26 14:52:58 +0000 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 2017-present Open Networking Foundation |
| 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.dhcprelay; |
| 18 | |
| 19 | import org.onlab.packet.Ethernet; |
| 20 | import org.onosproject.net.ConnectPoint; |
| 21 | |
| 22 | /** |
| 23 | * Container for Ethernet packet and destination port. |
| 24 | */ |
| 25 | final class InternalPacket { |
| 26 | private Ethernet packet; |
| 27 | private ConnectPoint destLocation; |
| 28 | |
| 29 | private InternalPacket(Ethernet newPacket, ConnectPoint newLocation) { |
| 30 | packet = newPacket; |
| 31 | destLocation = newLocation; |
| 32 | } |
| 33 | |
| 34 | public Ethernet getPacket() { |
| 35 | return packet; |
| 36 | } |
| 37 | |
| 38 | public ConnectPoint getDestLocation() { |
| 39 | return destLocation; |
| 40 | } |
| 41 | |
| 42 | /** |
| 43 | * Build {@link InternalPacket} object instance. |
| 44 | * |
| 45 | * @param newPacket {@link Ethernet} packet to be sent |
| 46 | * @param newLocation {@link ConnectPoint} packet destination |
| 47 | * @return new instance of {@link InternalPacket} class |
| 48 | */ |
| 49 | public static InternalPacket internalPacket(Ethernet newPacket, ConnectPoint newLocation) { |
| 50 | return new InternalPacket(newPacket, newLocation); |
| 51 | } |
| 52 | } |