Skip to content

Commit e8b247a

Browse files
committed
Release 1.2.1
1 parent 9853d50 commit e8b247a

File tree

14 files changed

+131
-24
lines changed

14 files changed

+131
-24
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
The `jipcs` contains the following codecs:
44
* IPv4 header [(Internet Protocol version 4)](https://en.wikipedia.org/wiki/Internet_Protocol_version_4) [(RFC 791)](https://datatracker.ietf.org/doc/html/rfc791#page-11)
5+
* [IP Options](https://www.iana.org/assignments/ip-parameters/ip-parameters.xhtml#ip-parameters-1)
56
* IPv6 header [(Internet Protocol version 6)](https://en.wikipedia.org/wiki/Internet_Protocol_version_6) [(RFC 8200)](https://datatracker.ietf.org/doc/html/rfc8200#page-6)
7+
* [Extension headers](https://www.iana.org/assignments/ipv6-parameters/ipv6-parameters.xhtml#extension-header) and [options](https://www.iana.org/assignments/ipv6-parameters/ipv6-parameters.xhtml#ipv6-parameters-2)
68
* TCP header [(Transmission Control Protocol)](https://en.wikipedia.org/wiki/Transmission_Control_Protocol) [(RFC 9293)](https://datatracker.ietf.org/doc/html/rfc9293#name-header-format)
79
* UDP header [(User Datagram Protocol)](https://en.wikipedia.org/wiki/User_Datagram_Protocol) [(RFC 768)](https://datatracker.ietf.org/doc/html/rfc768)
810
* ARP [(Address Resolution Protocol)](https://en.wikipedia.org/wiki/Address_Resolution_Protocol) [(RFC 826)](https://datatracker.ietf.org/doc/html/rfc826)
@@ -25,6 +27,7 @@ The `jipcs` contains the following codecs:
2527
* SEND [(Secure Neighbor Discovery)](https://en.wikipedia.org/wiki/Secure_Neighbor_Discovery) [(RFC 3971)](https://datatracker.ietf.org/doc/html/rfc3971)
2628
* MRD [(Multicast Router Discovery)](https://en.wikipedia.org/wiki/Multicast_router_discovery) [(RFC 4286)](https://datatracker.ietf.org/doc/html/rfc4286)
2729
* RPL [(Routing Protocol for Low-Power and Lossy Networks)](https://en.wikipedia.org/wiki/IPv6_Routing_Protocol_for_Low-Power_and_Lossy_Networks) [(RFC 6550)](https://datatracker.ietf.org/doc/html/rfc6550)
30+
* MPL (Multicast Protocol for Low-Power and Lossy Networks) [(RFC 7731)](https://datatracker.ietf.org/doc/html/rfc7731)
2831
* PROBE [(RFC 8335)](https://datatracker.ietf.org/doc/html/rfc8335)
2932

3033
Requirements:

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ plugins {
55
}
66

77
group = 'io.github.hirsivaja'
8-
version = '1.2.0'
8+
version = '1.2.1'
99

1010
repositories {
1111
mavenCentral()

src/main/java/com/github/hirsivaja/ip/icmpv6/Icmpv6Message.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.github.hirsivaja.ip.icmpv6;
22

3-
import com.github.hirsivaja.ip.icmpv6.ndp.ExperimentalMobilitySubtype;
43
import com.github.hirsivaja.ip.icmpv6.mld.GenericMldMessage;
54
import com.github.hirsivaja.ip.icmpv6.mld.MulticastListenerQueryMessage;
65
import com.github.hirsivaja.ip.icmpv6.mld.MulticastListenerReportV2Message;

src/main/java/com/github/hirsivaja/ip/icmpv6/ndp/option/DomainName.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
public record DomainName(List<ByteArray> labels) {
99

1010
public void encode(ByteBuffer out) {
11-
for(int i = 0; i < labels.size(); i++) {
12-
out.put((byte) labels.get(i).length());
13-
out.put(labels.get(i).array());
11+
for (ByteArray label : labels) {
12+
out.put((byte) label.length());
13+
out.put(label.array());
1414
}
1515
out.put((byte) 0);
1616
}
@@ -21,7 +21,7 @@ public int length() {
2121

2222
public static DomainName decode(ByteBuffer in) {
2323
List<ByteArray> labels = new ArrayList<>();
24-
int len = 0;
24+
int len;
2525
do {
2626
len = Byte.toUnsignedInt(in.get());
2727
if(len > 0) {

src/main/java/com/github/hirsivaja/ip/icmpv6/rpl/option/RplOptionType.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,15 @@ public enum RplOptionType {
1010
TRANSIT_INFORMATION((byte) 0x06),
1111
SOLICITED_INFORMATION((byte) 0x07),
1212
PREFIX_INFORMATION((byte) 0x08),
13-
RPL_TARGET_DESCRIPTOR((byte) 0x09);
13+
RPL_TARGET_DESCRIPTOR((byte) 0x09),
14+
P2P_ROUTE_DISCOVERY((byte) 0x0A),
15+
RREQ((byte) 0x0B),
16+
RREP((byte) 0x0C),
17+
ART((byte) 0x0D),
18+
RNFD((byte) 0x0E),
19+
STATEFUL_VIO((byte) 0x0F),
20+
SOURCE_ROUTED_VIO((byte) 0x10),
21+
SIBLING_INFORMATION((byte) 0x11);
1422

1523
private final byte type;
1624

src/main/java/com/github/hirsivaja/ip/ipv4/option/IpOption.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
import java.nio.ByteBuffer;
44

55
public interface IpOption {
6-
static byte CONTROL = 0;
7-
static byte RESERVED_1 = 1;
8-
static byte DEBUG = 2;
9-
static byte RESERVED_2 = 3;
6+
byte CONTROL = 0;
7+
byte RESERVED_1 = 1;
8+
byte DEBUG = 2;
9+
byte RESERVED_2 = 3;
1010

1111
void encode(ByteBuffer out);
1212

src/main/java/com/github/hirsivaja/ip/ipv4/option/IpOptionType.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@ public enum IpOptionType {
2626
// 0x16 is unassigned
2727
DYNAMIC_PACKET_STATE((byte) 0x17, IpOption.CONTROL, true),
2828
UPSTREAM_MULTICAST_PACKET((byte) 0x18, IpOption.CONTROL, true),
29-
QUICK_START((byte) 0x19, IpOption.CONTROL, false);
29+
QUICK_START((byte) 0x19, IpOption.CONTROL, false),
30+
EXPERIMENT_1((byte) 0x1E, IpOption.CONTROL, false),
31+
EXPERIMENT_2((byte) 0x1E, IpOption.DEBUG, false),
32+
EXPERIMENT_3((byte) 0x1E, IpOption.CONTROL, true),
33+
EXPERIMENT_4((byte) 0x1E, IpOption.DEBUG, true);
3034

3135
private final byte number;
3236
private final byte optionClass;

src/main/java/com/github/hirsivaja/ip/ipv4/option/Timestamp.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public void encode(ByteBuffer out) {
1212
out.put((byte) (length()));
1313
out.put(pointer);
1414
out.put(flags);
15-
ipOrTimestamp.forEach(i -> out.putInt(i));
15+
ipOrTimestamp.forEach(out::putInt);
1616
}
1717

1818
@Override

src/main/java/com/github/hirsivaja/ip/ipv6/extension/HipExtension.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import com.github.hirsivaja.ip.IpProtocol;
55

66
import java.nio.ByteBuffer;
7+
import java.util.logging.Logger;
78

89
public record HipExtension(
910
IpProtocol nextHeader,
@@ -14,6 +15,7 @@ public record HipExtension(
1415
ByteArray senderHit,
1516
ByteArray receiverHit,
1617
ByteArray hipParameters) implements ExtensionHeader {
18+
private static final Logger logger = Logger.getLogger("HipExtension");
1719

1820
public HipExtension(IpProtocol nextHeader, byte packetType, byte flags, short checksum, short controls, byte[] senderHit, byte[] receiverHit, byte[] hipParameters) {
1921
this(nextHeader, packetType, flags, checksum, controls, new ByteArray(senderHit), new ByteArray(receiverHit), new ByteArray(hipParameters));
@@ -48,9 +50,9 @@ public static ExtensionHeader decode(ByteBuffer in, boolean ensureChecksum) {
4850
byte flags = in.get();
4951
short checksum = in.getShort();
5052
if(ensureChecksum) {
51-
// TODO
53+
logger.warning("Checksum verification for HipExtension is not implemented!");
5254
} else {
53-
// TODO
55+
logger.finer("Skipped checksum verification for HipExtension!");
5456
}
5557
short controls = in.getShort();
5658
byte[] senderHit = new byte[16];

src/main/java/com/github/hirsivaja/ip/ipv6/extension/MobilityHeaderExtension.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@
55
import com.github.hirsivaja.ip.ipv6.extension.mobility.MobilityMessageType;
66

77
import java.nio.ByteBuffer;
8+
import java.util.logging.Logger;
89

910
public record MobilityHeaderExtension(
1011
IpProtocol nextHeader,
1112
short checksum,
1213
MobilityMessage mobilityMessage) implements ExtensionHeader {
14+
private static final Logger logger = Logger.getLogger("MobilityHeaderExtension");
1315

1416
@Override
1517
public void encode(ByteBuffer out) {
@@ -36,9 +38,9 @@ public static ExtensionHeader decode(ByteBuffer in, boolean ensureChecksum) {
3638
in.get(); // RESERVED
3739
short checksum = in.getShort();
3840
if(ensureChecksum) {
39-
// TODO
41+
logger.warning("Checksum verification for MobilityHeaderExtension is not implemented!");
4042
} else {
41-
// TODO
43+
logger.finer("Skipped checksum verification for MobilityHeaderExtension!");
4244
}
4345
byte[] messageBytes = new byte[headerLen + 2];
4446
in.get(messageBytes);

0 commit comments

Comments
 (0)