blob: 15f6f2626fef13c31475d269b574be088294e5c4 [file] [log] [blame]
Gustavo Silva2bcc8052021-01-22 13:48:30 -03001/*
2 * Copyright 2021-present Open Networking Foundation
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.onlab.packet;
18
19import java.util.Arrays;
20
21public class PPPoEDTag {
22 protected short type;
23 protected short length;
24 protected byte[] value;
25
26 // PPPoED tag types
27 public static final short PPPOED_TAG_END_OF_LIST = 0x0000;
28 public static final short PPPOED_TAG_SERVICE_NAME = 0x0101;
29 public static final short PPPOED_TAG_AC_NAME = 0x0102;
30 public static final short PPPOED_TAG_HOST_UNIQ = 0x0103;
31 public static final short PPPOED_TAG_AC_COOKIE = 0x0104;
32 public static final short PPPOED_TAG_VENDOR_SPECIFIC = 0x0105;
33 public static final short PPPOED_TAG_RELAY_SESSION_ID = 0x0110;
34 public static final short PPPOED_TAG_SERVICE_NAME_ERROR = 0x0201;
35 public static final short PPPOED_TAG_AC_SYSTEM_ERROR = 0x0202;
36 public static final short PPPOED_TAG_GENERIC_ERROR = 0x0203;
37
38 /**
39 * Default constructor.
40 */
41 public PPPoEDTag() {
42 }
43
44 /**
45 * Constructs a PPPoED tag with type, length and value.
46 *
47 * @param type type
48 * @param length length
49 * @param value value
50 */
51 public PPPoEDTag(final short type, final short length, final byte[] value) {
52 this.type = type;
53 this.length = length;
54 this.value = value;
55 }
56
57 public short getType() {
58 return type;
59 }
60
61 public void setType(short type) {
62 this.type = type;
63 }
64
65 public short getLength() {
66 return length;
67 }
68
69 public void setLength(short length) {
70 this.length = length;
71 }
72
73 public byte[] getValue() {
74 return value;
75 }
76
77 public void setValue(byte[] value) {
78 this.value = value;
79 }
80
81 @Override
82 public String toString() {
83 return "PPPoEDTag{" +
84 "type=" + type +
85 ", length=" + length +
86 ", value=" + Arrays.toString(value) +
87 '}';
88 }
89}