blob: 85a089792f2912c24942a258700346a1247765a9 [file] [log] [blame]
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -08001/**
Ray Milkey269ffb92014-04-03 14:43:30 -07002 * Copyright 2011, Big Switch Networks, Inc.
3 * Originally created by David Erickson, Stanford University
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License"); you may
6 * not use this file except in compliance with the License. You may obtain
7 * a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 * License for the specific language governing permissions and limitations
15 * under the License.
16 **/
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080017
Jonathan Hartdeda0ba2014-04-03 11:14:12 -070018package net.onrc.onos.core.packet;
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080019
20import java.nio.ByteBuffer;
21
22/**
23 * This class represents an Link Local Control
24 * header that is used in Ethernet 802.3.
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080025 *
Yuta HIGUCHIaa132f52014-06-26 10:18:39 -070026 * <!-- CHECKSTYLE IGNORE WriteTag FOR NEXT 1 LINES -->
Ray Milkey269ffb92014-04-03 14:43:30 -070027 * @author alexreimers
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080028 */
29public class LLC extends BasePacket {
30 private byte dsap = 0;
31 private byte ssap = 0;
32 private byte ctrl = 0;
Ray Milkey269ffb92014-04-03 14:43:30 -070033
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080034 public byte getDsap() {
35 return dsap;
36 }
37
38 public void setDsap(byte dsap) {
39 this.dsap = dsap;
40 }
41
42 public byte getSsap() {
43 return ssap;
44 }
45
46 public void setSsap(byte ssap) {
47 this.ssap = ssap;
48 }
49
50 public byte getCtrl() {
51 return ctrl;
52 }
53
54 public void setCtrl(byte ctrl) {
55 this.ctrl = ctrl;
56 }
57
58 @Override
59 public byte[] serialize() {
60 byte[] data = new byte[3];
61 ByteBuffer bb = ByteBuffer.wrap(data);
62 bb.put(dsap);
63 bb.put(ssap);
64 bb.put(ctrl);
65 return data;
66 }
67
68 @Override
69 public IPacket deserialize(byte[] data, int offset, int length) {
70 ByteBuffer bb = ByteBuffer.wrap(data, offset, length);
71 dsap = bb.get();
72 ssap = bb.get();
73 ctrl = bb.get();
74 return this;
75 }
76}