Rusty Eddy | ddef893 | 2015-09-25 01:15:53 +0000 | [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 | package org.onosproject.mfwd.impl; |
| 17 | |
| 18 | import org.onosproject.net.ConnectPoint; |
| 19 | import java.util.EnumSet; |
| 20 | import java.util.Set; |
| 21 | |
| 22 | /** |
| 23 | * Mulitcast ConnectPoint adds a variable to track the usage |
| 24 | * of these multicast endpoints. |
| 25 | */ |
| 26 | public class McastConnectPoint { |
| 27 | |
| 28 | private ConnectPoint connectPoint; |
| 29 | |
| 30 | public enum JoinSource { |
| 31 | STATIC, IGMP, PIM; |
| 32 | } |
| 33 | |
| 34 | public EnumSet<JoinSource> interest = EnumSet.noneOf(JoinSource.class); |
| 35 | |
| 36 | public McastConnectPoint(ConnectPoint cp) { |
| 37 | this.connectPoint = cp; |
| 38 | } |
| 39 | |
| 40 | public McastConnectPoint(ConnectPoint cp, JoinSource src) { |
| 41 | this.connectPoint = cp; |
| 42 | interest.add(src); |
| 43 | } |
| 44 | |
| 45 | public McastConnectPoint(String connectPoint, JoinSource src) { |
| 46 | ConnectPoint cp = ConnectPoint.deviceConnectPoint(connectPoint); |
| 47 | this.connectPoint = cp; |
| 48 | this.interest.add(src); |
| 49 | } |
| 50 | |
| 51 | /** |
| 52 | * Get the connect point. |
| 53 | * |
| 54 | * @return connectPoint |
| 55 | */ |
| 56 | public ConnectPoint getConnectPoint() { |
| 57 | return connectPoint; |
| 58 | } |
| 59 | |
| 60 | /** |
| 61 | * Get the sources of interest for this egressPoint. |
| 62 | * |
| 63 | * @return interest flags |
| 64 | */ |
| 65 | public Set<JoinSource> getInterest() { |
| 66 | return interest; |
| 67 | } |
| 68 | } |