blob: c4f0c276fe5fc416460cb9efb9f59fb24de5f8b7 [file] [log] [blame]
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -08001/**
2* 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**/
17
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.
25 * @author alexreimers
26 *
27 */
28public class LLC extends BasePacket {
29 private byte dsap = 0;
30 private byte ssap = 0;
31 private byte ctrl = 0;
32
33 public byte getDsap() {
34 return dsap;
35 }
36
37 public void setDsap(byte dsap) {
38 this.dsap = dsap;
39 }
40
41 public byte getSsap() {
42 return ssap;
43 }
44
45 public void setSsap(byte ssap) {
46 this.ssap = ssap;
47 }
48
49 public byte getCtrl() {
50 return ctrl;
51 }
52
53 public void setCtrl(byte ctrl) {
54 this.ctrl = ctrl;
55 }
56
57 @Override
58 public byte[] serialize() {
59 byte[] data = new byte[3];
60 ByteBuffer bb = ByteBuffer.wrap(data);
61 bb.put(dsap);
62 bb.put(ssap);
63 bb.put(ctrl);
64 return data;
65 }
66
67 @Override
68 public IPacket deserialize(byte[] data, int offset, int length) {
69 ByteBuffer bb = ByteBuffer.wrap(data, offset, length);
70 dsap = bb.get();
71 ssap = bb.get();
72 ctrl = bb.get();
73 return this;
74 }
75}