Skip to content

Commit

Permalink
1.0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
steely-glint committed Oct 8, 2022
1 parent a083114 commit a55834c
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 21 deletions.
12 changes: 6 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>pe.pi</groupId>
<artifactId>sctp4j</artifactId>
<version>1.0.5-SNAPSHOT</version>
<version>1.0.5</version>
<packaging>jar</packaging>

<name>sctp4j</name>
Expand All @@ -31,8 +31,8 @@
<dependencies>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
<version>1.68</version>
<artifactId>bcutil-jdk18on</artifactId>
<version>1.71</version>
</dependency>
<dependency>
<groupId>org.glassfish</groupId>
Expand All @@ -41,8 +41,8 @@
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bctls-jdk15on</artifactId>
<version>1.68</version>
<artifactId>bctls-jdk18on</artifactId>
<version>1.71</version>
</dependency>
<dependency>
<groupId>junit</groupId>
Expand All @@ -65,7 +65,7 @@
<dependency>
<groupId>com.phono</groupId>
<artifactId>srtplight</artifactId>
<version>1.1.10-SNAPSHOT</version>
<version>1.1.10</version>
</dependency>
</dependencies>
<distributionManagement>
Expand Down
47 changes: 32 additions & 15 deletions src/main/java/pe/pi/sctp4j/sctp/messages/Chunk.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,13 @@
import com.phono.srtplight.Log;
import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
*
Expand Down Expand Up @@ -196,27 +201,39 @@ void putFixedParams(ByteBuffer ret) {
--------------------------------------------------------------
0x81 Packet Drop Chunk (PKTDROP)
*/

final static HashMap<Integer, String> _typeLookup;//= //{"DATA", "INIT", "INIT ACK", "SACK", "HEARTBEAT", "HEARTBEAT ACK", "ABORT", "SHUTDOWN", "SHUTDOWN ACK", "ERROR", "COOKIE ECHO", "COOKIE ACK", "ECNE", "CWR", "SHUTDOWN COMPLETE","AUTH"};
final static Map<Integer, String> _typeLookup
= Collections.unmodifiableMap(Stream.of(
new AbstractMap.SimpleEntry<>(0,"DATA"),
new AbstractMap.SimpleEntry<>(1,"INIT"),
new AbstractMap.SimpleEntry<>(2,"INIT ACK"),
new AbstractMap.SimpleEntry<>(3,"SACK"),
new AbstractMap.SimpleEntry<>(4,"HEARTBEAT"),
new AbstractMap.SimpleEntry<>(5, "HEARTBEAT ACK"),
new AbstractMap.SimpleEntry<>(6, "ABORT"),
new AbstractMap.SimpleEntry<>(7, "SHUTDOWN"),
new AbstractMap.SimpleEntry<>(8, "SHUTDOWN ACK"),
new AbstractMap.SimpleEntry<>(9, "ERROR"),
new AbstractMap.SimpleEntry<>(10, "COOKIE ECHO"),
new AbstractMap.SimpleEntry<>(11, "COOKIE ACK"),
new AbstractMap.SimpleEntry<>(12, "ECNE"),
new AbstractMap.SimpleEntry<>(13, "CWR"),
new AbstractMap.SimpleEntry<>(14, "SHUTDOWN COMPLETE"),
new AbstractMap.SimpleEntry<>(15, "AUTH"),
new AbstractMap.SimpleEntry<>(0xC1, "ASCONF"),
new AbstractMap.SimpleEntry<>(0x80, "ASCONF-ACK"),
new AbstractMap.SimpleEntry<>(130, "RE-CONFIG"),
new AbstractMap.SimpleEntry<>(192, "FORWARDTSN"),
new AbstractMap.SimpleEntry<>(0x81, "PKTDROP")
).collect(Collectors.toMap((e) -> e.getKey(), (e) -> e.getValue())));
final static Map<String, Integer> __nameMap = _typeLookup.entrySet().stream().collect(Collectors.toMap(
e -> e.getValue(),
e -> e.getKey()));
byte _type;
byte _flags;
int _length;
ByteBuffer _body;
ArrayList<VariableParam> _varList = new ArrayList<VariableParam>();

static {
_typeLookup = new HashMap();
String[] names4960 = {"DATA", "INIT", "INIT ACK", "SACK", "HEARTBEAT", "HEARTBEAT ACK", "ABORT", "SHUTDOWN", "SHUTDOWN ACK", "ERROR", "COOKIE ECHO", "COOKIE ACK", "ECNE", "CWR", "SHUTDOWN COMPLETE", "AUTH"};
for (int i = 0; i < names4960.length; i++) {
_typeLookup.put(new Integer(i), names4960[i]);
}
_typeLookup.put(new Integer(0xC1), "ASCONF");
_typeLookup.put(new Integer(0x80), "ASCONF-ACK");
_typeLookup.put(new Integer(130), "RE-CONFIG");
_typeLookup.put(new Integer(192), "FORWARDTSN");
_typeLookup.put(new Integer(0x81), "PKTDROP");

}

protected Chunk(byte type) {
_type = type;
Expand Down

0 comments on commit a55834c

Please sign in to comment.