Skip to content

Commit 3383ed4

Browse files
committed
EthernetProtocolHeader for LinuxSLL and Ethernet
1 parent 2f63be3 commit 3383ed4

3 files changed

Lines changed: 33 additions & 2 deletions

File tree

src/main/java/net/elytrium/pcap/layer/Ethernet.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import net.elytrium.pcap.layer.exception.LayerDecodeException;
2525
import net.elytrium.pcap.layer.exception.LayerEncodeException;
2626

27-
public class Ethernet implements Layer {
27+
public class Ethernet implements EthernetProtocolHeader {
2828

2929
private static final int SIZE = 14;
3030

@@ -83,10 +83,12 @@ public void setSrcAddress(byte[] srcAddress) {
8383
this.srcAddress = srcAddress;
8484
}
8585

86+
@Override
8687
public EthernetProtocol getProtocol() {
8788
return this.protocol;
8889
}
8990

91+
@Override
9092
public void setProtocol(EthernetProtocol protocol) {
9193
this.protocol = protocol;
9294
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
* Copyright (C) 2022 Elytrium
3+
*
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU Affero General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU Affero General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU Affero General Public License
15+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16+
*/
17+
18+
package net.elytrium.pcap.layer;
19+
20+
import net.elytrium.pcap.layer.data.EthernetProtocol;
21+
22+
public interface EthernetProtocolHeader extends Layer {
23+
24+
EthernetProtocol getProtocol();
25+
26+
void setProtocol(EthernetProtocol protocol);
27+
}

src/main/java/net/elytrium/pcap/layer/LinuxSLL.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import net.elytrium.pcap.layer.exception.LayerDecodeException;
2525
import net.elytrium.pcap.layer.exception.LayerEncodeException;
2626

27-
public class LinuxSLL implements Layer {
27+
public class LinuxSLL implements EthernetProtocolHeader {
2828

2929
private static final int SIZE = 16;
3030

@@ -114,10 +114,12 @@ public void setAddress(byte[] address) {
114114
this.address = address;
115115
}
116116

117+
@Override
117118
public EthernetProtocol getProtocol() {
118119
return this.protocol;
119120
}
120121

122+
@Override
121123
public void setProtocol(EthernetProtocol protocol) {
122124
this.protocol = protocol;
123125
}

0 commit comments

Comments
 (0)