blob: 287a8926c7276f855da7a88a54322cc536c233fe [file] [log] [blame]
Thomas Vachuska24c849c2014-10-27 09:53:05 -07001/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
alshabibc4901cd2014-09-05 16:50:40 -07009 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
Thomas Vachuska24c849c2014-10-27 09:53:05 -070012 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
alshabibc4901cd2014-09-05 16:50:40 -070017 * under the License.
Thomas Vachuska24c849c2014-10-27 09:53:05 -070018 */
19
20
alshabibc4901cd2014-09-05 16:50:40 -070021
22package org.onlab.packet;
23
24import java.nio.ByteBuffer;
25
26/**
27 * This class represents an Link Local Control header that is used in Ethernet
28 * 802.3.
29 *
alshabibc4901cd2014-09-05 16:50:40 -070030 *
31 */
32public class LLC extends BasePacket {
33 private byte dsap = 0;
34 private byte ssap = 0;
35 private byte ctrl = 0;
36
37 public byte getDsap() {
38 return this.dsap;
39 }
40
41 public void setDsap(final byte dsap) {
42 this.dsap = dsap;
43 }
44
45 public byte getSsap() {
46 return this.ssap;
47 }
48
49 public void setSsap(final byte ssap) {
50 this.ssap = ssap;
51 }
52
53 public byte getCtrl() {
54 return this.ctrl;
55 }
56
57 public void setCtrl(final byte ctrl) {
58 this.ctrl = ctrl;
59 }
60
61 @Override
62 public byte[] serialize() {
63 final byte[] data = new byte[3];
64 final ByteBuffer bb = ByteBuffer.wrap(data);
65 bb.put(this.dsap);
66 bb.put(this.ssap);
67 bb.put(this.ctrl);
68 return data;
69 }
70
71 @Override
72 public IPacket deserialize(final byte[] data, final int offset,
73 final int length) {
74 final ByteBuffer bb = ByteBuffer.wrap(data, offset, length);
75 this.dsap = bb.get();
76 this.ssap = bb.get();
77 this.ctrl = bb.get();
78 return this;
79 }
80}