A library to assist in constructing RSCP (remote storage control protocol) frames and data to communicate with E3DC servers.
RSCP is a proprietary protocol from E3/DC GmbH.
This library is available under the MIT license.
- JDK 1.8+
- Maven 3.6
Add a dependency in your pom.xml
:
<dependencies>
<dependency>
<groupId>io.github.bvotteler</groupId>
<artifactId>e3dc-rscp</artifactId>
<version>1.0.1</version>
</dependency>
</dependencies>
To construct a frame, we can use RSCPData.Builder
in combination with RSCPFrame.Builder
.
Typically, we want to start with an authentication frame like this:
// set user name (same as used to login to the portal)
RSCPData authUser = RSCPData.builder()
.tag(RSCPTag.TAG_RSCP_AUTHENTICATION_USER)
.stringValue(user)
.build();
// add password (same as used to login to the portal)
RSCPData authPwd = RSCPData.builder()
.tag(RSCPTag.TAG_RSCP_AUTHENTICATION_PASSWORD)
.stringValue(password)
.build();
// combine user/password into a authentication request container
RSCPData authContainer = RSCPData.builder()
.tag(RSCPTag.TAG_RSCP_REQ_AUTHENTICATION)
.containerValues(Arrays.asList(authUser, authPwd))
.build();
// put the authentication request into a frame
RSCPFrame authFrame = RSCPFrame.builder()
.addData(authContainer)
.timestamp(Instant.now())
.build();
// get byte array ready to be encrypted and sent to the server
byte[] frame = authFrame.getAsByteArray();
Similarly, we can use the received, decrypted byte array to inspect the response.
// assuming we have the response byte array in byte[] response...
RSCPFrame frame = RSCPFrame.builder()
.buildFromRawBytes(response);
// get the contents of the frame
List<RSCPData> dataList = frame.getData();
// an authentication response contains a single data set with the authentication level
// as CHAR8 value which fits into a Java short
RSCPData authData = dataList.get(0);
// read optional short (will be empty if the data cannot be expressed as short)
Optional<Short> authLevel = authData.getValueAsInt();
rscp-e3dc-sample is a sample project showing how this library could be used.
It shows how to construct an authentication frame, as well as a database request frame. In addition, it shows how to encrypt and decrypt frames sent to/received from E3DC servers.
Build the library with:
mvn clean compile
Run the tests with:
mvn test
To package the project, run:
mvn package
You can also configure your local repository for Maven, then run:
mvn package install