blob: 035f396d377a40660990a039e8229968098921b8 [file] [log] [blame]
Thomas Vachuska24c849c2014-10-27 09:53:05 -07001/*
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07002 * Copyright 2014 Open Networking Laboratory
alshabibc4901cd2014-09-05 16:50:40 -07003 *
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07004 * 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
alshabibc4901cd2014-09-05 16:50:40 -07007 *
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07008 * 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.
Thomas Vachuska24c849c2014-10-27 09:53:05 -070015 */
16
17
alshabibc4901cd2014-09-05 16:50:40 -070018
19package org.onlab.packet;
20
21import java.nio.ByteBuffer;
22
23/**
24 * This class represents an Link Local Control header that is used in Ethernet
25 * 802.3.
26 *
alshabibc4901cd2014-09-05 16:50:40 -070027 *
28 */
29public class LLC extends BasePacket {
30 private byte dsap = 0;
31 private byte ssap = 0;
32 private byte ctrl = 0;
33
34 public byte getDsap() {
35 return this.dsap;
36 }
37
38 public void setDsap(final byte dsap) {
39 this.dsap = dsap;
40 }
41
42 public byte getSsap() {
43 return this.ssap;
44 }
45
46 public void setSsap(final byte ssap) {
47 this.ssap = ssap;
48 }
49
50 public byte getCtrl() {
51 return this.ctrl;
52 }
53
54 public void setCtrl(final byte ctrl) {
55 this.ctrl = ctrl;
56 }
57
58 @Override
59 public byte[] serialize() {
60 final byte[] data = new byte[3];
61 final ByteBuffer bb = ByteBuffer.wrap(data);
62 bb.put(this.dsap);
63 bb.put(this.ssap);
64 bb.put(this.ctrl);
65 return data;
66 }
67
68 @Override
69 public IPacket deserialize(final byte[] data, final int offset,
70 final int length) {
71 final ByteBuffer bb = ByteBuffer.wrap(data, offset, length);
72 this.dsap = bb.get();
73 this.ssap = bb.get();
74 this.ctrl = bb.get();
75 return this;
76 }
77}