-
-
Notifications
You must be signed in to change notification settings - Fork 309
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'faltimiras-transportPacket'
- Loading branch information
Showing
15 changed files
with
148 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
pcap4j-core/src/main/java/org/pcap4j/packet/TransportPacket.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/*_########################################################################## | ||
_## | ||
_## Copyright (C) 2019 Pcap4J.org | ||
_## | ||
_########################################################################## | ||
*/ | ||
|
||
package org.pcap4j.packet; | ||
|
||
import org.pcap4j.packet.namednumber.Port; | ||
|
||
/** | ||
* Transport layer packet (e.g. TCP and UDP) | ||
* | ||
* @author Ferran Altimiras | ||
* @since pcap4j 1.7.5 | ||
*/ | ||
public interface TransportPacket extends Packet { | ||
|
||
@Override | ||
public TransportHeader getHeader(); | ||
|
||
/** | ||
* The interface representing the Transport layer packet's header. | ||
* | ||
* @author Ferran Altimiras | ||
* @since pcap4j 1.7.5 | ||
*/ | ||
public interface TransportHeader extends Header { | ||
|
||
/** @return Source port */ | ||
public Port getSrcPort(); | ||
|
||
/** @return Destination port */ | ||
public Port getDstPort(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
pcap4j-core/src/main/java/org/pcap4j/packet/namednumber/Port.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/*_########################################################################## | ||
_## | ||
_## Copyright (C) 2019 Pcap4J.org | ||
_## | ||
_########################################################################## | ||
*/ | ||
|
||
package org.pcap4j.packet.namednumber; | ||
|
||
/** | ||
* Transport layer Port | ||
* | ||
* @author Ferran Altimiras | ||
* @since pcap4j 1.7.5 | ||
*/ | ||
public abstract class Port extends NamedNumber<Short, Port> { | ||
|
||
/** | ||
* @param value value | ||
* @param name name | ||
*/ | ||
public Port(Short value, String name) { | ||
super(value, name); | ||
} | ||
|
||
/** @return the value of this object as an int. */ | ||
public int valueAsInt() { | ||
return 0xFFFF & value(); | ||
} | ||
|
||
@Override | ||
public String valueAsString() { | ||
return String.valueOf(valueAsInt()); | ||
} | ||
|
||
@Override | ||
public int compareTo(Port o) { | ||
return value().compareTo(o.value()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.