blob: d02670925f71688a94c86e4ac0091c0422125c9a [file] [log] [blame]
Priyanka B0bee1f82015-10-13 15:39:49 +05301/*
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
17package org.onosproject.bgpio.types;
18
19import org.jboss.netty.buffer.ChannelBuffer;
20
21/**
22 * Implementation of RouteDistinguisher.
23 */
24public class RouteDistinguisher {
25
26 private long routeDistinguisher;
27
28 /**
29 * Resets fields.
30 */
31 public RouteDistinguisher() {
32 this.routeDistinguisher = 0;
33 }
34
35 /**
36 * Constructor to initialize parameters.
37 *
38 * @param routeDistinguisher route distinguisher
39 */
40 public RouteDistinguisher(long routeDistinguisher) {
41 this.routeDistinguisher = routeDistinguisher;
42 }
43
44 /**
45 * Reads route distinguisher from channelBuffer.
46 *
47 * @param cb channelBuffer
48 * @return object of RouteDistinguisher
49 */
50 public static RouteDistinguisher read(ChannelBuffer cb) {
51 return new RouteDistinguisher(cb.readLong());
52 }
53
54 /**
55 * Returns route distinguisher.
56 *
57 * @return route distinguisher
58 */
59 public long getRouteDistinguisher() {
60 return this.routeDistinguisher;
61 }
62}